Skip to content

Fix streaming getting stuck with no socket timeout (#92)#96

Merged
polymerizedsage merged 2 commits intomainfrom
sage/stream-timeout
Apr 7, 2025
Merged

Fix streaming getting stuck with no socket timeout (#92)#96
polymerizedsage merged 2 commits intomainfrom
sage/stream-timeout

Conversation

@polymerizedsage
Copy link
Copy Markdown
Contributor

Closes #92 by adding a timeout to socket recv operations for the StreamOut node. When the socket stops sending data the CLI will show an error that it failed to get data from the socket. Tested with SciFi.

Comment thread synapse/client/nodes/stream_out.py Outdated
Copy link
Copy Markdown
Contributor

@antoniaelsen antoniaelsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested with sim devices as well, lgtm. would 1sec ever be too short for laggy connections?

try:
data, _ = self.__socket.recvfrom(8192)
bytes_read = len(data)
except socket.timeout:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could try to reconnect and read again here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like try to receive from the socket again? I don't quite understand why would try again after timing out. Shouldn't it be up to the caller to decide if they want to re-try the read?

@polymerizedsage polymerizedsage merged commit eb340a2 into main Apr 7, 2025
2 checks passed
@polymerizedsage polymerizedsage deleted the sage/stream-timeout branch April 7, 2025 21:09
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.

Can't end "read" on windows if client is not getting data

3 participants