By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release.

Bug 922

Summary: when logging out with unsaved file, trinity does not ask to save it
Product: TDE Reporter: Denis Prost <denis.prost>
Component: tdebaseAssignee: Timothy Pearson <kb9vqf>
Status: RESOLVED FIXED    
Severity: blocker CC: bugwatch, darrella, ignaz.forster, nick, robxu9, slavek.banko
Priority: P1    
Version: R14.0.0 [Trinity]   
Hardware: i386   
OS: All   
Compiler Version: TDE Version String:
Application Version: Application Name:
Bug Depends on:    
Bug Blocks: 760    

Description Denis Prost 2012-03-17 09:13:57 CDT
For example, edit some file in kate and don't save it.
Then logout.
Instead of kate asking you to save your file, TDE directly shows a dialog box saying "saving your settings" and then nothing happens, it looks like TDE is stuck here.
the only way to get out of here is to kill startkde process.
Comment 1 Darrell 2012-03-17 17:12:16 CDT
Confirmed on Slackware 13.1. This does not happen in 3.5.10 on the same system.

The stall seems to be caused by the open app waiting for a response but the user can't see the dialog. Unfortunately, blindly pressing Alt-D (&Do not save) has no effect. The only recourse is Ctrl-Alt-Backspace, which is disabled on many systems.

Bumping to Critical. Nobody likes losing their work. :)
Comment 2 Darrell 2012-03-30 19:48:53 CDT
I suspect the bug is caused by the "Saving your settings" dialog not checking the various "SaveYourself" functions before appearing and grabbing focus. That dialog should not appear until all apps have cleared the way to exit.
Comment 3 Darrell 2012-03-31 20:59:01 CDT
There is a temporary work-around to avoiding this bug. :)

In $TDEHOME/share/config/ksmserver, add the following:

[Logout]
showFancyLogout=false

That key controls the gray fade effect feature when the user has "Confirm logout" enabled in the Session Manager module. The gray fade effect was part of KDE3. The underlying ksmserver configuration options were added in Trinity. Not yet implemented are the KControl user controls.

Calvin is working on that, which will resolve bug report 258. Those new KControl options will provide a user-direct method to change the showFancyLogout feature.

Setting showFancyLogout=false disables the fade effect but serves as a temporary work-around to apps not saving files when the user decides to logout of the session.

The problem occurs in tdebase/ksmserver/shutdown.cpp, starting at line 164.

The code there reads the value of showFancyLogout and defaults to true when the value is not found. Because the KControl options do not yet exist, almost nobody has those keys in their user's ksmserver configuration file. Therefore the code always defaults to true.

Setting the internal code variable to true starts the non modal feedback dialog "Saving your settings..." and ignores any apps trying to save. Setting showFancyLogout=false forces the code not to show the feedback dialog. That non-event allows the normal logout to occur, regardless of how the user responds to any app's request to save files.

In addition to bug report being connected to bug report 258, this ties into bug report 681, which requests a KControl option to enable or disable the feedback dialog.

Yet after resolving bug reports 258 and 681, some C++ hacking is required to resolve bug report 922 and permanently fix the logic in tdebase/ksmserver/shutdown.cpp. The work-around offered here succeeds only when showFancyLogout=false and does not help when showFancyLogout=true or is missing.
Comment 4 Timothy Pearson 2012-05-13 17:31:11 CDT
(In reply to comment #2)
> I suspect the bug is caused by the "Saving your settings" dialog not checking
> the various "SaveYourself" functions before appearing and grabbing focus. That
> dialog should not appear until all apps have cleared the way to exit.

I agree with this.  Bumping to BLOCKER.
Comment 5 Timothy Pearson 2012-05-16 21:58:09 CDT
This bug should be fixed in GIT hash d2f8fca.  If not, please reopen this bug report.

Thanks for reporting!
Comment 6 Darrell 2012-05-17 00:05:31 CDT
I tested the patch. I now am prompted to save an app before ending the session. That is the good news. :-)

Whether saving or not saving, when I used certain apps with an unsaved file, the session exit took about 22 seconds. The tail end of my xsession log included the following:

[tdeinit] PID 27802 terminated.
ICE default IO error handler doing an exit(), pid = 27966, errno = 11
[starttde] Shutting down Trinity...
[tdeinit] Terminating Trinity.
[klauncher] Exiting on signal 1
[starttde] Running Trinity shutdown scripts...
[starttde] Trinity shutdown complete.

The ICE error is new.

When I exit with no unsaved documents the ICE error does not appear.

Using kate results in a normal session exit time and the ICE error does not appear.

Once I witnessed the slow exit time with having only Patience open.

I tried kedit, kwrite, kword, kspread, and kolourpaint. Same delay. Kate is the exception.

I created a shell script in ~/.trinity/shutdown to capture the ps list just before exiting, but no process ID ever matched the pid referenced in the ICE error.

The patch is the cause because I rebuilt tdebase with only that module being updated. The slower exit time is repeatable, as are the affected apps, as is the ICE error.
Comment 7 Timothy Pearson 2012-05-17 00:36:43 CDT
I'm going to mark this as RESOLVED FIXED, as:
1.) Slow logout is being handled in Bug 760
2.) The bug reported in this report has been resolved
3.) I don't see the slow logout, implying that something is still acting weird on your system as discussed in Bug 760

That said, do you see the ICE error exit when showFancyLogout=false?
Comment 8 Darrell 2012-05-17 00:57:00 CDT
The only way to test the patch for this bug report is with showFancyLogout=true.

When showFancyLogout=false, then apps intercept the session exit request and the exit time is normal. The ICE error does not appear.

If this new patch has introduced another race condition then I have no clue where to start troubleshooting.
Comment 9 Darrell 2012-05-17 01:41:37 CDT
Aargh --- too darned late at night....

The only way to test the patch for bug report 922 is with showFancyLogout=true.

When showFancyLogout=false, then apps intercept the session exit request and the exit time is normal. The ICE error does not appear.

Perhaps I stumbled across the cause. Well, not really. I rebooted and now can't repeat the problem. I witnessed the slow exit only once (kolourpaint) after many session restarts.

With that said, when showFancyLogout=true and I select Discard from the save dialog, I see this message in my xsession log:

[dcopserver] DCOP aborting while waiting for answer from 'knotify'

I see the message whether I save the document or don't save. The error message does not appear when there are no unsaved documents.

At this point I'm too tired to troubleshoot further.
Comment 10 Slávek Banko 2012-05-21 12:23:18 CDT
Is there some reason to leave open this bug?
I have a patch backported to 3.5.13.1 and it works great.
Comment 11 Timothy Pearson 2012-05-21 12:27:36 CDT
(In reply to comment #10)
> Is there some reason to leave open this bug?
> I have a patch backported to 3.5.13.1 and it works great.

No.  Darrell kept reopening it due to slow exit time, but that discussion continues in Bug 760 and is unrelated to this patch.
Comment 12 Slávek Banko 2012-05-21 12:34:27 CDT
(Odpověď na komentář #11)
> (In reply to comment #10)
> > Is there some reason to leave open this bug?
> > I have a patch backported to 3.5.13.1 and it works great.
> 
> No.  Darrell kept reopening it due to slow exit time, but that discussion
> continues in Bug 760 and is unrelated to this patch.

So I have one problem: During test, whether it is possible to log off, KNotes closes his notes. When the log off is interrupted (for example from kate), the notes remain closed. But for that I again open bug #987.
Comment 13 Darrell 2012-05-21 14:26:24 CDT
Refer to my latest post in bug report 760 for information about the slow exit time indirectly related to the patch for this bug report.
Comment 14 Slávek Banko 2012-06-03 19:47:44 CDT
Nick Leverton pointed to an important problem:

When I do a manual "save session", then the "saving session" dialogue box never goes away.  In fact a second "save session" dialogue pops up, and they repeatedly take turns in forcing themselve to the foreground. This option is only available if you choose "Restore manually saved session" in kcontrol Session Manager settings.

I might add:
+ Dialogues will gradually appear more than two.
+ ksmserver consequently to this give CPU load to 100%.
+ Even after killing dialogues (by Ctrl+Alt+Esc) can not logout - ksmserver does not respond.
Comment 15 Slávek Banko 2012-06-06 13:10:20 CDT
Fixed in GIT hash 5c3cd105.