[Kamailio-Users] perl module, "pv_sprintf: Memory exhausted!"
Christian Koch
chri.koch.vier at googlemail.com
Tue May 19 15:25:03 CEST 2009
Hello Daniel,
Daniel-Constantin Mierla schrieb:
>> we're using kamailio 1.5.1 with modules htable and perl to generate
>> CDRs. Using htable we save some variables which are dumped to file
>> using the perl module at the end of the call.
>> We did a small stress test with 5 calls in parallel (each call about
>> 20 seconds) and we got after about 6 hours the following error:
>>
>> ERROR:core:pv_sprintf: pv_sprintf: Memory exhausted!
>>
> this is system memory error. Has nothing to do with pkg memory used by
> Kamailio. Seems that perl module allocates some memory and forgets to
> free it. Do you see other errors in your syslog?
>
> One memleak I could spot is that the allocated buffer to print the
> output in pv_sprintf is not freed if the formatted string is bad. Then
> I see that the output buffer is duplicated with strdup and it is
> freed. So seems there are some system memory leaks in perl module,
> indeed.
Are you sure this is system memory? We changed PKG_MEM_POOL_SIZE from 4
to 8MB and a stress test didn't show any problems for more then 12
hours. Then we changed it to 0.5MB and the problem occured after about 3
hours again wiht the same error message.
The error message in pv_sprintf() occurs when pkg_malloc() returns NULL,
so this should be a PKG issue?!?
Currently we're running a test with 0.5MB of pkg memory, but we've fixed
the error in pv_sprintf where the format is wrong and the buffer is not
freed. In the test this morning (with 0.5MB) we had the message "wrong
format" only once, and in all the other tests the message didn't show
up. So we don't think this fixes the problem.
Do you think only one missing pkg_free() (like in the last test) can
corrupt the memory so this error occurs?
Thanks for your help!
Christian
More information about the sr-users
mailing list