SoundScapeRenderer / ssr

Main source code repository for the SoundScape Renderer
http://spatialaudio.net/ssr/
GNU General Public License v3.0
132 stars 52 forks source link

SoundScape crashes when not running from gdb #3

Open hcw70 opened 11 years ago

hcw70 commented 11 years ago

Hi. While trying 0.4.0pre4 i ran into following:

/usr/local/Soundscape/bin/ssr-binaural  ~/Musik/FreeMusicArchive.org/Frame_-_02_-_Eyes_Like_A_Wolf.wav 
***********************************************************************
* Message from libecasoundc:
* 
* 'ECASOUND' environment variable not set. Using the default value 
* value 'ECASOUND=ecasound'.
***********************************************************************

       ___     
      /  ___   
  ___/  /  ___ 
    ___/  /    SoundScape Renderer (SSR)
         /     

 Copyright (c) 2012      Institut für Nachrichtentechnik, Universität Rostock
 Copyright (c) 2006-2012 Quality & Usability Lab
                         Deutsche Telekom Laboratories, TU Berlin

 Website: http://SoundScapeRenderer.github.com/
 Contact: ssr@spatialaudio.net

 This program comes with ABSOLUTELY NO WARRANTY; this is free software,
 and you are welcome to redistribute it under certain conditions;
 for details, see the enclosed file COPYING.

Warning: Trying to open specified file as audio file. (controller.h:1050)
Warning: Creating spontaneous scene from the audio file "/home/hcw/Musik/FreeMusicArchive.org/Frame_-_02_-_Eyes_Like_A_Wolf.wav". (controller.h:1084)
Adding source 1 to source map!
Creating point source at x = -1.25 mtrs, y = 2.16506 mtrs.
Adding source 2 to source map!
Creating point source at x = 1.25 mtrs, y = 2.16506 mtrs.
Starting IP Server with port 4711
Opening serial port for Polhemus Fastrak ...
Trying to open port /dev/ttyUSB0 ... failure!
Trying to open port /dev/ttyUSB1 ... failure!
Trying to open port /dev/ttyS0 ... success!
Error: Could not get serial port attributes! Error # -1 (trackerpolhemus.cpp:153)
Warning: Cannot find tracker. Make sure that you have the appropriate access rights to read from the port. I continue without tracker. (controller.h:1257)
Warning: Renderer is already processing. (controller.h:1331)
Floating control panel is used, scene menu will not be shown.
JackPosixSemaphore::TimedWait err = Unterbrechung während des Betriebssystemaufrufs
Cannot read socket fd = 8 err = Unterbrechung während des Betriebssystemaufrufs
CheckRes error
JackSocketClientChannel read fail
terminate called after throwing an instance of 'apf::JackClient::jack_error'
  what():  JackClient: JACK shutdown! Reason: JACK server has been closed
Abgebrochen (Speicherabzug geschrieben)

However, when i ran it using gdb it works:

gdb /usr/local/Soundscape/bin/ssr-binaural
GNU gdb (GDB) 7.5-ubuntu
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/local/Soundscape-0.4pre/bin/ssr-binaural...done.
(gdb) set args ~/Musik/FreeMusicArchive.org/Frame_-_02_-_Eyes_Like_A_Wolf.wav 
(gdb) r
Starting program: /usr/local/Soundscape-0.4pre/bin/ssr-binaural ~/Musik/FreeMusicArchive.org/Frame_-_02_-_Eyes_Like_A_Wolf.wav 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

***********************************************************************
* Message from libecasoundc:
* 
* 'ECASOUND' environment variable not set. Using the default value 
* value 'ECASOUND=ecasound'.
***********************************************************************

