[OpenSIPS-Devel] [OpenSIPS/opensips] 97cae9: net/tcp: close write-worker fd on async write erro...

Ravitez Dondeti noreply at github.com
Tue May 12 13:42:07 UTC 2026


  Branch: refs/heads/3.4
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 97cae9c01f893da42b5990c16976b6c65754f1a4
      https://github.com/OpenSIPS/opensips/commit/97cae9c01f893da42b5990c16976b6c65754f1a4
  Author: Ravitez Dondeti <dondetir at users.noreply.github.com>
  Date:   2026-05-12 (Tue, 12 May 2026)

  Changed paths:
    M net/net_tcp_proc.c

  Log Message:
  -----------
  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 bffcf0035 from master.

Fixes: #3711



To unsubscribe from these emails, change your notification settings at https://github.com/OpenSIPS/opensips/settings/notifications



More information about the Devel mailing list