Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news.d/bugfix/1743.core.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hide `ConnectionResetError` caused by a race condition when Plover is restarted.
12 changes: 10 additions & 2 deletions plover/oslayer/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,16 @@ def is_owner(self):

def force_cleanup(self):
assert not self.is_owner
if PLATFORM != "win" and os.path.exists(self._address):
os.unlink(self._address)
if PLATFORM != "win":
try:
os.unlink(self._address)
except FileNotFoundError:
# possible race condition: a ConnectionResetError might be caused
# by the previous instance dying just as this instance tries to
# connect to it. In that case self._address would have existed
# at the creation of controller but now no longer exists.
# We ignore the error
pass
return True
return False

Expand Down
1 change: 1 addition & 0 deletions plover/scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def main():
# Assume the previous instance died, leaving
# a stray socket, try cleaning it...
if not controller.force_cleanup():
log.error("force cleaning failed")
raise
# ...and restart.
code = -1
Expand Down