Commit 388e24e
committed
fix: release the streaming connection and survive a concurrent commit
Two findings from the CodeRabbit review:
- When a streaming body threw, the explicit connection.close() inside session.doWork
was skipped. session.close() still ran, but the explicit close exists precisely
because Spring does not reliably release it, so the failure path could hold
database capacity. It is now in a finally, with assertions on both the completing
and the throwing path.
- dropStagedStreamingHeaders checked isCommitted and then iterated the headers
before calling reset(). On the timeout path a stream that started just as the
timeout fired can commit inside that window, and reset() would throw
IllegalStateException out of the @ExceptionHandler — replacing the intended 503
with a container 500 page. It now falls back to leaving the response alone.1 parent 1e1b3f6 commit 388e24e
3 files changed
Lines changed: 16 additions & 4 deletions
File tree
- backend
- app/src
- main/kotlin/io/tolgee
- test/kotlin/io/tolgee/util
- data/src/main/kotlin/io/tolgee/util
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
321 | | - | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
322 | 329 | | |
323 | 330 | | |
324 | 331 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
| |||
0 commit comments