Commit 2ebef9d
test: Add failing test for thread leak when construction fails
__start_up() creates the event processor - starting a dispatcher thread, a pool
of flush workers and two repeating timer threads - and only then starts the data
system. If the data system fails to start, the exception propagates out of the
constructor, the caller never receives a client object, and there is no handle
on which to call close(). Everything already started keeps running.
The test uses a configured update_processor_class that raises in start(), and
currently reports eight leaked threads:
ldclient.events.context-flush.repeating, ldclient.events.flush.repeating,
ldclient.events.processor, ldclient.flush.1 .. ldclient.flush.5
plus the event processor's HTTP connection pool. These are daemon threads so
they do not prevent process exit, but they leak steadily in any application
that retries client construction, and postfork() re-runs this same path.
Marked xfail strict so it fails loudly once the behaviour is fixed and the
marker can be removed. No fix is proposed here.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 5da1515 commit 2ebef9d
1 file changed
Lines changed: 69 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
0 commit comments