[OpenSIPS-Users] ERROR:usrloc:shm_str_dup: no shared memory left

Bogdan-Andrei Iancu bogdan at voice-system.ro
Tue Dec 22 10:23:43 CET 2009


Hi Josip,

Josip Djuricic wrote:
> I've solved question 1 with mysql stored procedures, should be fine :)
>   
or you could simply use a mysql view (to create a virtual table over 
several real tables) which is much faster than a procedure (AFAIK).
> For question 2 I've changed ucontact.c and ul_mod.c and added
> use_static_domain as int, and static_domain as str, so I pass it in
> opensips.cfg, and added 
> if (use_static_domain) {
>                 vals[14].type = DB_STR;
>                 vals[14].nul = 0;
>                 vals[14].val.str_val.s = static_domain.s;
>                 vals[14].val.str_val.len = static_domain.len;
>         }
>
> Would that code be ok?
>   
you mean in db_insert_ucontact() ? if so, why not storing the AOR as you 
want from the beginning? the save() function allows you to pass a custom 
AOR (where you can put instead of domain an IP) to be saved.
       
http://www.opensips.org/html/docs/modules/devel/registrar.html#id228525

Regards,
Bogdan

> Thanks,
>
> Josip
>
> -----Original Message-----
> From: users-bounces at lists.opensips.org
> [mailto:users-bounces at lists.opensips.org] On Behalf Of Josip Djuricic
> Sent: Thursday, December 17, 2009 12:51 PM
> To: 'OpenSIPS users mailling list'
> Subject: Re: [OpenSIPS-Users] ERROR:usrloc:shm_str_dup: no shared memory
> left
>
> Yeap, I will send you a backtrace when I reproduce the problem, hope to do
> it soon.
>
> I have two other questions if possible?
>
> What should I change in order to use different fields for database table (I
> need to use different fields for our billing so that we can get back proper
> routing information)
>
> Basically what we are trying to do is move away from ser 0.9.6 to opensips,
> but since locations table is different:
> +---------------+---------------------+------+-----+-------------------+----
> ---+
> | Field         | Type                | Null | Key | Default           |
> Extra |
> +---------------+---------------------+------+-----+-------------------+----
> ---+
> | username      | varchar(50)         | NO   | PRI |                   |
> |
> | domain        | varchar(100)        | NO   | PRI |                   |
> |
> | contact       | varchar(255)        | NO   | PRI |                   |
> |
> | i_env         | int(11)             | NO   | PRI | 1                 |
> |
> | expires       | datetime            | YES  |     | NULL              |
> |
> | q             | float(10,2)         | YES  |     | NULL              |
> |
> | callid        | varchar(255)        | YES  |     | NULL              |
> |
> | cseq          | int(11)             | YES  |     | NULL              |
> |
> | last_modified | timestamp           | NO   |     | CURRENT_TIMESTAMP |
> |
> | replicate     | int(10) unsigned    | YES  |     | NULL              |
> |
> | state         | tinyint(1) unsigned | YES  |     | NULL              |
> |
> | flags         | int(11)             | NO   |     | 0                 |
> |
> | user_agent    | varchar(50)         | NO   |     |                   |
> |
> | received      | varchar(255)        | YES  |     | NULL              |
> |
> +---------------+---------------------+------+-----+-------------------+----
> ---+
>
> I assume there will be problems since there is no socket, methods, path (I
> believe socket is important)
>
> Is there any way I can perhaps tell usrloc that these values are in
> different tables?
>
> And second question is if I can somehow force domain value of usrloc to be
> ip value instead of domain...again a must for our billing (it gives back
> routing informations via radius to b2bua).
>
> Thanks,
>
> Josip
>
>
>
> -----Original Message-----
> From: users-bounces at lists.opensips.org
> [mailto:users-bounces at lists.opensips.org] On Behalf Of Bogdan-Andrei Iancu
> Sent: Thursday, December 17, 2009 12:30 PM
> To: OpenSIPS users mailling list
> Subject: Re: [OpenSIPS-Users] ERROR:usrloc:shm_str_dup: no shared memory
> left
>
> I see some logs from the kernel about the SEGFAULT, but I see no logs 
> from opensips about the SEGFAULT....normally, the attendant process 
> should detect the crash of any processes and report it.....
>
> the core file (if generated) should be in the working directory you set 
> for opensips (-w options). If none used, check the local dir or the / dir.
>
> Regards,
> Bogdan
>
> Josip Djuricic wrote:
>   
>> Where should the core be dumped by default?
>>
>> This is what has been logged (but since debug=0 not much)
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:usrloc:shm_str_dup: no shared memory left
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:usrloc:new_ucontact: no more shm memory
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:usrloc:mem_insert_ucontact: failed to create new contact
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:usrloc:insert_ucontact: failed to insert contact
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:registrar:insert_contacts: failed to insert contact
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6300]:
>> ERROR:usrloc:new_urecord: no more share memory
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6300]:
>> ERROR:usrloc:mem_insert_urecord: creating urecord failed
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6300]:
>> ERROR:usrloc:insert_urecord: inserting record failed
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6300]:
>> ERROR:registrar:insert_contacts: failed to insert new record structure
>> Dec 17 01:24:17 test03 kernel: [135241.226248] opensips[6302]: segfault at
>>     
> 0
>   
>> ip 7fc0c897efb1 sp 7fffb9a41fe0 error 6 in usrloc.so[7fc0c8977000+1b000]
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6301]:
>> ERROR:usrloc:new_ucontact: no more shm memory
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6301]:
>> ERROR:usrloc:mem_insert_ucontact: failed to create new contact
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6301]:
>> ERROR:usrloc:insert_ucontact: failed to insert contact
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6301]:
>> ERROR:registrar:insert_contacts: failed to insert contact
>> Dec 17 01:24:17 test03 kernel: [135241.381974] opensips[6300]: segfault at
>>     
> 0
>   
>> ip 7fc0c897efb1 sp 7fffb9a41fe0 error 6 in usrloc.so[7fc0c8977000+1b000]
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:usrloc:new_urecord: no more share memory
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:usrloc:mem_insert_urecord: creating urecord failed
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:usrloc:insert_urecord: inserting record failed
>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:registrar:insert_contacts: failed to insert new record structure
>> Dec 17 01:24:18 test03 /usr/local/sbin/opensips[6301]:
>> ERROR:usrloc:new_ucontact: no more shm memory
>> Dec 17 01:24:18 test03 /usr/local/sbin/opensips[6301]:
>> ERROR:usrloc:mem_insert_ucontact: failed to create new contact
>> Dec 17 01:24:18 test03 /usr/local/sbin/opensips[6301]:
>> ERROR:usrloc:insert_ucontact: failed to insert contact
>> Dec 17 01:24:18 test03 /usr/local/sbin/opensips[6301]:
>> ERROR:registrar:insert_contacts: failed to insert contact
>> Dec 17 01:24:18 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:usrloc:new_urecord: no more share memory
>> Dec 17 01:24:18 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:usrloc:mem_insert_urecord: creating urecord failed
>> Dec 17 01:24:18 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:usrloc:insert_urecord: inserting record failed
>> Dec 17 01:24:18 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:registrar:insert_contacts: failed to insert new record structure
>> Dec 17 01:24:18 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:usrloc:new_ucontact: no more shm memory
>> Dec 17 01:24:18 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:usrloc:mem_insert_ucontact: failed to create new contact
>> Dec 17 01:24:18 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:usrloc:insert_ucontact: failed to insert contact
>> Dec 17 01:24:18 test03 /usr/local/sbin/opensips[6303]:
>> ERROR:registrar:insert_contacts: failed to insert contact
>>
>> Before and after that nothing is logged.
>>
>> -----Original Message-----
>> From: users-bounces at lists.opensips.org
>> [mailto:users-bounces at lists.opensips.org] On Behalf Of Bogdan-Andrei Iancu
>> Sent: Thursday, December 17, 2009 11:50 AM
>> To: OpenSIPS users mailling list
>> Subject: Re: [OpenSIPS-Users] ERROR:usrloc:shm_str_dup: no shared memory
>> left
>>
>> And the crash did generated a coredump ? what were the last logs from 
>> opensips before vanishing ?
>>
>> Regards,
>> Bogdan
>>
>> Josip Djuricic wrote:
>>   
>>     
>>> Hi Bogdan,
>>>
>>> Unfortunately I forgot to mention that after this error happened this
>>>     
>>>       
>> night,
>>   
>>     
>>> opensips was not running anymore, I guess it crashed, but since I've used
>>> debug=0 I don't know what last happened before the crash.
>>>
>>> Thanks,
>>>
>>> Josip
>>>
>>>
>>> -----Original Message-----
>>> From: users-bounces at lists.opensips.org
>>> [mailto:users-bounces at lists.opensips.org] On Behalf Of Bogdan-Andrei
>>>       
> Iancu
>   
>>> Sent: Thursday, December 17, 2009 11:39 AM
>>> To: OpenSIPS users mailling list
>>> Subject: Re: [OpenSIPS-Users] ERROR:usrloc:shm_str_dup: no shared memory
>>> left
>>>
>>> Hi Josip,
>>>
>>> have you went through this: http://www.opensips.org/Resources/DocsTsMem
>>>
>>> First is to see if it a simple memory exhaustion or a mem leak.
>>>
>>> Regards,
>>> Bogdan
>>>
>>> Josip Djuricic wrote:
>>>   
>>>     
>>>       
>>>> Hi,
>>>>
>>>> I'm experiencing strange things with opensips (trunk). I'm testing it 
>>>> with sipp to see how it's reacting to 100 000 user registrations.
>>>>
>>>> For auth I'm using auth_aaa module with radius support, and mysql for 
>>>> db_persistency.
>>>>
>>>> So what I have noticed so far is:
>>>>
>>>> If I test at rates of 40 registration per second with 100 000 unique 
>>>> users (looping 100000 registrations over and over), and expiry time of 
>>>> 3600secs, everything works fine, because there is no expired and 
>>>> opensips don't have to delete anything from db and memory. Memory is 
>>>> constant according to ps, free and top
>>>>
>>>> But if I use 20min registration expire time, after some time(740841 
>>>> registration request sent) I get:
>>>>
>>>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6303]: 
>>>> ERROR:usrloc:shm_str_dup: no shared memory left
>>>>
>>>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6303]: 
>>>> ERROR:usrloc:new_ucontact: no more shm memory
>>>>
>>>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6303]: 
>>>> ERROR:usrloc:mem_insert_ucontact: failed to create new contact
>>>>
>>>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6303]: 
>>>> ERROR:usrloc:insert_ucontact: failed to insert contact
>>>>
>>>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6303]: 
>>>> ERROR:registrar:insert_contacts: failed to insert contact
>>>>
>>>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6300]: 
>>>> ERROR:usrloc:new_urecord: no more share memory
>>>>
>>>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6300]: 
>>>> ERROR:usrloc:mem_insert_urecord: creating urecord failed
>>>>
>>>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6300]: 
>>>> ERROR:usrloc:insert_urecord: inserting record failed
>>>>
>>>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6300]: 
>>>> ERROR:registrar:insert_contacts: failed to insert new record structure
>>>>
>>>> Dec 17 01:24:17 test03 kernel: [135241.226248] opensips[6302]: 
>>>> segfault at 0 ip 7fc0c897efb1 sp 7fffb9a41fe0 error 6 in 
>>>> usrloc.so[7fc0c8977000+1b000]
>>>>
>>>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6301]: 
>>>> ERROR:usrloc:new_ucontact: no more shm memory
>>>>
>>>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6301]: 
>>>> ERROR:usrloc:mem_insert_ucontact: failed to create new contact
>>>>
>>>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6301]: 
>>>> ERROR:usrloc:insert_ucontact: failed to insert contact
>>>>
>>>> Dec 17 01:24:17 test03 /usr/local/sbin/opensips[6301]: 
>>>> ERROR:registrar:insert_contacts: failed to insert contact
>>>>
>>>> Dec 17 01:24:17 test03 kernel: [135241.381974] opensips[6300]: 
>>>> segfault at 0 ip 7fc0c897efb1 sp 7fffb9a41fe0 error 6 in 
>>>> usrloc.so[7fc0c8977000+1b000]
>>>>
>>>> Since I am just registering same contacts like before I wonder why 
>>>> this happen?
>>>>
>>>> It seams to me that expired contacts doesn't get deleted from memory? 
>>>> So SHM is constantly rising? Is there anyway to check if this is the
>>>>       
>>>>         
>> case?
>>   
>>     
>>>> Also I'm starting opensips with -m 128 and I've changed private memory 
>>>> to 16*1024*1024 so that it can read 100000 contacts from db when
>>>>       
>>>>         
>> starting.
>>   
>>     
>>>> I'm using default configuration for test, just added db and radius 
>>>> support.
>>>>
>>>> Any ideas?
>>>>
>>>> Perhaps I should move to stable v1.6?
>>>>
>>>> Thanks,
>>>>
>>>> Josip
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.opensips.org
>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>   
>>>>     
>>>>       
>>>>         
>>>   
>>>     
>>>       
>>   
>>     
>
>
>   


-- 
Bogdan-Andrei Iancu
www.voice-system.ro




More information about the Users mailing list