Bug 227047 - firefox always complains about unexpectedly closed session
Summary: firefox always complains about unexpectedly closed session
Status: RESOLVED FIXED
: 220249 (view as bug list)
Alias: None
Product: openSUSE 10.2
Classification: openSUSE
Component: Firefox (show other bugs)
Version: Final
Hardware: Other Other
: P5 - None : Critical (vote)
Target Milestone: ---
Assignee: Michael Wolf
QA Contact: E-mail List
URL:
Whiteboard: fixed_bs
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-08 09:22 UTC by Michal Svec
Modified: 2007-11-14 19:05 UTC (History)
4 users (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Svec 2006-12-08 09:22:38 UTC
After I normally log out of KDE while running firefox and log in back, I always get an error message "Your last Firefox session closed unexpectedly...".

As I log out correctly, I would expect it's not unexpected for firefox. Is this a firefox problem or KDE session problem? It's extremely annoying.
Comment 1 Michael Wolf 2006-12-08 18:47:08 UTC
-> mozilla
Comment 2 Forgotten User zhFaldehF_ 2006-12-09 06:46:06 UTC
after closing the firefox window, open a terminal (konsole) and type the following:

ps -ae | grep fire

Does it report firefox is still running? if so type: 

kill pid (pid being the 1188 number or so). 

Reboot, now what happens?
Comment 3 Michal Svec 2006-12-11 12:42:12 UTC
If I close the window normally (without logging out), firefox quits and is not running any more. So after logging in and out it doesn't try to start again.
Comment 4 roberto sarrionandia 2006-12-25 20:18:53 UTC
Firefox does this when you log out without quitting; rather than automatically restore itself it asks if you would like to restore your last session or start again.

I believe this is by design.
Comment 5 Michal Svec 2007-01-08 10:48:48 UTC
Well, it should IMHO differentiate if it crashed or exited normally (and logging out is the latter obviously).
Comment 6 Wolfgang Rosenauer 2007-01-11 20:56:34 UTC
This is most probably
https://bugzilla.mozilla.org/show_bug.cgi?id=336193

I never checked that yet but I guess closing KDE kills running applications with SIGTERM?
Comment 7 JP Rosevear 2007-04-25 19:49:38 UTC
GNOME does the same thing,  Its probably not exiting normally because its not support XSMP where it could just handle the quit signal.
Comment 8 JP Rosevear 2007-04-25 20:51:26 UTC
The upstream is https://bugzilla.mozilla.org/show_bug.cgi?id=93789

This is also have of bug 257343.
Comment 9 JP Rosevear 2007-08-21 14:24:17 UTC
There is an upstream patch for the mozilla piece thats been comitted to trunk,
not sure if its back portable.  Wolfgang, Maw what do you think
Comment 10 Wolfgang Rosenauer 2007-08-21 15:20:56 UTC
Investigating/testing now.
Comment 11 Wolfgang Rosenauer 2007-08-21 16:46:49 UTC
I integrated the upstream patch into the buildservice Firefox package now and it does something:
- Gnome is not saying that Firefox can't get restored
- Firefox doesn't ask to restore the session
but
- Firefox also doesn't restart in the old state when login to Gnome
  (which I understood should be the point with that)

I don't know much about xsmp and the Gnome layer about it.
Could someone please check the code in 
https://bugzilla.mozilla.org/attachment.cgi?id=272580
and explain if that saves the session correctly on X11/Gnome to be able to restart the browser or is that not intended here?
Looking at metacity's sessions it saves an entry with class="Firefox-bin" name="Gecko" and some more info.
Does metacity try to restore using class as application to start? That would explain why it doesn't work.
Comment 12 Federico Mena Quintero 2007-08-21 22:50:45 UTC
(In reply to comment #11 from Wolfgang Rosenauer)
> - Gnome is not saying that Firefox can't get restored

This is the right behavior.  Gnome-session detected that Firefox registered as a session-managed client, so "all is normal".

> - Firefox doesn't ask to restore the session

... as expected, since it has the chance to quit normally from die_cb() in the patch.

> but
> - Firefox also doesn't restart in the old state when login to Gnome
>   (which I understood should be the point with that)

This happens because the patch doesn't provide a "restart command" correctly.  Each session has a unique ID.  Session-managed programs can use this ID to save their information and restore it later (very few programs implement this correctly, if at all!).

[XSMP is pretty baroque... it wants to let you do things like have a session for home, a session for work, etc., all with different programs to be restarted each time.  That's what the different IDs are for.]

If you simply call gnome_program_init(), the machinery gets set up so that the restart_command is basename(argv[0]).  This is a best-effort thing; gnome_program_init() assumes that it is getting the real argv from main().

However, Firefox is passing bogus data for that argv, and it is not setting an explicit restart_command :)  Grep for "gecko" in the patch; you'll see that

+  char *argv[2] = { "gecko", "--disable-crash-dialog" };
+  gnome_program_init("Gecko", "1.0", libgnomeui_module_info_get(), 2, argv, NULL);

is definitely not a valid command line.  If you replace "gecko" with "firefox" in the definition of argv, I'm 99% sure you'll get Firefox to restart, but without restoring its tabs/windows.

Ideally, a program will do the full thing in its save_yourself_cb and do:

  save_my_data_for_session_id (session_id);

  gnome_client_set_restart_command (client, ["myprog", "--session-restart", session_id]);

  gnome_client_set_discard_command (client, ["myprog", "--discard-session-info", session_id]);

These are just sample arguments; they could be anything your app wants.  For example, if your program creates ~/.foo/sessions/[session_id] when saving a session, it could very well set its discard_command to "rm -rf ~/.foo/sessions/[session_id]".

[XSMP is even more baroque than that --- you can define other commands for different situations (resign_command, shutdown_command).  But you don't care about those unless you are a session-wide, desktop-level program.]

> Does metacity try to restore using class as application to start? That would
> explain why it doesn't work.

It's not metacity; it's gnome-session.  See above for how the command gets determined.
Comment 13 Wolfgang Rosenauer 2007-08-22 13:46:17 UTC
Thanks for the explanation.
So the issue described in the subject of this bug is solved now in Firefox from buildservice. It doesn't complain about unexpectedly closes sessions.
So assigning directly to maw to include the patch in the distro.
Comment 14 Wolfgang Rosenauer 2007-09-26 07:55:20 UTC
Seems it is included in 10.3 Firefox
Comment 15 JP Rosevear 2007-11-14 19:05:01 UTC
*** Bug 220249 has been marked as a duplicate of this bug. ***