wezterm icon indicating copy to clipboard operation
wezterm copied to clipboard

Weztem failed to run

Open ayoubelmhamdi opened this issue 2 years ago • 5 comments

What Operating System(s) are you seeing this problem on?

Linux X11

Which Wayland compositor or X11 Window manager(s) are you using?

X11 in i3 version 4.22 (2023-01-02) © 2009 Michael Stapelberg and contributors

WezTerm version

wezterm 20230712_2

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

I cannot run Wezterm after some time; I need to reboot the machine.

To Reproduce

$ wezterm

Configuration

If a file named ~/.config/wezterm/wezterm.lua exists, this problem sometimes occurs, whether I have some configuration or not. The problem only arises if the file exists.

Expected Behavior

launch wezterm

Logs

17:12:36.723  ERROR  env_bootstrap > panic at config/src/lib.rs:507:59 - !?
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: __libc_start_call_main
             at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  15: __libc_start_main_impl
             at ./csu/../csu/libc-start.c:381:3
  16: <unknown>

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Io(Os { code: 24, kind: Uncategorized, message: "Too many open files" }), paths: [] }', config/src/lib.rs:507:59
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Anything else?

No response

ayoubelmhamdi avatar Oct 04 '23 16:10 ayoubelmhamdi

{ code: 24, kind: Uncategorized, message: "Too many open files" }

Can you check how many files WezTerm is openning:

$ ps -ef | grep [w]ezterm
$ lsof -p <pid_of_wezterm> | wc -l

and what is your current settings?

$ ulimit -a

Could you please disable auto reload config and try again to see if you can reproduce this?

quantonganh avatar Oct 12 '23 05:10 quantonganh

$ ps -ef | command grep '[wW]ezterm'
mhamdi   13247     1  0 Oct16 ?        00:00:00 /bin/sh -c wezterm
mhamdi   13248 13247  0 Oct16 ?        00:07:08 /usr/bin/wezterm-gui
$ ulimit -a
-t: cpu time (seconds)              unlimited
-f: file size (blocks)              unlimited
-d: data seg size (kbytes)          unlimited
-s: stack size (kbytes)             8192
-c: core file size (blocks)         0
-m: resident set size (kbytes)      unlimited
-u: processes                       31003
-n: file descriptors                2048
-l: locked-in-memory size (kbytes)  1024
-v: address space (kbytes)          unlimited
-x: file locks                      unlimited
-i: pending signals                 31003
-q: bytes in POSIX msg queues       819200
-e: max nice                        0
-r: max rt priority                 0
-N 15: rt cpu time (microseconds)   unlimited

INFO

If I remove all windows and applications, including Wezterm terminals, I will be able to open some Wezterm terminals. However, when I close them, I can only open one terminal, as if there is a limit on the number of running applications. Wezterm increases by one, and applications by two. So, when I reach the threshold, I need to close some applications to free up space for opening new terminals

rem-wez

UPDATE

i can also open new wezterm terminal by sudo wezterm as root.

ayoubelmhamdi avatar Oct 17 '23 23:10 ayoubelmhamdi

$ ulimit -a
-n: file descriptors                2048

Could you please provide this:

$ lsof -p <pid_of_wezterm> | wc -l

So we can determine how many file descriptors WezTerm is using.

If I remove all windows and applications, including Wezterm terminals, I will be able to open some Wezterm terminals.

The culprit might be another application, not WezTerm. For example, you might have an application that opens nearly 2048 file descriptors, and that could be preventing you from opening WezTerm due to that limit. You can try to increase that limit to see if it helps. However, I also suggest you find out which application is consuming most file descriptors.

i can also open new wezterm terminal by sudo wezterm as root.

It's possible that root has a different limit than normal user:

sudo ulimit -n

quantonganh avatar Oct 18 '23 00:10 quantonganh

I rebooted my machine and tried to open multiple instances of wezterm. The maximum was:

$ lsof -p $(pgrep wezterm) | wc -l
973

Then I executed pkill wezterm, and after that, I could only open one wezterm (with multiple tabs). If I execute lsof again, it starts from 121.

$ lsof -p $(pgrep wezterm) | wc -l
121

When I open a new tab, it becomes 126, and each subsequent new tab increases by 5, so the next would be 131. These numbers come from opening the new tabs within one wezterm.

ayoubelmhamdi avatar Oct 18 '23 02:10 ayoubelmhamdi

I'm trying wezterm out for the first time and am running into this issue when using the latest app image (20240203-110809-5046fc22) (regular or nightly, doesn't matter).

The only thing that allowed wezterm to run was removing the ~/.config/wezterm/wezterm.lua file, or add the following config:

local wezterm = require('wezterm');
local config = wezterm.config_builder()

config.automatically_reload_config = false

return config

calebdw avatar Feb 20 '24 00:02 calebdw