Module: kamailio
Branch: 5.8
Commit: c3f424bd6c0f8b9a2557cd58a3e3f5ac586d8c99
URL: https://github.com/kamailio/kamailio/commit/c3f424bd6c0f8b9a2557cd58a3e3f5a…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2024-05-07T19:46:19+02:00
modules: readme files regenerated - modules ... [skip ci]
---
Modified: src/modules/tcpops/README
---
Diff: https://github.com/kamailio/kamailio/commit/c3f424bd6c0f8b9a2557cd58a3e3f5a…
Patch: https://github.com/kamailio/kamailio/commit/c3f424bd6c0f8b9a2557cd58a3e3f5a…
---
diff --git a/src/modules/tcpops/README b/src/modules/tcpops/README
index bbebe20ffb3..1897be96e1b 100644
--- a/src/modules/tcpops/README
+++ b/src/modules/tcpops/README
@@ -437,6 +437,14 @@ event_route[tcp:closed] {
Whether these routes are always called, never, or on a per socket basis
is controlled by the closed_event parameter.
+ Note that the event routes can be executed by TCP main process, which
+ manages the TCP connections but does not hande the SIP traffic over
+ them. It is very important not do do any time consuming operations
+ inside the event routes. Also, many resources might not be available in
+ the TCP main process (e.g., database connections), consider using async
+ module with async_task_data(...) or async_task_group_data() functions
+ for delegating task execution to async workers.
+
4.1. tcp:closed
Called for each "normal" TCP socket closure by the other side
Module: kamailio
Branch: master
Commit: 29910ecc8f27cf70aa4490f8ed5188199ad8e612
URL: https://github.com/kamailio/kamailio/commit/29910ecc8f27cf70aa4490f8ed51881…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2024-05-07T19:46:10+02:00
modules: readme files regenerated - tcpops ... [skip ci]
---
Modified: src/modules/tcpops/README
---
Diff: https://github.com/kamailio/kamailio/commit/29910ecc8f27cf70aa4490f8ed51881…
Patch: https://github.com/kamailio/kamailio/commit/29910ecc8f27cf70aa4490f8ed51881…
---
diff --git a/src/modules/tcpops/README b/src/modules/tcpops/README
index bbebe20ffb3..1897be96e1b 100644
--- a/src/modules/tcpops/README
+++ b/src/modules/tcpops/README
@@ -437,6 +437,14 @@ event_route[tcp:closed] {
Whether these routes are always called, never, or on a per socket basis
is controlled by the closed_event parameter.
+ Note that the event routes can be executed by TCP main process, which
+ manages the TCP connections but does not hande the SIP traffic over
+ them. It is very important not do do any time consuming operations
+ inside the event routes. Also, many resources might not be available in
+ the TCP main process (e.g., database connections), consider using async
+ module with async_task_data(...) or async_task_group_data() functions
+ for delegating task execution to async workers.
+
4.1. tcp:closed
Called for each "normal" TCP socket closure by the other side
Module: kamailio
Branch: 5.8
Commit: 383a81bb9d81e06ab9da99cdaa3def3b63028040
URL: https://github.com/kamailio/kamailio/commit/383a81bb9d81e06ab9da99cdaa3def3…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-05-07T19:34:35+02:00
tcpops: note about execution of event routes by TCP main process
(cherry picked from commit be9af338e3afdab1045cdd7c30a72a9ecddcb680)
---
Modified: src/modules/tcpops/doc/eventroutes.xml
---
Diff: https://github.com/kamailio/kamailio/commit/383a81bb9d81e06ab9da99cdaa3def3…
Patch: https://github.com/kamailio/kamailio/commit/383a81bb9d81e06ab9da99cdaa3def3…
---
diff --git a/src/modules/tcpops/doc/eventroutes.xml b/src/modules/tcpops/doc/eventroutes.xml
index ff05df24cdc..1166d366f0c 100644
--- a/src/modules/tcpops/doc/eventroutes.xml
+++ b/src/modules/tcpops/doc/eventroutes.xml
@@ -31,6 +31,16 @@
<emphasis>closed_event</emphasis>
parameter.
</para>
+ <para>
+ Note that the event routes can be executed by TCP main process,
+ which manages the TCP connections but does not hande the SIP traffic
+ over them. It is very important not do do any time consuming
+ operations inside the event routes. Also, many resources might not
+ be available in the TCP main process (e.g., database connections),
+ consider using async module with async_task_data(...) or
+ async_task_group_data() functions for delegating task execution
+ to async workers.
+ </para>
<section>
<title>
<function moreinfo="none">tcp:closed</function>
@@ -77,4 +87,4 @@ event_route[tcp:reset] {
</programlisting>
</para>
</section>
-</section>
\ No newline at end of file
+</section>
Module: kamailio
Branch: master
Commit: be9af338e3afdab1045cdd7c30a72a9ecddcb680
URL: https://github.com/kamailio/kamailio/commit/be9af338e3afdab1045cdd7c30a72a9…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-05-07T19:32:39+02:00
tcpops: note about execution of event routes by TCP main process
---
Modified: src/modules/tcpops/doc/eventroutes.xml
---
Diff: https://github.com/kamailio/kamailio/commit/be9af338e3afdab1045cdd7c30a72a9…
Patch: https://github.com/kamailio/kamailio/commit/be9af338e3afdab1045cdd7c30a72a9…
---
diff --git a/src/modules/tcpops/doc/eventroutes.xml b/src/modules/tcpops/doc/eventroutes.xml
index ff05df24cdc..1166d366f0c 100644
--- a/src/modules/tcpops/doc/eventroutes.xml
+++ b/src/modules/tcpops/doc/eventroutes.xml
@@ -31,6 +31,16 @@
<emphasis>closed_event</emphasis>
parameter.
</para>
+ <para>
+ Note that the event routes can be executed by TCP main process,
+ which manages the TCP connections but does not hande the SIP traffic
+ over them. It is very important not do do any time consuming
+ operations inside the event routes. Also, many resources might not
+ be available in the TCP main process (e.g., database connections),
+ consider using async module with async_task_data(...) or
+ async_task_group_data() functions for delegating task execution
+ to async workers.
+ </para>
<section>
<title>
<function moreinfo="none">tcp:closed</function>
@@ -77,4 +87,4 @@ event_route[tcp:reset] {
</programlisting>
</para>
</section>
-</section>
\ No newline at end of file
+</section>
### Description
I noticed that sql_query does not work (using latest 5.8 on Debian 12) when called from `tcp:closed` event_route:
```
event_route [tcp:closed] { # Handle TCP connection close
# Delete possible leftover registration
if ($conid)
sql_query("sip_proxy_cache", "DELETE FROM location WHERE server_id=0 AND connection_id=$conid", "result");
}
```
The query produces errors:
```
2024-05-07T11:30:14.785915+03:00 siika /usr/bin/sip-proxy[2848078]: CRITICAL: sqlops
[sqlops.c:213]: sql_check_connection(): no database handle with reconnect disabled
2024-05-07T11:30:14.785978+03:00 siika /usr/bin/sip-proxy[2848078]: ERROR: sqlops
[sqlops.c:232]: sql_query(): invalid connection to database
2024-05-07T11:30:14.786013+03:00 siika /usr/bin/sip-proxy[2848078]: ERROR: sqlops
[sqlops.c:237]: sql_query(): with query [DELETE FROM location WHERE server_id=0 AND
connection_id=7]
```
I added the last debug message in order to find out where the error comes from.
The same query works fine when executed from regular route and earlier (but don't remember when), the same query worked fine also from `tcp:closed` event_route.
This may be related to https://github.com/kamailio/kamailio/issues/3768.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3843
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3843(a)github.com>