GNOME Bugzilla – Bug 778653
ephy_downloads_manager_acquire_session_inhibitor: assertion failed: (manager->inhibitor_cookie == 0)
Last modified: 2017-07-02 17:09:05 UTC
Created attachment 345788 [details] BT from gdb for epiphany Epiphany 3.22.5 and WebKit 2.15.4 And the env variable: "export G_DEBUG=fatal-criticals" The compilation was done with CMake args: '-DPORT=GTK -DCMAKE_BUILD_TYPE=Release -DENABLE_MINIBROWSER=ON -DCMAKE_C_FLAGS_RELEASE="-O0 -g -DNDEBUG -DG_DISABLE_CAST_CHECKS" -DCMAKE_CXX_FLAGS_RELEASE="-O0 -g -DNDEBUG -DG_DISABLE_CAST_CHECKS"' After visiting several pages, eventually, I try to download a PDF from a link and epiphany hits a SIGSEV.
Are you able to get a backtrace with debug symbols for this one? It should be impossible to hit this case; I don't see how it could possibly ever happen. The functions are simple: static void ephy_downloads_manager_acquire_session_inhibitor (EphyDownloadsManager *manager) { if (++manager->inhibitors > 1) return; g_assert (manager->inhibitor_cookie == 0); manager->inhibitor_cookie = gtk_application_inhibit (GTK_APPLICATION (ephy_embed_shell_get_default ()), NULL, GTK_APPLICATION_INHIBIT_LOGOUT | GTK_APPLICATION_INHIBIT_SUSPEND, "Downloading"); if (manager->inhibitor_cookie == 0) g_warning ("Failed to acquire session inhibitor for active download. Is gnome-session running?"); } static void ephy_downloads_manager_release_session_inhibitor (EphyDownloadsManager *manager) { if (--manager->inhibitors > 0) return; if (manager->inhibitor_cookie > 0) { gtk_application_uninhibit (GTK_APPLICATION (ephy_embed_shell_get_default ()), manager->inhibitor_cookie); manager->inhibitor_cookie = 0; } } The variables are not modified from any other functions. Am I missing a simple logic mistake there? I'm also very confused why you have no debug symbols for Epiphany when you compiled with -O0 -g.
Ah wait, inhibitors is a guint and can underflow if _release_session_inhibitor() is called before _acquire_session_inhibitor(). I guess something funky could cause that.
The following fix has been pushed: 7221b57 downloads-manager: Add another assert
Created attachment 345857 [details] [review] downloads-manager: Add another assert Something is wrong here. This assert will help catch it.
So I added a new assert. Now it will crash sooner next time this bug occurs. Please apply the patch and post another backtrace when it happens again!
(In reply to Michael Catanzaro from comment #1) > I'm also very confused why you have no debug symbols for Epiphany when you > compiled with -O0 -g. Sorry, copy & paste. It is indeed not that clear. Those are the compilation flags for WebKit, not epiphany. Epiphany was not built with debug symbols.
(In reply to Michael Catanzaro from comment #5) > So I added a new assert. Now it will crash sooner next time this bug occurs. > Please apply the patch and post another backtrace when it happens again! I'll apply and build with debug symbols. In any case, this is not that easy to reproduce so, let's see if I can ...
Created attachment 353806 [details] Another BT from gdb for epiphany Epiphany 3.24.1 and WebKit 2.17.3
The inhibitor is acquired on created-destination, so in case of failure or cancellation, if it happened before the destination is created, the release is unbalanced.
*** Bug 783455 has been marked as a duplicate of this bug. ***
The following fix has been pushed: b7e269f downloads-manager: Fix crash when download fails
Created attachment 354800 [details] [review] downloads-manager: Fix crash when download fails It's wrong to acquire the session inhibitor when destination is created, because the download could fail before that point, causing the inhibitotr to be released before it has been acquired and triggering our assertions to ensure this does not happen. Instead, acquire the inhibitor immediately when creating the download.