Jack crash in jack_port_unregister

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Jack crash in jack_port_unregister

"Jørn V. Christensen"
Hi

I wrote to this list one time before but got no reply. I have been able
to get some more info, hope it helps...

I am writing a program that uses JACK, which works fine most of the
time. Sometimes, though, it crashes for me. Usually it crashes in the
function jack_port_unregister. I got a backtrace from gdb:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1231111248 (LWP 12299)]
0xb7ef2285 in jack_port_by_id () from /usr/lib/libjack-0.80.0.so.0
(gdb) bt
#0  0xb7ef2285 in jack_port_by_id () from /usr/lib/libjack-0.80.0.so.0
#1  0xb7eef122 in jack_client_handle_port_connection () from
/usr/lib/libjack-0.80.0.so.0
#2  0xb7ef06b8 in jack_stop_freewheel () from /usr/lib/libjack-0.80.0.so.0
#3  0xb76c2ca3 in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#4  0xb7578f5a in clone () from /lib/tls/i686/cmov/libc.so.6

I know the backtrace does not mention the jack_port_unregister function
- but I am certain that it happens when I call jack_port_unregister. (I
have printed debug info to stderr, just before and just after call to
this function!)

I used valgrind on my program, and got some useful info:

When I unregister a port, I get the message:

 unreg jack buf...  TTtrigger:sp_just_frosthobo_joe[1]_0 ==13773==
 ==13773== Thread 3:
 ==13773== Syscall param write(buf) points to uninitialised byte(s)
 ==13773==    at 0x1C15FA3B: write (in /usr/lib/debug/libpthread-0.10.so)
 ==13773==    by 0x1B91BF23: jack_client_deliver_request (in
/usr/lib/libjack-0.80.0.so.0.0.23)
 ==13773==    by 0x1B91EF70: jack_port_unregister (in
/usr/lib/libjack-0.80.0.so.0.0.23)
 ==13773==    by 0x80631DD: unregisterJackBuffers (jackctrl.c:561)
 ==13773==    by 0x8062D8E: disk_read (jackctrl.c:415)
 ==13773==    by 0x1C159E50: pthread_start_thread (manager.c:309)
 ==13773==    by 0x1C367929: clone (clone.S:102)
 ==13773==  Address 0x523FF888 is on thread 3's stack
 . TTtrigger:sp_just_frosthobo_joe[1]_1 . done

Note that the first and last line is debug info I print to stderr. Note
also, that this err message is only reported once - but I guess it's a
feature in valgrind not to report the same lines of code again and again.

This error is non fatal (and I'm not sure its yours err, since it's
actually issued in libpthread) but I list it for completenes. When my
program crashes while unregistering a port, I get the following from
valgrind:

 unreg jack buf...  TTtrigger:sp_just_frostbring_the_money_home[0]_0
==13774==
 ==13774== Thread 4:
 ==13774== Invalid read of size 4
 ==13774==    at 0x1B91F282: jack_port_by_id (in
/usr/lib/libjack-0.80.0.so.0.0.23)
 ==13774==    by 0x1B91C121: jack_client_handle_port_connection (in
/usr/lib/libjack-0.80.0.so.0.0.23)
 ==13774==    by 0x1B91D6B7: (within /usr/lib/libjack-0.80.0.so.0.0.23)
 ==13774==    by 0x1C159E50: pthread_start_thread (manager.c:309)
 ==13774==    by 0x1C367929: clone (clone.S:102)
 ==13774==  Address 0x1CAA6AEC is 12 bytes inside a block of size 52 free'd
 ==13774==    at 0x1B904B04: free (vg_replace_malloc.c:152)
 ==13774==    by 0x80631FF: unregisterJackBuffers (jackctrl.c:563)
 ==13774==    by 0x8062D59: disk_read (jackctrl.c:409)
 ==13774==    by 0x1C159E50: pthread_start_thread (manager.c:309)
 ==13774==    by 0x1C367929: clone (clone.S:102)
 . TTtrigger:sp_just_frostbring_the_money_home[0]_1 . done

Actually - it does not crash, but would have if it was not run from
inside of valgrind. Again the first and last message is debug info.

When I remove an entry (a sound file playing), I do the following:
 1. obtain a lock, so that the callback process will wait
 2. remove the entry from list of entrys that need to be processed.
 3. unregisters the entrys port with jack_port_unregister.
 4. release the lock
 5. free's ringbuffers.

Is this the right way to do this? Or am I doing things correct? And if
so, is this an issue with Jack?

By the way - I use Jack v. 0.99.0 (from debian).

Hope to hear from you :)

Best regards
Jørn Christensen



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel