Hi,

I'm developing an irssi script that uses the following modules:

POSIX
Fcntl
Digest::MD5
DBI
DBD::Pg
Carp

On /quit (when I used my script once) irssi dumps core by segfault. 
Here's a backtrace:

(gdb) bt
#0  0x2846948c in ?? ()
#1  0x80fdb25 in S_call_body ()
#2  0x80fd91a in Perl_call_sv ()
#3  0x81481d9 in Perl_sv_clear ()
#4  0x814879d in Perl_sv_free ()
#5  0x8142768 in do_clean_objs ()
#6  0x81426dd in S_visit ()
#7  0x81427fe in Perl_sv_clean_objs ()
#8  0x80fb55b in perl_destruct ()
#9  0x80f3a92 in perl_scripts_deinit () at perl-core.c:166
#10 0x80f49ed in perl_core_deinit () at perl-core.c:467
#11 0x807f3c9 in textui_deinit () at irssi.c:213
#12 0x807f7a6 in main (argc=1, argv=0xbfbff6b4) at irssi.c:375
#13 0x8069077 in _start ()

I played a bit with the code and it seems to me that 
perl_scripts_deinit(void) contains the problem. 

I don't understand what the following code should provide what 
perl_destruct() not already does for us:

/* Unload all perl libraries loaded with dynaloader */
perl_eval_pv("foreach my $lib (@DynaLoader::dl_modules) { if ($lib =~ 
/^Irssi\\b/) { $lib .= '::deinit();'; eval $lib; } }", TRUE);

perl_eval_pv("eval { foreach my $lib (@DynaLoader::dl_librefs) { 
DynaLoader::dl_unload_file($lib); } }", TRUE);

Clearly I should clean up modules loaded dynamically by DynaLoader 
(first Irssi, then the rest) but won't perl_destruct() do that
automatically for us? If I comment out the second perl_eval_pv line,
irssi stops segfaulting on /quit.

The DynaLoader documentation doesn't mention any special cleanup magic 
that needs to be done (with a few exceptions).

I tried the above with perl 5.6.1 and "perl, v5.8.0 built for 
i386-freebsd". Irssi is configured with "CFLAGS=-g ./configure"

Please comment on that.

Marcus
-- 
.signature: No such file or directory
______________________________________________________________________________
Mit der Auslands-SMS von WEB.DE FreeMail erreichen Sie Ihre Freunde auf
der ganzen Welt - http://freemail.web.de/features/?mc=021171


Reply via email to