# audio/audacity hanging not starting



## YuryG (Jun 18, 2020)

Since some last upgrade (I use ports and source building) audio/audacity do not start anymore. Well, it shows a start banner, but then it disappears and the application hangs forever. Under `gdb` it writes this:

```
Reading symbols from /usr/local/bin/audacity...
(No debugging symbols found in /usr/local/bin/audacity)
(gdb) r
Starting program: /usr/local/bin/audacity
[New LWP 101309 of process 11480]
[New LWP 101344 of process 11480]
Attempting to connect to Audacity failed...retrying
[New LWP 101514 of process 11480]
[New LWP 101520 of process 11480]
Unhandled unknown exception; terminating the application.
18:13:56: Debug: 1 threads were not terminated by the application.
[LWP 101520 of process 11480 exited]
[LWP 101514 of process 11480 exited]
^C
Thread 1 received signal SIGINT, Interrupt.
0x0000000801b92cdc in _umtx_op_err () from /lib/libthr.so.3
(gdb) where
#0  0x0000000801b92cdc in _umtx_op_err () at /lib/libthr.so.3
#1  0x0000000801b86bd5 in __thr_umutex_lock (mtx=0x81443d980, id=100587)
    at /usr/src/lib/libthr/thread/thr_umtx.c:80
#2  0x0000000801b8cb80 in mutex_lock_sleep
    (curthread=0x813816000, m=0x81443d980, abstime=0x0)
    at /usr/src/lib/libthr/thread/thr_mutex.c:695
#3  mutex_lock_common
    (m=0x81443d980, abstime=<optimized out>, cvattach=false, rb_onlist=<optimized out>) at /usr/src/lib/libthr/thread/thr_mutex.c:729
#4  0x0000000801b8b969 in __pthread_mutex_lock (mutex=0x814432d40)
    at /usr/src/lib/libthr/thread/thr_mutex.c:748
#5  0x0000000805dc71ea in  () at /usr/local/lib/libwx_baseu-3.1.so.3
#6  0x0000000805dc6d8e in wxThread::~wxThread() ()
    at /usr/local/lib/libwx_baseu-3.1.so.3
#7  0x00000000006eaebe in AudioThread::~AudioThread() ()
#8  0x00000000006de64c in AudioIO::~AudioIO() ()
#9  0x00000000006de67e in AudioIO::~AudioIO() ()
#10 0x00000008096ab0c1 in __cxa_finalize (dso=0x0)
    at /usr/src/lib/libc/stdlib/atexit.c:236
#11 0x00000008096406d1 in exit (status=-1)
    at /usr/src/lib/libc/stdlib/exit.c:72
#12 0x00000000006aba61 in  ()
(gdb) q
A debugging session is active.

    Inferior 1 [process 11480] will be killed.

Quit anyway? (y or n) y
```
May be some leftovers (like false .pids) from previous unclean endings? Or where it can be wrong for me to search? I'm on FreeBSD 11.4-STABLE #5 r361083 amd64.


----------



## ehanneken (Jun 18, 2020)

Taking a brief glance at the source code, it looks like when Audacity starts it attempts to bind to a socket as a server. If that fails it assumes some other Audacity instance has already done so, and attempts to connect to that socket as a client. In your case, it looks like Audacity can neither bind to the socket, nor connect to it. I suspect the exception was thrown as the process was shutting down.

Try looking for a file named /tmp/.audacity.sock, and if it's there delete it. That seems to be where Audacity is storing and looking for the port number. If it exists, Audacity assumes another instance is running.

EDIT: On my 12.1 machine, the path is /var/tmp/audacity-_<username>_/.audacity.sock, and it's actually socket-typed:
`# ls -l
total 1
srwx------  1 eric  wheel  0 Jun 18 10:19 .audacity.sock
-rw-------  1 eric  wheel  5 Jun 18 10:19 audacity-lock-eric
# file .audacity.sock
.audacity.sock: socket`


----------



## YuryG (Jun 18, 2020)

ehanneken said:


> Taking a brief glance at the source code, it looks like when Audacity starts it attempts to bind to a socket as a server. If that fails it assumes some other Audacity instance has already done so, and attempts to connect to that socket as a client. In your case, it looks like Audacity can neither bind to the socket, nor connect to it. I suspect the exception was thrown as the process was shutting down.
> 
> Try looking for a file named /tmp/.audacity.sock, and if it's there delete it. That seems to be where Audacity is storing and looking for the port number. If it exists, Audacity assumes another instance is running. (EDIT: It might be in a directory under /tmp. The location Audacity chooses ultimately depends on settings.)


Thank you sincerely for your suggestion, but even after cleaning all /tmp (there was no .sock files, though), the situation is the same…
(And by the way, why it hangs saying nothing and why I do not have debug info in `gdb` even when compiled audacity with DEBUG=ON option?)


----------



## ehanneken (Jun 18, 2020)

YuryG said:


> Thank you sincerely for your suggestion, but even after cleaning all /tmp (there was no .sock files, though), the situation is the same…



Sorry, I edited my post too late. I installed Audacity myself and found the file under /var/tmp/audacity-_<username>._


----------



## YuryG (Jun 18, 2020)

And /var/tmp/audacity-yury/ is empty also.


----------



## ehanneken (Jun 18, 2020)

My diagnosis may be wrong. I assumed from the code that Audacity was creating a network socket, but it looks like it's creating a named socket instead.


----------



## ehanneken (Jun 18, 2020)

If I make /var/tmp/audacity-eric non-writable for my user, Audacity presents me with this when it starts:






But you didn't see that, correct?


----------



## YuryG (Jun 19, 2020)

Nothing but just disappearing banner "Audacity".


----------



## YuryG (Jun 19, 2020)

May be somehow it is wx-related? Although, I did recompiled it a couple of times already…
And how to dig into the problem deeper?
My Audacity options:

```
DEBUG=off: Build with debugging support
     DOCS=off: Build and/or install documentation
     FFMPEG=on: FFmpeg support (WMA, AIFF, AC3, APE...)
     FLAC=on: FLAC lossless audio codec support
     ID3TAG=on: ID3 v1/v2 tags support
     LADSPA=on: LADSPA audio plugins support
     LAME=on: Use lame for import and export support
     LV2=off: Add LV2 plug-in support
     MAD=on: Use libmad for mp2/3 decoding support
     MIDI=off: MIDI support
     NYQUIST=on: Nyquist synthesis and composition support
     OGG=on: Ogg media format support
     SBSMS=on: Use libsbsms for pitch and tempo changing
     SOUNDTOUCH=on: Use libSoundTouch for pitch and tempo changing
     TWOLAME=on: Use libtwolame for MP2 export support
     VAMP=on: Vamp plug-in support
     VORBIS=on: Ogg Vorbis audio codec support
     VST=on: VST plug-in support
```


----------

