[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openser-users
Subject:    Re: [SR-Users] No "child_destroy" export - issue with module flatstore and flush=0
From:       "Chaigneau, Nicolas" <nicolas.chaigneau () capgemini ! com>
Date:       2021-10-29 11:32:46
Message-ID: DB3PR0202MB3564ADAA8C5526D195775C31E6879 () DB3PR0202MB3564 ! eurprd02 ! prod ! outlook ! com
[Download RAW message or body]

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)



Regards,
Nicolas.

De : Henning Westerholt <hw@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?

Cheers,

Henning

From: Chaigneau, Nicolas \
                <nicolas.chaigneau@capgemini.com<mailto:nicolas.chaigneau@capgemini.com>>
                
Sent: Wednesday, October 27, 2021 9:28 AM
To: Henning Westerholt <hw@gilawa.com<mailto:hw@gilawa.com>>; Kamailio (SER) - Users \
                Mailing List \
                <sr-users@lists.kamailio.org<mailto:sr-users@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 ?


Regards,
Nicolas.

De : Henning Westerholt <hw@gilawa.com<mailto:hw@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).

Cheers,

Henning

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

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

Hello,


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.

Regards,
Nicolas.
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.


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:x="urn:schemas-microsoft-com:office:excel" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FR" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hello Henning,<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">This is not a race condition.<o:p></o:p></p>
<p class="MsoNormal">The issue I&#8217;m observing is the \
following&nbsp;:<o:p></o:p></p> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Kamailio receives a signal SIGTERM (15) when it&#8217;s being \
stopped.<o:p></o:p></p> <p class="MsoNormal">The main process propagates the signal \
to the children.<o:p></o:p></p> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">The children terminate without closing their opened file \
handles. Consequently, the files are not flushed to disk.<o:p></o:p></p> <p \
class="MsoNormal">This entails we&#8217;re losing all data written to these files \
since the previous automatic flush.<o:p></o:p></p> <p \
class="MsoNormal"><o:p>&nbsp;</o:p></p> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Did anyone try using parameter «&nbsp;flush = 0&nbsp;» of module \
db_flatstore&nbsp;? (the default is 1)<o:p></o:p></p> <p \
class="MsoNormal"><o:p>&nbsp;</o:p></p> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Nicolas.<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span \
style="mso-fareast-language:FR">De&nbsp;:</span></b><span \
style="mso-fareast-language:FR"> Henning Westerholt &lt;hw@gilawa.com&gt; <br>
<b>Envoyé&nbsp;:</b> vendredi 29 octobre 2021 12:00<br>
<b>À&nbsp;:</b> Chaigneau, Nicolas<br>
<b>Cc&nbsp;:</b> Kamailio (SER) - Users Mailing List<br>
<b>Objet&nbsp;:</b> RE: No &quot;child_destroy&quot; export - issue with module \
flatstore and flush=0<o:p></o:p></span></p> </div>
</div>
<div>
<p class="MsoNormal"><span lang="DE" style="color:black"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="DE">Hi Nicolas,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE">&nbsp;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">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.</span><span lang="DE"><o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-GB">&nbsp;</span><span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-GB">What kind of errors are you observing, some race \
conditions or similar?</span><span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-GB">&nbsp;</span><span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-GB">Cheers,</span><span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-GB">&nbsp;</span><span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-GB">Henning \
</span><span lang="DE"><o:p></o:p></span></p> </div>
<p class="MsoNormal"><span lang="EN-GB">&nbsp;</span><span \
lang="DE"><o:p></o:p></span></p> <div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:35.4pt"><b><span lang="DE" \
style="mso-fareast-language:DE">From:</span></b><span lang="DE" \
style="mso-fareast-language:DE"> Chaigneau, Nicolas &lt;<a \
href="mailto:nicolas.chaigneau@capgemini.com">nicolas.chaigneau@capgemini.com</a>&gt; \
<br> <b>Sent:</b> Wednesday, October 27, 2021 9:28 AM<br>
<b>To:</b> Henning Westerholt &lt;<a \
href="mailto:hw@gilawa.com">hw@gilawa.com</a>&gt;; Kamailio (SER) - Users Mailing \
List &lt;<a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>&gt;<br>
 <b>Subject:</b> RE: No &quot;child_destroy&quot; export - issue with module \
