TraceClient._drain (trace_client/trace_client.py:174-181) calls self._send(body) with no surrounding try. Only the try blocks inside _send keep the sender thread alive.
On main, _send builds the urllib.request.Request outside its try, so a base URL with no scheme kills the thread (#3). PR #4 moves that construction inside the try. After that change, no statement known to raise is left outside a guard. The thread's survival still depends on every future edit to _send keeping all raising code inside that try, though. If one slips through, the thread dies and a traceback goes to the host program's stderr. After that, report() keeps filling the queue up to QUEUE_CAPACITY with nothing draining it.
Suggested hardening (defense in depth, no behavior change today): wrap the self._send(body) call in _drain in try / except Exception: # noqa: BLE001. The handler logs _LOG.debug("[trace] ...") and continues the loop. A regression test can patch _send to raise once. It then asserts that threading.excepthook is not called and that a later report is still delivered.
No Java-visible behavior would change.
Depends on / follows #4.
This issue was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
drafted by Claude on behalf of Daniel Stephenson
TraceClient._drain(trace_client/trace_client.py:174-181) callsself._send(body)with no surroundingtry. Only thetryblocks inside_sendkeep the sender thread alive.On
main,_sendbuilds theurllib.request.Requestoutside itstry, so a base URL with no scheme kills the thread (#3). PR #4 moves that construction inside thetry. After that change, no statement known to raise is left outside a guard. The thread's survival still depends on every future edit to_sendkeeping all raising code inside thattry, though. If one slips through, the thread dies and a traceback goes to the host program's stderr. After that,report()keeps filling the queue up toQUEUE_CAPACITYwith nothing draining it.Suggested hardening (defense in depth, no behavior change today): wrap the
self._send(body)call in_drainintry/except Exception: # noqa: BLE001. The handler logs_LOG.debug("[trace] ...")and continues the loop. A regression test can patch_sendto raise once. It then asserts thatthreading.excepthookis not called and that a later report is still delivered.No Java-visible behavior would change.
Depends on / follows #4.
This issue was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
drafted by Claude on behalf of Daniel Stephenson