Resolve the issue of inaccurate tcp_connections_no#3664
Conversation
|
Thank you @36952362 for the detailed report - you are totally right here. The
On a closer look at this |
|
Thanks for your comments @bogdan-iancu .I had updated the PR according to your suggestion. add one more param( Agree with you. According to the comment of |
Resolve the issue of inaccurate tcp_connections_no (cherry picked from commit 38efd08)
Resolve the issue of inaccurate tcp_connections_no (cherry picked from commit 38efd08)
Resolve the issue of inaccurate tcp_connections_no (cherry picked from commit 38efd08)
|
Thank you @36952362 , merge done and backported to all 3.4+ versions |
Resolve the issue of inaccurate tcp_connections_no
Summary
When OpenSIPS acts as a TCP/TLS client to create connections, the
tcp_connections_nocounter gradually decreases and may even become negative.Details
When other modules, such as
tm, need to send a message to a target address and no existing TCP/TLS connection is available, the TCP worker process responsible for sending the message will attempt to establish a new TLS connection and create atcp_connectionobject. It also increments thetcp_connections_nocounter; however, this increment only affects thetcp_connections_novariable local to the TCP worker process (as this variable is process-specific). Then, the worker notifies the TCP main process via a command (eitherASYNC_CONNECTorCONN_NEW).However, when the TCP main process receives the
ASYNC_CONNECTorCONN_NEWcommand, it does not increment its owntcp_connections_nocounter. Later, when the connection is destroyed (intcpconn_destroy) or expires due to its lifetime (intcpconn_lifetime), the counter is decremented.As a result, the

tcp_connections_nocounter gradually decreases and may even become negative.Solution
when the TCP main process receives the
ASYNC_CONNECTorCONN_NEWcommand, it also increment its owntcp_connections_nocounterCompatibility
N/A
Closing issues
N/A