Skip to content

fix: catch ConnectionResetError (WSAECONNRESET) on socket sendto#214

Open
watatatata810 wants to merge 1 commit into
ideoforms:masterfrom
watatatata810:fix/connection-reset-freeze-windows
Open

fix: catch ConnectionResetError (WSAECONNRESET) on socket sendto#214
watatatata810 wants to merge 1 commit into
ideoforms:masterfrom
watatatata810:fix/connection-reset-freeze-windows

Conversation

@watatatata810

Copy link
Copy Markdown

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 a WSAECONNRESET error (Windows error code 10054).

Since socket.sendto() in OSCServer.send() was not catching socket.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.error in OSCServer.send(). If it encounters errno.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's Log.txt (since /playing_position is sent multiple times per second).

Changes

  • Wrapped self._socket.sendto inside OSCServer.send() with a socket.error exception handler.
  • Muted the logging when e.errno == errno.ECONNRESET to avoid log spam.
  • Log other serious socket errors as expected.

@CLAassistant

CLAassistant commented Jun 28, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants