Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When shutting down computer, emptty halts for a minute or two and produces ~/core. #96

Closed
amano-kenji opened this issue Oct 23, 2023 · 14 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@amano-kenji
Copy link
Contributor

amano-kenji commented Oct 23, 2023

The file size of ~/core is about 51 megabytes.

$ gdb emptty core
GNU gdb (Gentoo 13.2 vanilla) 13.2
....
Reading symbols from emptty...

warning: Can't open file /dev/shm/wlroots-EGAnPO (deleted) during file-backed mapping note processing

warning: core file may not match specified executable file.
[New LWP 4426]
[New LWP 4473]
[New LWP 4474]
Core was generated by `Xwayland :0 -rootless -core -terminate 10 -listenfd 27 -listenfd 29 -displayfd'.
Program terminated with signal SIGABRT, Aborted.
#0  0x00007f034f3ed9fc in ?? ()
[Current thread is 1 (LWP 4426)]
@amano-kenji
Copy link
Contributor Author

This seems to be xwayland issue.

@amano-kenji
Copy link
Contributor Author

Reopening because this issue started after upgrading emptty to 0.11.0

@amano-kenji amano-kenji reopened this Oct 24, 2023
@tvrzna
Copy link
Owner

tvrzna commented Oct 24, 2023

Can you, please, provide more info about your configuration? Because changes between v0.10.0 and v0.11.0 are mostly superficial. Couldn't it be related to #92, where was a change in OpenRC service requested?

edit: Does it happens also in case of running emptty as root?

@tvrzna tvrzna self-assigned this Oct 24, 2023
@tvrzna tvrzna added the bug Something isn't working label Oct 24, 2023
@amano-kenji
Copy link
Contributor Author

UID        PID  PPID  C STIME TTY      STAT   TIME CMD
root      3280 19914  0 10:08 tty7     Ssl+   0:00 /usr/bin/emptty -d

emptty is already running as root. I think the change to openrc init file could be the cause of the issue. I will investigate.

@amano-kenji
Copy link
Contributor Author

amano-kenji commented Oct 24, 2023

Adding

EMPTTY_TERMTIMEOUT=${EMPTTY_TERMTIMEOUT:-"TERM/60/KILL/15"}
retry="${EMPTTY_TERMTIMEOUT}"

to openrc init script merely shed a light on the real issue.

If ~/.config/emptty is

#!/bin/bash
Selection=true

xrdb -merge ~/.Xresources

. /etc/profile
. ~/.env

dinit &

"$@"

dinitctl shutdown

emptty fails to kill ~/.config/emptty sway. If ~/.config/emptty is

#!/bin/bash
Selection=true

xrdb -merge ~/.Xresources

. /etc/profile
. ~/.env

exec "$@"

emptty can kill ~/.config/emptty sway immediately. Thus, I need a way to properly shut down ~/.config/emptty without losing the part that handles dinit.

@tvrzna
Copy link
Owner

tvrzna commented Oct 24, 2023

Seems like any script after starting a desktop (even with Xorg) causes the same issue (e.g. logout from Openbox). Maybe some kind of user exit script would do the thing, if I can't find another solution.

@amano-kenji
Copy link
Contributor Author

If ~/.config/emptty is a shell script, then the last statement should be exec "$@". Otherwise, emptty fails to kill ~/.config/emptty.

@amano-kenji
Copy link
Contributor Author

I see two options.

  • Move dinitctl shutdown to my own scripts executed by keyboard shortcuts.
  • Implement user exit script in emptty.

@tvrzna
Copy link
Owner

tvrzna commented Oct 25, 2023

Currently there is already DISPLAY_STOP_SCRIPT, however it's started out of user's session as root. So I don't think this would help you. Custom script run by keyboard shortcuts wouldn't handle service termination, so it looks like user exit script is the only way. Also this script should have some short timeout, before it is also terminated (to avoid longer than usual situations).

@amano-kenji
Copy link
Contributor Author

amano-kenji commented Oct 25, 2023

These scripts seem to be able to reboot and power off my computer inside a sway session in response to sway keyboard shortcuts.

my-sway-reboot

#!/bin/sh
dinitctl shutdown
sudo my-reboot

my-sway-poweroff

#!/bin/sh
dinitctl shutdown
sudo my-poweroff

sudo my-reboot and sudo my-poweroff are executed without password.

Because ~/.config/emptty looks like

#!/bin/bash
Selection=true

xrdb -merge ~/.Xresources

. /etc/profile
. ~/.env

dinit &

exec "$@"

openrc can quickly kill emptty along with ~/.config/emptty sway.

@tvrzna
Copy link
Owner

tvrzna commented Oct 25, 2023

I've meant emptty service termination, e.g. by rc-service emptty stop.

@amano-kenji
Copy link
Contributor Author

amano-kenji commented Oct 25, 2023

If you want to implement user exit script, I want to be able to configure timeout for the script, or it should be a sensible value like 30 seconds.

@tvrzna
Copy link
Owner

tvrzna commented Oct 27, 2023

I'm thinking about this implementation:

  • ~/.config/emptty-exit file
  • similar to~/.config/emptty it will be shell script with variables, that will be read before execution.
  • in this case there will be variable TIMEOUT or something like that
  • after session finishes (logout, emptty termination, ...), it will check for existance of this file
  • if file exists, it will read it for known variables (TIMEOUT), if timeout is defined then it will be set, otherwise it will use some short one (5 seconds should be sufficient by default)
  • script is executed and kill timout starts
  • if timeout is exceeded, script is killed and termination of emptty continues as usual

@amano-kenji
Copy link
Contributor Author

I think that's good enough.

@tvrzna tvrzna added the enhancement New feature or request label Oct 29, 2023
@tvrzna tvrzna closed this as completed Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants