Hi, Federico!
Nice catch! Indeed, there seems to be a pkg memory leak during reload.
I committed a fix on the master branch that shoul fix this issue[1]. Can
you pelase test and let me know everything is ok this time, so I can
backport the fix to the other branches (2.1, 1.11).
[1]
https://github.com/OpenSIPS/opensips/commit/aa7429e0124478f999ba3737b10ae39900e16b2c
Thanks,
Răzvan Crainea
OpenSIPS Solutions
www.opensips-solutions.com
On 09/11/2015 05:07 PM, Federico Edorna wrote:
Hello,
in function load_pcres in regex_mod.c, I see that when you allocate
memory to read regex groups, the loop goes up to the max_groups
parameter
(http://www.opensips.org/html/docs/modules/1.11.x/regex.html#id249240) :
for (i=0; i<max_groups; i++) {
if ((patterns[i] = pkg_malloc(sizeof(char) *
group_max_size)) == 0) {
LM_ERR("no more memory for patterns[%d]\n", i);
fclose(f);
goto err;
}
memset(patterns[i], '\0', group_max_size);
}
but when you free memory, it seems that it's only done for the
patterns that actually are being used.
In fact, if I set the max_groups parameter to the same amount of
patterns in the regex file:
modparam("regex", "max_groups", 4)
when I run the "fifo regex_reload" loop, I never run out of pkmemory.
Regards
On Fri, Sep 4, 2015 at 12:18 PM, Federico Edorna <fedo...@anura.com.ar
<mailto:fedo...@anura.com.ar>> wrote:
Hi Team, I've found an issue when I reload regular expresion file
for opensips 1.11.5.
After executing a few "opensipsctl fifo regex_reload", the fifo
process runs out of pkmem. This is a small loop where I do a
regex_reload and then I print the pkmem for MI FIFO processs:
root@toro:~# sudo -u gc /home/gc/local/opensips/sbin/opensipsctl
fifo ps | grep "ID=4 "
Process:: ID=4 PID=11040 Type=MI FIFO
root@toro:~# while [ 1 -eq 1 ] ; do sudo -u gc
/home/gc/local/opensips/sbin/opensipsctl fifo regex_reload; sudo
-u gc /home/gc/local/opensips/sbin/opensipsctl fifo get_statistics
pkmem: |grep "pkmem:4-free_size::" ; done
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 140696
500 Server Internal Error
pkmem:4-free_size:: 140696
500 Server Internal Error
pkmem:4-free_size:: 140696
500 Server Internal Error
pkmem:4-free_size:: 140696
500 Server Internal Error
^C
root@toro:~#
For the following regex_reload commands the error in the syslog
file is this :
2015-09-04T11:56:05.645485-03:00 toro
/home/gc/local/opensips/sbin/opensips[11040]:
ERROR:regex:load_pcres: no more memory for patterns[11]
2015-09-04T11:56:05.645567-03:00 toro
/home/gc/local/opensips/sbin/opensips[11040]:
ERROR:regex:mi_pcres_reload: failed to reload pcres
The only way to recover from this is to restart opensips.
I've pasted the syslog (compiled with DBG_QM_MALLOC option) when
the command is succesfull: http://pastebin.com/VnMZrYrh
I tyied to increase the pkmem for the process, but sooner or later
the error came up
Thanks in advance!
Federico
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users