debugging segfault in ALSA.so

  • Follow


Hi. Er... 

I've got this script which uses MIDI::ALSA, and installs a
signal-handler at the Perl-level,   $SIG{INT} = \&myhandler;
then creates an ALSA client and so on, then listens for
the next event with   snd_seq_event_input(seq_handle, &ev)  

When it receives an ALSA event it returns it just fine :-)

But whenever I send the process an INT signal, either from ^C at
the keyboard or from a different xterm, I get Segmentation fault
and my Perl signal handler doesn't get invoked :-( .

strace reveals nothing to me, it's just waiting to read
from some filehandle and then: Segmentation fault

In /var/log/messages I get a message every time saying:

segfault at 0 ip b74fba3b sp bfd52c80 error 4 in ALSA.so[b74f6000+9000]

So the INT signal causes ALSA.so to segfault.  If I don't install
my Perl signal-handler then the app Quits in an orderly manner,
though of course then it doesn't save my midi file before quitting.
But a fairly similar setup in  arecordmidi.c  works fine, with:
  signal(SIGINT, sighandler);
at the C-level.  There seems to be a conflict between
ALSA.so signal-handling and Perl signal-handling.

I'll ask comp.lang.perl.modules as well, in case it's a known
perl issue, but I thought I'd better ask here in case it's a
known ALSA.so issue.  Should  b74f6000+9000  tell me anything ?

Regards,  Peter

-- 
Peter Billam       www.pjb.com.au    www.pjb.com.au/comp/contact.html
0
Reply Peter 3/10/2011 5:53:41 AM

On 2011-03-10, Peter Billam <peter@www.pjb.com.au> wrote:
> Hi. Er... 
>
> I've got this script which uses MIDI::ALSA, and installs a
> signal-handler at the Perl-level,   $SIG{INT} = \&myhandler;
> then creates an ALSA client and so on, then listens for
> the next event with   snd_seq_event_input(seq_handle, &ev)  
> ...
> But whenever I send the process an INT signal, either from ^C at
> the keyboard or from a different xterm, I get Segmentation fault
> and my Perl signal handler doesn't get invoked :-( .

Apologies, apologies... ALSA.so is not part of ALSA (which is
libasound) it's part of my own MIDI::ALSA, and I was failing
to check that the return code of snd_seq_event_input() was not
negative.  Bug now fixed :-)

It's also a bug in the original alsaseq.py ...

Sorry to bother you,
Peter

-- 
Peter Billam       www.pjb.com.au    www.pjb.com.au/comp/contact.html
0
Reply Peter 3/10/2011 2:48:17 PM


1 Replies
268 Views

(page loaded in 0.042 seconds)

Similiar Articles:













7/22/2012 8:43:25 PM


Reply: