Audacity would silently exit each time after running

Help for Audacity on GNU/Linux.
Forum rules
ImageThis forum is for Audacity on GNU/Linux.
Please state:
  • which version of Linux you are using,
  • the exact three-section version number of Audacity from Help menu > About Audacity,
  • whether you installed your distribution's release, PPA version, or compiled Audacity from source code.

Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade (see https://www.audacityteam.org/download/).
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Post Reply
unfa
Posts: 34
Joined: Sat Mar 29, 2014 10:33 pm
Operating System: Linux *buntu

Audacity would silently exit each time after running

Post by unfa » Thu Apr 26, 2018 7:20 pm

I'm using Linux for music production for many years, and I consider myself very experienced with Linux in general at this point.
Nevertheless for the past few days I've been unable to run Audacity at all.

I didn't know what is wrong, because running it in the terminal didn't show anything useful:

Code: Select all

$ audacity 

(Audacity:5274): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()                                                                                                                                                    
                                                                                                                                                                                                                                             
(Audacity:5274): Gtk-WARNING **: Unable to locate theme engine in module_path: "adwaita",                                                                                                                                                    
                                                                                                                                                                                                                                             
(Audacity:5274): Gtk-WARNING **: Unable to locate theme engine in module_path: "adwaita", 
Today I've run it with gdb to finally find out.

Code: Select all

(gdb) run
Starting program: /usr/bin/audacity 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

(Audacity:12711): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()

(Audacity:12711): Gtk-WARNING **: Unable to locate theme engine in module_path: "adwaita",

(Audacity:12711): Gtk-WARNING **: Unable to locate theme engine in module_path: "adwaita",
[Inferior 1 (process 12711) exited with code 0377]
This was surprisingly mysterious. Exit code 0377? This got me thinking...

It turned out it was painfully simple. Audacity exited because there was another instance already running on my system. How didn't I know this?
I routinely suspend my system to RAM and resume it each day. I also use 6 virtual desktops for different activities and I had Audacity open on one of them, that I forgot about.

When I realized the source of the issue at first I thought that I shouldn't not report this as a problem, as it was caused by my own stupidity - however I think there is a problem that should be addressed.
Audacity didn't tell me this. Nothing would hint me that this is the reason why it doesn't run. It was a pure incident that I have finally found out.

I would expect Audacity to at least spew something in the terminal like "Audacity is already running with PID XXXX. Exiting."
That would have saved me quite some confusion.

A better solution would be for me to have Audacity quietly open a new project. This is what I wanted to do after all.

What do you think?

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Audacity would silently exit each time after running

Post by steve » Sun Apr 29, 2018 6:10 pm

This is interesting - I've looked at the code, and it appears that Audacity "should" give an error message, but doesn't. This was a surprise to me because I don't recall that ever working (though I don't generally try starting Audacity when it is already running).

I may have more information later...
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Audacity would silently exit each time after running

Post by steve » Sun Apr 29, 2018 6:23 pm

Definitely a bug here. Not sure at the moment if only on Linux (the code forks with different behaviour for Windows), but definitely a bug on Linux.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Audacity would silently exit each time after running

Post by steve » Sun Apr 29, 2018 8:06 pm

I've found the problem. Doesn't happen on Windows, but could account for why we have been seeing a number of Mac users unable to launch Audacity (because it's already running).

Audacity "should" handle this in rather a clever way. What should happen, (if not for the bug), is that if Audacity is already running, then the start-up command is piped through to the running instance before stepping backwards through the start-up sequence to cleanly exit the new evocation. If the new instance is unable to connect to the already running instance, then an error message is thrown.

The bug is, that if the Audacity command is given with no additional arguments, Audacity simply exits without attempting to call the running instance of Audacity, and because it has not attempted to call the running instance, the call does not fail, so no error message is produced and the new instance simply exits silently (with a non-zero return).

I've now made a fix, so this should be OK in the next release, provided that it does not cause problems on Mac (which I've not yet tested).
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply