[SR-Users] No "child_destroy" export - issue with module flatstore and flush=0

Chaigneau, Nicolas nicolas.chaigneau at capgemini.com
Fri Oct 29 13:32:46 CEST 2021

Hello Henning,

This is not a race condition.
The issue I'm observing is the following :

Kamailio receives a signal SIGTERM (15) when it's being stopped.
The main process propagates the signal to the children.

The children terminate without closing their opened file handles. Consequently, the files are not flushed to disk.
This entails we're losing all data written to these files since the previous automatic flush.

Did anyone try using parameter « flush = 0 » of module db_flatstore ? (the default is 1)


De : Henning Westerholt <hw at gilawa.com>
Envoyé : vendredi 29 octobre 2021 12:00
À : Chaigneau, Nicolas
Cc : Kamailio (SER) - Users Mailing List
Objet : RE: No "child_destroy" export - issue with module flatstore and flush=0

Hi Nicolas,

the module API could be changed of course, so far it was not needed as the module needs could be covered in the current API version.

What kind of errors are you observing, some race conditions or similar?



From: Chaigneau, Nicolas <nicolas.chaigneau at capgemini.com<mailto:nicolas.chaigneau at capgemini.com>>
Sent: Wednesday, October 27, 2021 9:28 AM
To: Henning Westerholt <hw at gilawa.com<mailto:hw at gilawa.com>>; Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org<mailto:sr-users at lists.kamailio.org>>
Subject: RE: No "child_destroy" export - issue with module flatstore and flush=0

Hello Henning,

Thanks for your reply !

For the record, I'm using Kamailio module "flatstore" with the flush deactivated. In this situation, when Kamailio is stopped, I'm losing the remaining data in files not yet flushed.
So my idea was, when destroy is called, to iterate over the connection pools, and flush/close all the opened files properly.

But I found out that it's not that simple :/

Do you think this is something that could be fixed in Kamailio ?


De : Henning Westerholt <hw at gilawa.com<mailto:hw at gilawa.com>>
Envoyé : mardi 26 octobre 2021 20:38
À : Kamailio (SER) - Users Mailing List
Cc : Chaigneau, Nicolas
Objet : RE: No "child_destroy" export ?

Hi Nicolas,

you are right, there is no special function for children destroy. Most modules do not need it, as the data is in shared memory, processes are started over standard kamailio APIs which will be stopped from the core automatically, to give some background.

Some modules do it by just iterating over an internal list of their children and then do the cleanup task. You can find an example in cdp module (destroy, diameter_peer_destroy).



Henning Westerholt - https://skalatan.de/blog/
Kamailio services - https://gilawa.com<https://gilawa.com/>

From: sr-users <sr-users-bounces at lists.kamailio.org<mailto:sr-users-bounces at lists.kamailio.org>> On Behalf Of Chaigneau, Nicolas
Sent: Tuesday, October 26, 2021 7:14 PM
To: sr-users at lists.kamailio.org<mailto:sr-users at lists.kamailio.org>
Subject: [SR-Users] No "child_destroy" export ?


I have a module, for which I need to perform some processing in the children processes when Kamailio is being stopped.

I've looked at the "struct module_export", in which I see "mod_init", "child_init", "mod_destroy"... but no "child_destroy". :/
Is there a way to achieve this ?

Thanks for your help.

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20211029/67bb522f/attachment.htm>

More information about the sr-users mailing list