[New Thread 0x7ffff7f6f700 (LWP 29001)]
[New Thread 0x7ffff7eee700 (LWP 29002)]
       ___     
      /  ___   
  ___/  /  ___ 
    ___/  /    SoundScape Renderer (SSR)
         /     

 Copyright (c) 2012      Institut für Nachrichtentechnik, Universität Rostock
 Copyright (c) 2006-2012 Quality & Usability Lab
                         Deutsche Telekom Laboratories, TU Berlin

 Website: http://SoundScapeRenderer.github.com/
 Contact: ssr@spatialaudio.net

 This program comes with ABSOLUTELY NO WARRANTY; this is free software,
 and you are welcome to redistribute it under certain conditions;
 for details, see the enclosed file COPYING.

Warning: Trying to open specified file as audio file. (controller.h:1050)
Warning: Creating spontaneous scene from the audio file "/home/hcw/Musik/FreeMusicArchive.org/Frame_-_02_-_Eyes_Like_A_Wolf.wav". (controller.h:1084)
Adding source 1 to source map!
Creating point source at x = -1.25 mtrs, y = 2.16506 mtrs.
Adding source 2 to source map!
Creating point source at x = 1.25 mtrs, y = 2.16506 mtrs.
Starting IP Server with port 4711
[New Thread 0x7fffed9d8700 (LWP 29014)]
[New Thread 0x7fffed1d7700 (LWP 29015)]
Opening serial port for Polhemus Fastrak ...
Trying to open port /dev/ttyUSB0 ... failure!
Trying to open port /dev/ttyUSB1 ... failure!
Trying to open port /dev/ttyS0 ... success!
Error: Could not get serial port attributes! Error # -1 (trackerpolhemus.cpp:153)
Warning: Cannot find tracker. Make sure that you have the appropriate access rights to read from the port. I continue without tracker. (controller.h:1257)
[New Thread 0x7fffec9d6700 (LWP 29016)]
Warning: Renderer is already processing. (controller.h:1331)
[New Thread 0x7fffcf5b5700 (LWP 29018)]
[New Thread 0x7fffcedb4700 (LWP 29019)]
Floating control panel is used, scene menu will not be shown.
[Thread 0x7fffcf5b5700 (LWP 29018) exited]
[Thread 0x7fffec9d6700 (LWP 29016) exited]
[Thread 0x7fffed1d7700 (LWP 29015) exited]
Deletion of unsubscribed Subscriber requested
Connection destroyed
[Thread 0x7fffed9d8700 (LWP 29014) exited]
[Thread 0x7ffff7eee700 (LWP 29002) exited]
[Thread 0x7ffff7f6f700 (LWP 29001) exited]
[Thread 0x7fffcedb4700 (LWP 29019) exited]
[Inferior 1 (process 28988) exited normally]
(gdb) 

Kind regards

Hauke

mgeier commented 11 years ago

I cannot directly reproduce the error, but similar errors happen to me from time to time.

Just to be sure, did you check that no instances of jackd or ecasound are running anymore? Sometimes this helps:

killall -9 ecasound
killall -9 jackd

I have no clue why it should work in gdb and not outside of it ... strange ...

Do other JACK applications run smoothly?

hcw70 commented 11 years ago

I have running it with jackd and see the crash every time (if running without gdb). No ecasound is running. Of course i first start jack then SoundScape (with 2-4 live jack inputs).

This looks to me like a race condition regarding threading since in GDB startup / thread creation time is much longer.

My other jack stuff runs quite well.

mgeier commented 11 years ago

Hmmm ... a race condition would be quite bad, because I don't know where to start looking ... especially as I'm not able to reproduce the error ...

Any suggestions?

hcw70 commented 11 years ago

@mgeier Maybe some infos regarding the machine: Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz with 8 virtual cores (4 real ones with hypertreading i thing) Running on Ubuntu 12.10 64-bit with low latency kernel.

Maybe you should check the messages: JackPosixSemaphore::TimedWait err = Unterbrechung während des Betriebssystemaufrufs Cannot read socket fd = 8 err = Unterbrechung während des Betriebssystemaufrufs CheckRes error JackSocketClientChannel read fail

since they dont appear when running under gdb. "Interruption while os call = Unterbrechung während des Betriebssystemaufrufs" typically occur if an os call is interrupted by an os signal (kill / term et al). Normally they should be restarted. See http://infohost.nmt.edu/~eweiss/222_book/222_book/0201433079/ch10lev1sec5.html for infos on this.

