You are not logged in.

#1 2022-06-26 20:38:12

musbur
Member
Registered: 2022-01-14
Posts: 74

[Solved] dwm stops receiving events from X11 after a while

Hi all,

I've been using dwm for many years without trouble until I switched to Arch. So I don't think this issue is linked to dwm. The problem mostly occurs when I compose an email in Claws-Mail and the Composer window has been open for a while. When I press "Send," I see that the message appears in the outbound queue, but the message doesn't get sent, and the Composer window doesn't close. I added a bit of logging code in dwm's main loop run(), and I can observe "live" how at some point the influx of X events just stops. I thought that maybe one of dwm's event halndlers got stuck, thus halting the loop,  but that isn't the case.

Here are the relevant files that start up X. I'm not using a display manager but login from the text console. I somehow need both .xinitrc and .xsession in order to get the dbus-launch thing woking with a lot of help from this forum. I couldn't find any X logs anywhere on my system. I would expect logs to be in $HOME/.xsession-errors but it doesn't exist.

~$ cat .zprofile
if [[ -z "$TMUX" && -z "$DISPLAY" && "$XDG_VTNR" = "1" ]]; then
    exec /usr/bin/startx
fi
export PS1='%~ % '

~$ cat .xinitrc
dbus-launch --exit-with-session $HOME/.xsession

~$ cat .xsession
#!/bin/sh
setxkbmap -option caps:none
xbindkeys
/home/dh/c/dwm-6.3/dwm # custom dwm
# Needs to be alive
~$

(Never mind the "needs to be alive" comment. My original .xsession contains some extra code before and after the dwm call so I can't use the typical "exec" approach. I removed that code to see if the error is related to it, but it isn't)

Last edited by musbur (2022-07-02 19:04:58)

Offline

#2 2022-06-26 20:40:11

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [Solved] dwm stops receiving events from X11 after a while

Read the xinit wiki page, at the very least your session is likely broken.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2022-06-26 21:01:52

musbur
Member
Registered: 2022-01-14
Posts: 74

Re: [Solved] dwm stops receiving events from X11 after a while

Thanks for the tip, now heeding this advice:

"Note: At the very least, ensure that the last if block in /etc/X11/xinit/xinitrc is present in your ~/.xinitrc file to ensure that the scripts in /etc/X11/xinit/xinitrc.d are sourced."

Let's see how it holds up. Error sometimes occurs after a few minutes, sometimes it takes an hour. I'll report.

Offline

#4 2022-06-26 21:10:54

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,243

Re: [Solved] dwm stops receiving events from X11 after a while

Don't dbus-launch the session either.

The only symptom you described sounds more like a network issue.
Can you still open/close/move windows while the problem is present?

Offline

#5 2022-06-26 21:24:30

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,497
Website

Re: [Solved] dwm stops receiving events from X11 after a while

seth wrote:

The only symptom you described sounds more like a network issue.

Agreed.  In fact this was my first thought based on just the thread title -  then it was all but confirmed with the emailing issue.

X11 is a network protocol.  I'd suspect your machine's hostname is changing and thus interfering with messages between the Xorg server and any clients (including dwm).  The most likely culprits for such a problem is failing to have properly configured your hostname in the first place, along with another prime suspect of NetworkManager running.

Check the output of each of the following:

cat /etc/hostname
hostname
hostnamectl

Also comparing these before and immediately after the issue arises would be useful if possible.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2022-07-02 19:04:38

musbur
Member
Registered: 2022-01-14
Posts: 74

Re: [Solved] dwm stops receiving events from X11 after a while

Hi all, thanks for the help, problem seems to be solved. It was not a network issue, hostname was configured correctly, and the problem wasn't confined to claws-mail, that was just the most reliable trigger for the issue. What seems to have solved it was --as suggested in the wiki-- the inclusion of the /etc/X11/xinit/xinitrc.d scripts which also takes care of dbus, so I don't have to use dbus-launch any more.

Is there any easy to digest resource that explains the interaction between Xorg and dbus?

Offline

#7 2022-07-02 19:30:51

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,243

Re: [Solved] dwm stops receiving events from X11 after a while

Is there any easy to digest resource that explains the interaction between Xorg and dbus?

There isn't any. None. Zero. Less.
Whatever the symptoms were, you're misinterpreting them.

The xinitrc scripts crucially import the session environment, see /etc/X11/xinit/xinitrc.d/50-systemd-user.sh and that will "fix" the session bus and polkit, what's relevant to a bunch of stuff that toolkits often use - but not to X11. At all.

Offline

#8 2022-07-02 20:18:45

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,497
Website

Re: [Solved] dwm stops receiving events from X11 after a while

And dbus is not needed for dwm, at all.  So this seems a bit odd as an explanation for dwm no longer receiving events.  Of course it was launched with dbus-session-launch ... I have no idea how that black-box works.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2022-07-02 20:29:31

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,243

Re: [Solved] dwm stops receiving events from X11 after a while

You get a new session bus (and lose access to the primary one)

The problem mostly occurs when I compose an email in Claws-Mail and the Composer window has been open for a while. When I press "Send," I see that the message appears in the outbound queue, but the message doesn't get sent, and the Composer window doesn't close.

The window doesn't close because DWM sends a WM_DELETE_WINDOW and the client, still busy sending the mail, ignores or can't process that.
So the problem is that claws is stuck sending the mail and if it's not network, but session bus related, my money is on it trying to send a notification - but there's not notification server (dunst etc) on the session bus or the bus fails otherwise and you're waiting for a 25s dbus timeout (but all of this is speculative)

Offline

#10 2022-07-03 06:09:11

musbur
Member
Registered: 2022-01-14
Posts: 74

Re: [Solved] dwm stops receiving events from X11 after a while

It must be dbus related because the only thing that essentially changed in my xinit is that this script from /etc/X11/xinit/xinit.d is now executed. BTW, waiting for a timeout didn't do it. dwm was dead for good (not dead but receiving X events any more).

systemctl --user import-environment DISPLAY XAUTHORITY

if command -v dbus-update-activation-environment >/dev/null 2>&1; then
    dbus-update-activation-environment DISPLAY XAUTHORITY
fi

Offline

Board footer

Powered by FluxBB