Maximum number of clients reached more frequent than before?

For the second time in a few days I get an error

$ setxkbmap fr
Maximum number of clients reachedCannot open display ":0

Whenever I try to run an app that need to connect to X11.

People reported that X11 has a maximum number of connection that can be opened at the same time and that the following command can list the applications that consume the highest number of connections so that I can kill them:

$ lsof -U +c 15 | cut -f1 -d' ' | sort | uniq -c | sort -rn | head -3
    192 .kded5-wrapped
    108 dbus-daemon
     54 .firefox-wrappe

However I am surprised to experience this that often these days while I never encountered it before. Do you know if NixOs changed some settings related to the maximum number of allowed connections, or allowed some app to create more connections? (I am running NixOs from 1ffba9f2f68) Or can I manually configure it myself to increase the maximum number of connections?


I’ve also been running into this issue running a Plasma desktop with NixOS 22.05. I don’t have a workaround or explanation though.