kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.13k stars 971 forks source link

Memory error on start-up when many kitty instances were opened and closed #6972

Closed vdawg-git closed 9 months ago

vdawg-git commented 9 months ago

Describe the bug Kitty fails to launch after I had opened and closed a lot of Kitty windows. After a while it works again. Edit:
If I happen to still have a Kitty window open, running killall kitty fixes the problem temporarily

To Reproduce I cannot find an exact way, it simply happens after I opened a lot of instances and closed them again.

Environment details

kitty 0.31.0 created by Kovid Goyal
Linux swordfish 6.6.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 02 Jan 2024 02:28:28 +0000 x86_64
EndeavourOS Linux 6.6.9-arch1-1 (/dev/tty)

DISTRIB_ID="EndeavourOS"
DISTRIB_RELEASE="rolling"
DISTRIB_DESCRIPTION="EndeavourOS Linux"
DISTRIB_CODENAME="rolling"
Running under: Wayland
Frozen: False
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib/kitty
  extensions dir: /usr/lib/kitty/kitty
  system shell: /usr/bin/fish
Loaded config files:
  /home/vdawg/.config/kitty/kitty.conf

Config options different from defaults:
active_tab_font_style   (True, False)
allow_remote_control    yes
background_opacity      0.55
copy_on_select          clipboard
cursor_text_color       None
font_family             JetBrainsMono Nerd Font
font_size               13.0
strip_trailing_spaces   smart
tab_bar_edge            1
tab_bar_style           powerline
tab_powerline_style     round
window_padding_width    FloatEdges(left=24.0, top=24.0, right=24.0, bottom=24.0)
Added shortcuts:
    ctrl+t →  launch --cwd=current --type=tab
Colors:
    active_border_color     #d3869b   
    active_tab_background   #665c54   
    active_tab_foreground   #fbf1c7   
    bell_border_color       #8ec07c   
    color0                  #665c54   
    color1                  #cc241d   
    color10                 #b8bb26   
    color11                 #fabd2f   
    color12                 #83a598   
    color13                 #d3869b   
    color14                 #8ec07c   
    color15                 #bdae93   
    color2                  #98971a   
    color3                  #d79921   
    color4                  #458588   
    color5                  #b16286   
    color6                  #689d6a   
    color7                  #a89984   
    color8                  #7c6f64   
    color9                  #fb4934   
    cursor                  #928374   
    foreground              #ebdbb2   
    inactive_border_color   #665c54   
    inactive_tab_background #3c3836   
    inactive_tab_foreground #a89984   
    selection_background    #ebdbb2   
    selection_foreground    #928374   
    url_color               #83a598   
    visual_bell_color       #8ec07c   

Important environment variables seen by the kitty process:
    PATH                                /home/vdawg/.cabal/bin:/home/vdawg/.ghcup/bin:~/vdawg/.local/share/pnpm:/home/vdawg/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin
    LANG                                en_US.UTF-8
    VISUAL                              code
    EDITOR                              code
    SHELL                               /usr/bin/fish
    DISPLAY                             :1
    WAYLAND_DISPLAY                     wayland-1
    USER                                vdawg
    XCURSOR_SIZE                        24
    XDG_SESSION_PATH                    /org/freedesktop/DisplayManager/Session1
    XDG_BACKEND                         wayland
    LC_ADDRESS                          de_DE.UTF-8
    LC_NAME                             de_DE.UTF-8
    LC_MONETARY                         de_DE.UTF-8
    XDG_SEAT                            seat0
    XDG_SESSION_DESKTOP                 Hyprland
    XDG_SESSION_TYPE                    wayland
    LC_PAPER                            de_DE.UTF-8
    XDG_CURRENT_DESKTOP                 Hyprland
    XDG_SEAT_PATH                       /org/freedesktop/DisplayManager/Seat0
    XDG_SESSION_CLASS                   user
    LC_IDENTIFICATION                   de_DE.UTF-8
    LC_TELEPHONE                        de_DE.UTF-8
    LC_MEASUREMENT                      de_DE.UTF-8
    XDG_VTNR                            1
    XDG_SESSION_ID                      2
    XDG_RUNTIME_DIR                     /run/user/1000
    LC_TIME                             de_DE.UTF-8
    XDG_DATA_DIRS                       /home/vdawg/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
    LC_NUMERIC                          de_DE.UTF-8

Additional context It works with kitty --config NONE and after a while the normal config works again too.

[005 18:24:14.945337] Traceback (most recent call last):
  File "/usr/bin/../lib/kitty/kitty/main.py", line 559, in main
    _main()
  File "/usr/bin/../lib/kitty/kitty/main.py", line 551, in _main
    run_app(opts, cli_opts, bad_lines)
  File "/usr/bin/../lib/kitty/kitty/main.py", line 293, in __call__
    _run_app(opts, args, bad_lines)
  File "/usr/bin/../lib/kitty/kitty/main.py", line 271, in _run_app
    boss.start(window_id, startup_sessions)
  File "/usr/bin/../lib/kitty/kitty/boss.py", line 1154, in start
    self.startup_first_child(first_os_window_id, startup_sessions=startup_sessions)
  File "/usr/bin/../lib/kitty/kitty/boss.py", line 407, in startup_first_child
    wid = self.add_os_window(startup_session, window_state=wstate, os_window_id=os_window_id)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/../lib/kitty/kitty/boss.py", line 444, in add_os_window
    tm = TabManager(os_window_id, self.args, wclass, wname, startup_session)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/../lib/kitty/kitty/tabs.py", line 881, in __init__
    self._add_tab(Tab(self, session_tab=t))
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/../lib/kitty/kitty/tabs.py", line 165, in __init__
    self.startup(session_tab)
  File "/usr/bin/../lib/kitty/kitty/tabs.py", line 214, in startup
    self.new_special_window(spec)
  File "/usr/bin/../lib/kitty/kitty/tabs.py", line 549, in new_special_window
    return self.new_window(
           ^^^^^^^^^^^^^^^^
  File "/usr/bin/../lib/kitty/kitty/tabs.py", line 533, in new_window
    self._add_window(window, location=location, overlay_for=overlay_for, overlay_behind=overlay_behind)
  File "/usr/bin/../lib/kitty/kitty/tabs.py", line 501, in _add_window
    self.relayout()
  File "/usr/bin/../lib/kitty/kitty/tabs.py", line 296, in relayout
    self.current_layout(self.windows)
  File "/usr/bin/../lib/kitty/kitty/layout/base.py", line 324, in __call__
    self.do_layout(all_windows)
  File "/usr/bin/../lib/kitty/kitty/layout/tall.py", line 189, in do_layout
    self.layout_single_window_group(next(all_windows.iter_all_layoutable_groups()))
  File "/usr/bin/../lib/kitty/kitty/layout/base.py", line 337, in layout_single_window_group
    wg.set_geometry(geom)
  File "/usr/bin/../lib/kitty/kitty/window_list.py", line 120, in set_geometry
    w.set_geometry(geom)
  File "/usr/bin/../lib/kitty/kitty/window.py", line 818, in set_geometry
    self.screen.resize(new_geometry.ynum, new_geometry.xnum)
MemoryError
kovidgoyal commented 9 months ago

This is already fixed in master, use the nightly build or wait for the next release.