fix: catch ConnectionResetError (WSAECONNRESET) on socket sendto#214
Open
watatatata810 wants to merge 1 commit into
Open
fix: catch ConnectionResetError (WSAECONNRESET) on socket sendto#214watatatata810 wants to merge 1 commit into
watatatata810 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On Windows, when sending UDP packets to a closed port (e.g., when the OSC client/viewer application is closed but Ableton Live is still playing and sending
/live/clip/playing_position), the OS returns aWSAECONNRESETerror (Windows error code10054).Since
socket.sendto()inOSCServer.send()was not catchingsocket.error/OSError, this unhandled exception propagated up to Ableton Live's MIDI Remote Script main thread. This caused Ableton Live to temporarily suspend/freeze the entire script execution for about 30 seconds to 1 minute, leading to significant delays when the client reconnected.This PR adds a try-except block to catch
socket.errorinOSCServer.send(). If it encounterserrno.ECONNRESET(10054), it silently ignores it. This prevents the script freeze and also avoids potential disk I/O bottlenecks that would occur from writing massive error logs to Ableton'sLog.txt(since/playing_positionis sent multiple times per second).Changes
self._socket.sendtoinsideOSCServer.send()with asocket.errorexception handler.e.errno == errno.ECONNRESETto avoid log spam.