linuxmint / mdm

The MDM Display Manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PostSession-Script gets terminated by SIGKILL (mint 18 MATE)

coffeelover opened this issue · comments

If i use a PostSession-Script in stock Mint 18 MATE, it will be killed on shutdown or restart while it's running

Sep 22 14:16:10 alice systemd-logind[700]: System is rebooting.
Sep 22 14:16:10 alice mdm[1046]: DEBUG: Sending SESSPID == 0 for slave 1046
Sep 22 14:16:10 alice mdm[1029]: mdm[1029]: DEBUG: Got SESSPID == 0
Sep 22 14:16:10 alice mdm[1046]: DEBUG: mdm_slave_session_stop: bob on :0
Sep 22 14:16:10 alice mdm[1046]: DEBUG: mdm_slave_session_stop: Running post session script
Sep 22 14:16:10 alice mdm[1029]: DEBUG: Got SESSPID == 0
Sep 22 14:16:10 alice mdm[1046]: DEBUG: Forking extra process: /etc/mdm/PostSession/Default
Sep 22 14:16:10 alice mdm[1029]: mdm[1029]: DEBUG: mainloop_sig_callback: Got signal 17
Sep 22 14:16:10 alice mdm[1029]: mdm[1029]: WARNING: mdm_cleanup_children: child 1046 crashed of signal 1
Sep 22 14:16:10 alice mdm[1029]: mdm[1029]: WARNING: mdm_cleanup_children: Slave crashed, killing its children
Sep 22 14:16:10 alice mdm[1029]: mdm[1029]: DEBUG: mdm_sleep_no_signal 1
Sep 22 14:16:10 alice mdm[1029]: DEBUG: mainloop_sig_callback: Got signal 17
Sep 22 14:16:10 alice mdm[1029]: WARNING: mdm_cleanup_children: child 1046 crashed of signal 1
Sep 22 14:16:10 alice mdm[1029]: WARNING: mdm_cleanup_children: Slave crashed, killing its children
Sep 22 14:16:10 alice mdm[1029]: DEBUG: mdm_sleep_no_signal 1
Sep 22 14:16:10 alice systemd[1]: Stopping Session c1 of user bob.

The problem is easily reproducable on a stock system, just insert some sleep in the /etc/mdm/PostSession/Default-File:

#!/bin/bash
echo "$(date) start" >> /var/log/post_debug.log
logger -i post-session "PID: $$ - Shutting Down"
sleep 60
echo "$(date) stop" >> /var/log/post_debug.log
exit 0

The Log statement will sometimes work, but mostly the script gets killed before that.

If i comment the function call for mdm_slave_quick_exit (exit_code_to_use); in line 697 of daemon/slave.c (in function term_session_stop_and_quit) the post session scripts gets executed until it does an exit by itself.

Hi,

Do you know if this is a regression? I.e. did the issue occur in Mint 17.x?

Hi,

the issue did not occur in Mint 17.x.

I couldn't find the cause for the regression (between Mint 17 and Mint 18).

I'd be interested to know how you came to suspect mdm_slave_quick_exit (exit_code_to_use), please share your analysis on this.

In any case I was able to reproduce the issue and confirm the fix.

I tested as many use cases as I could and couldn't find any regression.

Hello.
I installed clean Mint 18 mate. Used "apt-get source" to get mdm souces. Next I comment out line 697 of daemon/slave.c, recompiled package with "debuild -us -uc". After that I try to install package with "dpkg -i", also try to replace mdm binary, but nothing changed. Reboot and Shutdown commands kills /etc/mdm/PostSession/Default script while it's running without waiting.
I do something wrong or this fix not fixes issue?

Any updates?

I also tried 2.0.15 package on clean Mint18 installation, but this is not fixed issue.

I installed 18.1 Serena and it has this issue too.

Reopening the issue and reverting the commit then.

commented

Hi,

commenting out mdm_slave_quick_exit (exit_code_to_use); did not work in my tests.

I noticed that sometimes the cups-browsed.service need up to 2 minutis to stop.

In this case a /etc/mdm/PostSession/Default with a sleep of 60 seconds gets (often) executed.

I recommend a sleep higher than 120s and a disabled cups-browsed.service for the testing environment.

To disable the cups-browsed.service just do this:
sudo systemctl stop cups-browsed.service
sudo systemctl disable cups-browsed.service

2.0.16 has the same issue, patching does not make it work.
To repeat, the /etc/mdm/PostSession/Default is not working as intended.