The tcp_read.c code does not cover all cases when the connection can be closed, only when that happens during reading operations. But not on lifetime expiration and some other events -- that was the reason to move the execution of the event route for closed event in the tcp-main, because it is the process that destroys it, even when the close is detected on-read.

I don't think the solution is to go back to the older approach, but find a way to share the connection structure, because it is not yet destroyed when event route is executed, just no longer in the hash table.

Btw, I pushed some code after my previous comment, trying to make it more flexible to work with both cases: connection found active or connection just available for the event_route before destroying it.

Regarding the fact that the main-tcp can be occupied too long, that is a matter of what you do in the event route. If you know that is going to be some lengthly action with network i/o, then delegate it to another worker with mqueue+rtimer or async modules. Similar problems can happen for lengthy actions used in failure-route (blocking timer process) or even for sip worker processes.

Anyhow, you are welcome to propose enhancements as PRs, they will be reviewed and merged if they improve things.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/3768/1969380889@github.com>