Commit 97cae9c
authored
net/tcp: close write-worker fd on async write error (#3874)
In the IO_WATCH_WRITE handler, when the stream write handler returns
<0 (e.g. TLS async write fails after the 2s handshake timeout), the
error branch breaks out of the switch before reaching the close(s)
call that the success/pending paths hit at line 327.
The fd s is delivered to the write worker via SCM_RIGHTS and is an
independent copy in the worker's fd table — it must be explicitly
closed on every exit path. tcpconn_release_error() signals main to
close main's copy; close(s) closes the worker's copy. Without it
one fd leaks per failed async write, confirmed: 7 leaked fds from
51 TLS OPTIONS (handshake timeout path) vs. 0 with the fix.
Cherry-pick of bffcf00 from master.
Fixes: #37111 parent e71bfe2 commit 97cae9c
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| 315 | + | |
315 | 316 | | |
316 | 317 | | |
317 | 318 | | |
| |||
0 commit comments