Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > perl hangs after receiving signal

Reply
Thread Tools

perl hangs after receiving signal

 
 
Jeremy Slade
Guest
Posts: n/a
 
      04-01-2005
I have a script running in perl 5.6.1 on a debian sarge system (kernel
2.6..

On occasion, the perl interpreter just hangs. I have been able to
attach to the process with gdb to get a stack trace, and unfortunately
it is not always the same. But there does seem to be some consistency.
The last frame of the stack is always pthread_setcanceltype() from
libc.so.6. Farther down the stack there is almost always
Perl_signalhandler. Here's an example stack trace:

#0 0x4014b7a1 in pthread_setcanceltype () from /lib/tls/libc.so.6
#1 0x4019a940 in __after_morecore_hook () from /lib/tls/libc.so.6
#2 0x40199fcc in ?? () from /lib/tls/libc.so.6
#3 0x00000011 in ?? ()
#4 0x400d9d53 in posix_memalign () from /lib/tls/libc.so.6
#5 0x40300010 in ?? ()
#6 0x40300490 in ?? ()
#7 0x0847f15c in ?? ()
#8 0x0847f15c in ?? ()
#9 0x0849fe00 in ?? ()
#10 0x080a4ac8 in Perl_sv_clear ()
#11 0x080a4f0b in Perl_sv_free ()
#12 0x080aef69 in Perl_pp_vec ()
#13 0x08098f98 in Perl_runops_standard ()
#14 0x0805cbca in perl_call_sv ()
#15 0x0805cb0a in perl_call_sv ()
#16 0x08095247 in Perl_sighandler ()
#17 <signal handler called>
#18 0x400d62a8 in free () from /lib/tls/libc.so.6
#19 0x4019a940 in __after_morecore_hook () from /lib/tls/libc.so.6
#20 0x084e39e8 in ?? ()
#21 0x0870fc10 in ?? ()
#22 0x0870fc10 in ?? ()
#23 0xbffffb70 in ?? ()
#24 0x08097b43 in Perl_av_undef ()
#25 0x080a4b0f in Perl_sv_clear ()
#26 0x080a4f0b in Perl_sv_free ()
#27 0x0807ff75 in Perl_cv_undef ()
#28 0x080a4b4c in Perl_sv_clear ()
#29 0x080a4f0b in Perl_sv_free ()
#30 0x080b680a in Perl_free_tmps ()
#31 0x080994b1 in Perl_pp_unstack ()
#32 0x08098f98 in Perl_runops_standard ()
#33 0x0805c2df in perl_run ()
#34 0x0805c15a in perl_run ()
#35 0x08059c3a in main ()


I have tried the same script on debian stable systems (same perl 5.6.1
binary, however), and it seems to work much better, I don't ever see
this problem.

Since this call to pthread_setcanceltype happens way down inside other
function calls, I suspect this is not at all a perl problem, but rather
a linux or libc problem. But I am hoping that someone can offer some
help in determining why this hangs and what I might be able to do about it.

Thanks,
Jeremy
 
Reply With Quote
 
 
 
 
Anno Siegel
Guest
Posts: n/a
 
      04-01-2005
Jeremy Slade <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> I have a script running in perl 5.6.1 on a debian sarge system (kernel

^^^^^
> 2.6..


Perl signal handling was unsafe before 5.8.0. In particular, if a program
was interrupted during a memory allocation, and the signal handler started
off another memory allocation (can easily happen in inconspicuous code),
that usually meant a segfault.

> On occasion, the perl interpreter just hangs. I have been able to


I don't know why it hangs, but when you re-enter non-re-entrant code
basically anything can happen.

> Perl_signalhandler. Here's an example stack trace:


[stack trace much shortened, missing parts indicated]

....
> #4 0x400d9d53 in posix_memalign () from /lib/tls/libc.so.6

....
> #16 0x08095247 in Perl_sighandler ()
> #17 <signal handler called>
> #18 0x400d62a8 in free () from /lib/tls/libc.so.6

....

The signal arrives during free(), a memory (de-)allocation. The memory
heap may be inconsistent. In the signal handler, something called
posix_memalign() is called. I don't know what it is, but it sounds much
like something that might be sensitive to an inconsistent heap. That
seems to match the theory pretty well.

Anno
 
Reply With Quote
 
 
 
 
Jeremy Slade
Guest
Posts: n/a
 
      04-01-2005
Ah, thanks for the info. Yet one more reason I need to move to 5.8.

Anno Siegel wrote:
> Jeremy Slade <(E-Mail Removed)> wrote in comp.lang.perl.misc:
>
>>I have a script running in perl 5.6.1 on a debian sarge system (kernel

>
> ^^^^^
>
>>2.6..

>
>
> Perl signal handling was unsafe before 5.8.0. In particular, if a program
> was interrupted during a memory allocation, and the signal handler started
> off another memory allocation (can easily happen in inconspicuous code),
> that usually meant a segfault.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
subprocess: reading from stdout hangs process termination, waitingfor ENTER keyboard signal giohappy Python 5 04-15-2009 10:24 AM
How to prevent child process from receiving INT signal? Collin Vandyck Ruby 1 09-12-2007 01:41 PM
The program is receiving SIGABRT signal. jammie_linux@yahoo.com C++ 2 11-04-2005 03:30 PM
Gem hangs => TCPSocket.write hangs Tim Shadel Ruby 1 07-24-2005 06:11 AM
Clear hangs up - & hangs up - & hangs up Sue Bilstein NZ Computing 26 03-07-2004 01:33 AM



Advertisments