[sr-dev] segfault when mod_init fails

Andrei Pelinescu-Onciul andrei at iptel.org
Mon Jun 22 14:01:41 CEST 2009


On Jun 22, 2009 at 11:58, Juha Heinanen <jh at tutpro.com> wrote:
> while testing new lcr module, i saw also this kind of segfault:
> 
> Jun 22 11:39:49 localhost /usr/sbin/sip-router[17180]: ERROR: lcr [lcr_mod.c:525]: AVP defunct_gw_avp has not been defined
> Jun 22 11:39:49 localhost /usr/sbin/sip-router[17180]: ERROR: <core> [sr_module.c:873]: init_mod(): Error while initializing module lcr
> Jun 22 11:39:49 localhost kernel: [14513.650230] sip-router[17180]: segfault at 0 ip b7ab2a5f sp bfeb3470 error 4 in lcr.so[b7aad000+14000]
> 
> mod_init code leading to it is:
> 
> 	} else {
> 	    LM_ERR("AVP defunct_gw_avp has not been defined\n");
> 	    return -1;
> 	}
> 
> any idea why the segfault?

I don't think the segfault happens in mod_init(). mod_init has finsihed
running when the segfault happens (see the init_mod() error message
which is generated by the core _after_ mod_init has been run).
It might happen in mod_destroy() (which is called because sr is shutting
down). It might not expect some not fully init vars., because of an
incomplete mod_init run.

Try looking at the backtrace, it should point exactly where the segfault
was triggered.

Andrei



More information about the sr-dev mailing list