On 07.05.24 11:15, Juha Heinanen via sr-users wrote:
Juha Heinanen via sr-users writes:

I noticed that sql_query does not (anymore)  work when called from
event route:
I created bug issue https://github.com/kamailio/kamailio/issues/3843
about this to GitHub, since it really looks like a bug, because the same
code has worked fine in some earlier K release.

I posted on the tracker as well, but for sake of completing the discussion here for mailing list archive ...

Connection close event is executed from TCP main process, which likely has no SQL connection open. Till some point in the past, connection close event was triggered from a few places (from tcp worker processes), but actually it was not done for all cases when the connections were closed, some of these events missing (there are situations when only tcp main process close the connections). Now, I would strongly advise doing anything time expensive in the TCP main process, it was designed only as tcp connections manager, so in this case, I would rather delegate the sql query to an async worker (via async module or via mqueue+rtimer).

Cheers, Daniel

-- 
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com