Skip to content

Conversation

ja5087
Copy link

@ja5087 ja5087 commented Apr 17, 2025

Thanks for the useful tool! We are currently seeing rare errors from the read_events thread, probably due to occasional network interruptions/container restarts/whatnot.
When this occurs, an uncaught exception bubbles up to the global scope and this is difficult for us to manage using conventional log/monitoring systems.

For reference we are seeing the following error:

Exception in thread Thread-4 (read_events):
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.11/threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "/app/.venv/lib/python3.11/site-packages/devcycle_python_sdk/managers/sse_manager.py", line 34, in read_events
    for event in self.client.all:
  File "/app/.venv/lib/python3.11/site-packages/ld_eventsource/sse_client.py", line 217, in all
    raise error
  File "/app/.venv/lib/python3.11/site-packages/ld_eventsource/sse_client.py", line 189, in all
    for ec in reader.events_and_comments:
  File "/app/.venv/lib/python3.11/site-packages/ld_eventsource/reader.py", line 74, in events_and_comments
    for line in self._lines_source:
  File "/app/.venv/lib/python3.11/site-packages/ld_eventsource/reader.py", line 21, in lines_from
    for chunk in chunks:
  File "/app/.venv/lib/python3.11/site-packages/urllib3/response.py", line 1063, in stream
    yield from self.read_chunked(amt, decode_content=decode_content)
  File "/app/.venv/lib/python3.11/site-packages/urllib3/response.py", line 1219, in read_chunked
    self._update_chunk_length()
  File "/app/.venv/lib/python3.11/site-packages/urllib3/response.py", line 1149, in _update_chunk_length
    raise ProtocolError("Response ended prematurely") from None
urllib3.exceptions.ProtocolError: Response ended prematurely

@ja5087 ja5087 force-pushed the wrap_read_event_thread branch from f37fa57 to 22b2964 Compare April 17, 2025 07:55
@ja5087
Copy link
Author

ja5087 commented Apr 21, 2025

@jonathannorris Could you take a look? We're working on rolling out DevCycle at our organization and this is a major blocker for us. Thank you!

@jonathannorris
Copy link
Member

@ja5087 Thanks for the PR, working on getting it merged. We seem to have some issues with our Test Harness running with PRs from external folks, I copied the PR changes over here: #86

@jonathannorris
Copy link
Member

@ja5087 https://github.com/DevCycleHQ/python-server-sdk/releases/tag/v3.11.1 is released with the fix.

@ja5087
Copy link
Author

ja5087 commented Apr 21, 2025

Thanks @jonathannorris for the quick fix!
Looking forward to deploying this on our end.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants