[Users] 'exit' should exit ASAP
kardan
kardan at riseup.net
Wed Jun 19 21:28:22 CEST 2013
Hi,
my ram is limited and while compiling the cpu is more often waiting for
kswapd than the drive itself in such cases I would like to
stop all not directly necessary application as fast as possible.
Otherwise the computer is unusable for minutes or longer :(
There are several ways to exit claws (tray->exit, file->exit and
claws-mail --exit), but all lead to the same "folder is scanned" or
"message is downloaded". From the code I see there is an exit and I
would expect that before each each of those "normal" actions like
syncing folders, fetching mails it is checked and the action is
skipped, if an exit was requested. Actions like saving all open messages
and dump uncached config states should be not affected of course:
main.c:1583 static void exit_claws(MainWindow *mainwin)
1595 /* save prefs for opened folder */
1604 /* save all state before exiting */
All my tries did not lead to stop claws (for example I was able, to
open this new message window) and the sync tasks continue. The funny
thing is: the used ram is now about 30% more (before claws used 70mb
compared to 80mb by cc1plus):
PID PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
22988 20 0 509m 126m 12m S 6,9 25,1 90:58.43 claws-mail
16127 20 0 373m 56m 572 T 0,0 11,2 1:28.09 cc1plus
I needed to SIGSTOP the compiler to keep control over the machine.
Otherwise I can watch kswapd swapping my drive until heat collapse :)
Now 10 minutes later, claws ist still scanning folders, obviously
my wish to exit has been forgotten.
PID PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
22988 20 0 576m 124m 9236 S 0,0 24,8 91:14.57 claws-mail
27853 20 0 634m 116m 16m S 0,3 23,3 1:49.22 iceweasel
16127 20 0 373m 4916 472 T 0,0 1,0 1:28.09 cc1plus
Seems I have to be more aggressive.
$ claws-mail --offline --cancel-receiving --exit
main.c:2159:Using control
socket /tmp/claws-mail-1001/150d9d09d06cf77ffcef5978d0267df7
main.c:2253:another Claws Mail instance is already running.
The receiving is interrupted, but
imap.c:1049:disconnected!
folderview.c:2058:trying again
I can reproduce this with latest git version (3.9.2-24-g6c8b4b-dirty).
1) On terminal one I start claws-mail --debug and press shift+ctrl+S ('synchronize folders').
2) From terminal two I send 'claws-mail --exit'
In the second console I expect some message, that an exit signal has been sent and the other that it has been received, but there is none of both.
3) Now claws, while it is scanning folders, will finish that task first, instead of checking in between, if there has been a request to exit.
I went into the code and tried to add this test, and thought the easiest way is to change mainwindow.c:4191
static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask)
{
if (!any_folder_want_synchronise())
return;
to
static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask)
{
if (cmd.exit == TRUE || !any_folder_want_synchronise())
return;
But cmd is undefined from within this function and I have no clue, how to access it. Going the tree up
#136 0x080d85a5 in folderview_check_new (folder=0x875d0e8) at folderview.c:1176
#137 0x080f2371 in inc_all_account_mail (mainwin=0x84d8678, autocheck=0, notify=0) at inc.c:360
#138 0x080f36c1 in defer_check_all (data=data at entry=0x0) at main.c:312
maybe in any of these?
Kardan
More information about the Users
mailing list