4

In Perl 5.16.0 sample C program is working but the existing multi-thread program is aborting in Perl_sv_upgrade. Multi-thread program works fine with Perl 5.8.8. The same code works on Linux and Solaris with Perl 5.16.0.

Comparing the sv argument value between Linux and Hp-PA shows the sv value is NULL in case of Hp-PA. Did anybody notice this problem before. Please let me know?

Linux stack trace after debugging and seeing the sv value:

Breakpoint 4, Perl_sv_upgrade (my_perl=0x14fe6400, sv=0x150317a8, new_type=SVt_PV)
    at sv.c:1140
1140    sv.c: No such file or directory.
(gdb) where
#0  Perl_sv_upgrade (my_perl=0x14fe6400, sv=0x150317a8, new_type=SVt_PV) at sv.c:1140

HP-PA stack trace after seeing the sv value while analyzing the abort in gdb:

Thread 3 (system thread 428417):

#3 signal handler called
#4 0xca9825c4 in Perl_sv_upgrade (my_perl=0x40236f10, sv=0x0, new_type=SVt_PV)
    at sv.c:1260
Palec
  • 12,743
  • 8
  • 69
  • 138
yogishaj
  • 705
  • 5
  • 17
  • 3
    Yes, passing NULL to `sv_upgrade` is bad. Don't do that. – ikegami Oct 04 '12 at 15:21
  • 1
    Using `gdb`'s `bt` might help find where the actual bug is. – ikegami Oct 04 '12 at 16:57
  • @mob - The code snippet posted by me in the link works but the code which i am using is confidential but similar to the one give in link. I'm suspecting some compiler options OR patches but not sure http://stackoverflow.com/questions/12403729/c-calling-perl-code-eval-sv-not-passing-arguments-to-script – yogishaj Oct 08 '12 at 10:10
  • @ikegami - I'm not passing NULL to sv_upgrade. The sample program posted by me in the link works but a similar code written in our project doesn't work on HPUX and AIX. http://stackoverflow.com/questions/12403729/c-calling-perl-code-eval-sv-not-passing-arguments-to-script – yogishaj Oct 08 '12 at 10:13
  • @mob - I'm new to Perl code and would need some time on finding the problem. If you know of any Perl developer groups who can help me, can you please suggest? – yogishaj Oct 08 '12 at 10:16
  • @ikegami - I'm new to Perl code and would need some time on finding the problem. If you know of any Perl developer groups who can help me, can you please suggest? – yogishaj Oct 08 '12 at 10:17
  • 3
    @yogishaj, well, something is. Again, using `gdb`'s `bt` might help find where the actual bug is. – ikegami Oct 08 '12 at 16:21
  • 2
    If we could see the full stack trace we might be able to get somewhere. sv_upgrade is definitely getting passed NULL as evidenced by the `sv=0x0` but without a full stack trace we cannot tell what. – Schwern Oct 21 '12 at 20:03
  • Have you compiled your XS module with -Wall and are you using the correct datatypes for everything? I recall seeing segfaults ( outside the XS module in question ) with a NULL-pointer argument on a legacy XS module that was using int instead of STRLEN. – Dre Feb 23 '13 at 18:08

0 Answers0