mgeier commented 11 years ago

I have neither knowledge nor experience regarding these kinds of issues ... so I'm kinda stuck!

It still could have something to do with ecasound, because when the SSR is playing a sound file, it starts an instance of ecasound for that. Could you please try to run the SSR with the scene data/scenes/live_input.asd to see if the error still happens?

hcw70 commented 11 years ago

In fact i use live_input.asd and get the crash.

Maybe you could set up this repo and fill with the version, so it will be easier for others (and me) to look at.

mgeier commented 11 years ago

I will put up the repository here on github soon (in the next few weeks/months), but before that I have to move around some stuff and clean up before starting a new repository (the old one is a mess).

In the meantime I'll try to regularly upload "preview" versions there: http://spatialaudio.net/ssr/download/ (I uploaded "pre5" yesterday).

Regarding your problem, you should try to compile and run the examples from this repo: https://github.com/AudioProcessingFramework/apf The relevant files are examples/jack_*. These examples use the same JACK-client code and the same multi-threading stuff as the SSR.

If you experience the same problems there, the error might be easier to track down.

mgeier commented 11 years ago

I could finally reproduce the problem with a laptop of mine.

Sadly, I still have no idea how to solve this but at least I know more exactly where the error happens. It's related to the Qt-GUI, so if compiled without it (./configure --disable-gui) the SSR runs fine. The actual crash happens when the ssr::QGUI-object is constructed (see src/gui/qgui.cpp).

Maybe upgrading Qt helps?

Here, the error happens with Qt version 4.8.2.

hcw70 commented 11 years ago

Hmm. Had a look at the source. Maybe this is because you use boost::threads in conjunction with Qt which has its own threading environment. How do you sync the gui with the threads?

mgeier commented 11 years ago

Hmm. Had a look at the source. Maybe this is because you use boost::threads in conjunction with Qt which has its own threading environment.

The boost::threads are only used in the network interface. If you compile with ./configure --disable-ip-interface no Boost library will be used at all. You don't even have to have Boost installed. I tried it on my laptop and it still crashes, even with disabled IP interface.

How do you sync the gui with the threads?

It uses an admittedly quite clumsy publish/subscribe mechanism (see e.g. src/publisher.h) which I would like to replace anyway in the future. But I still don't know how that crashes JACK. In the end, the commands are passed to the JACK-thread with a lock-free ringbuffer (in apf/apf/lockfreefifo.h). This may well have bugs in it, but the error may also be at a completely different place ...

hcw70 commented 11 years ago

Hmm. If you use QT anyway, i would recommend looking at the QT Signals/Slots for publish/subscriber. They have nice OS abstractions (QThread, QFile) and oo patterns for multithreaded apps (QFuture)

mgeier commented 11 years ago

Thanks for the hint, but we're using Qt only for the GUI and we will probably make a completely new GUI (probably without Qt) sometime in the future. The rest of the code is Qt-free, i.e. if you don't have Qt, you can still compile the SSR without GUI (./configure --disable-gui). I don't really like Qt for its corporate background and for it not being standard C++.

mgeier commented 10 years ago

On my Laptop with Qt 4.8.5 it is working again (where is wasn't working with Qt 4.8.2). Can you please check if it also works on your system?

BTW, I recently uploaded a new 'preview' version (see http://spatialaudio.net/ssr/download/) and I pushed the repository to Github.

mgeier commented 10 years ago

I'm closing this due to lack of response. I hope it works with newer versions of Qt!

orbisvicis commented 9 years ago

Broken with qt 4.8.6 on ubuntu (utopic). libqtcore4 4:4.8.6+git49-gbc62005+dfsg-1ubuntu1 soundscaperenderer 0.4.1~dfsg-2

mgeier commented 9 years ago

I'm reopening this, but I still have no clue what's causing the crash.

mgeier commented 4 years ago

Does anybody still experience this problem?