flatstore and flush=0</span><span lang="DE"><o:p></o:p></span></p> </div>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><span \
lang="DE">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt">Hello Henning,<span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:35.4pt">&nbsp;<span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt">&nbsp;<span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:35.4pt">Thanks for your reply&nbsp;!<span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt">&nbsp;<span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:35.4pt">For the record, I&#8217;m using Kamailio \
module &quot;flatstore&quot; with the flush deactivated. In this situation, when \
Kamailio is stopped, I&#8217;m losing the remaining data in files not yet \
flushed.<span lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt">So my idea was, when destroy is called, to iterate over \
the connection pools, and flush/close all the opened files properly.<span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt">&nbsp;<span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:35.4pt">But I found out that it&#8217;s not that \
simple&nbsp;:/<span lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt">&nbsp;<span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:35.4pt">Do you think this is something that \
could be fixed in Kamailio&nbsp;?<span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:35.4pt">&nbsp;<span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt">&nbsp;<span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:35.4pt">Regards,<span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt">Nicolas.<span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:35.4pt">&nbsp;<span \
lang="DE"><o:p></o:p></span></p> <div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:35.4pt"><b><span \
style="mso-fareast-language:FR">De&nbsp;:</span></b><span \
style="mso-fareast-language:FR"> Henning Westerholt &lt;<a \
href="mailto:hw@gilawa.com">hw@gilawa.com</a>&gt; <br>
<b>Envoyé&nbsp;:</b> mardi 26 octobre 2021 20:38<br>
<b>À&nbsp;:</b> Kamailio (SER) - Users Mailing List<br>
<b>Cc&nbsp;:</b> Chaigneau, Nicolas<br>
<b>Objet&nbsp;:</b> RE: No &quot;child_destroy&quot; export ?</span><span \
lang="DE"><o:p></o:p></span></p> </div>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="DE" \
style="color:black">&nbsp;</span><span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:35.4pt"><span lang="DE">Hi \
Nicolas,<o:p></o:p></span></p> <p class="MsoNormal" style="margin-left:35.4pt"><span \
lang="DE">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt"><span lang="EN-GB">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.</span><span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt"><span lang="EN-GB">&nbsp;</span><span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt"><span lang="EN-GB">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).</span><span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt"><span lang="EN-GB">&nbsp;</span><span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt"><span lang="EN-GB">Cheers,</span><span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt"><span lang="EN-GB">&nbsp;</span><span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt"><span lang="EN-GB">Henning</span><span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt"><span lang="EN-GB">&nbsp;</span><span \
lang="DE"><o:p></o:p></span></p> <div>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-GB">-- </span><span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt"><span lang="EN-GB">Henning Westerholt &#8211; </span><span \
lang="DE"><a href="https://skalatan.de/blog/"><span \
lang="EN-GB">https://skalatan.de/blog/</span></a><o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-GB">Kamailio services \
&#8211; </span><span lang="DE"><a href="https://gilawa.com/"><span \
lang="EN-GB">https://gilawa.com</span></a><o:p></o:p></span></p> </div>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-GB">&nbsp;</span><span \
lang="DE"><o:p></o:p></span></p> <div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:70.8pt"><b><span lang="DE" \
style="mso-fareast-language:DE">From:</span></b><span lang="DE" \
style="mso-fareast-language:DE"> sr-users &lt;<a \
href="mailto:sr-users-bounces@lists.kamailio.org">sr-users-bounces@lists.kamailio.org</a>&gt;
 <b>On Behalf Of </b>Chaigneau, Nicolas<br>
<b>Sent:</b> Tuesday, October 26, 2021 7:14 PM<br>
<b>To:</b> <a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a><br>
 <b>Subject:</b> [SR-Users] No &quot;child_destroy&quot; export ?</span><span \
lang="DE"><o:p></o:p></span></p> </div>
</div>
<p class="MsoNormal" style="margin-left:70.8pt"><span \
lang="DE">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:70.8pt">Hello,<span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:70.8pt">&nbsp;<span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:70.8pt">&nbsp;<span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:70.8pt">I have a module, for which I need to \
perform some processing in the children processes when Kamailio is being \
stopped.<span lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:70.8pt">&nbsp;<span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:70.8pt">I&#8217;ve looked at the &quot;struct \
module_export&quot;, in which I see &quot;mod_init&quot;, &quot;child_init&quot;, \
&quot;mod_destroy&quot;&#8230; but no &quot;child_destroy&quot;.&nbsp;:/<span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" style="margin-left:70.8pt">Is \
there a way to achieve this&nbsp;?<span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:70.8pt">&nbsp;<span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:70.8pt">&nbsp;<span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:70.8pt">Thanks for your help.<span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:70.8pt">&nbsp;<span lang="DE"><o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:70.8pt">Regards,<span \
lang="DE"><o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:70.8pt">Nicolas.<span lang="DE"><o:p></o:p></span></p> </div>
<p></p>

<p></p>

<p></p>

<p style="font-size: 9px; ">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.</p></body> </html>



__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

--===============1383815937==--



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic