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

panel kitten crashes trying to draw a dock panel, throwing an out of memory error #6923

Closed neelchakrabrty closed 9 months ago

neelchakrabrty commented 9 months ago

Bug Attempting to run the panel kitten results in the kitten crashing and throwing a memory error.

To Reproduce Steps to reproduce the behavior:

  1. Run kitty +kitten panel sh -c 'printf "\n\n\nHello, world."; sleep 5s'
  2. See error

Error

[351 10:26:46.536990] 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

Environment details

kitty 0.31.0 created by Kovid Goyal
Linux zeus 6.6.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 14 Dec 2023 03:45:42 +0000 x86_64
Arch Linux 6.6.7-arch1-1 (/dev/tty)

Running under: X11
Frozen: False
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib/kitty
  extensions dir: /usr/lib/kitty/kitty
  system shell: /bin/fish
Loaded config files:
  /home/larry/.config/kitty/kitty.conf

Config options different from defaults:
allow_remote_control socket-only
background_blur      17
background_opacity   0.85
bold_font            CodeNewRoman Nerd Font Mono Bold
cursor_shape         3
editor               nvim
font_family          CodeNewRoman Nerd Font Mono
font_size            14.0
italic_font          CodeNewRoman Nerd Font Mono Italic
listen_on            unix:@mykitty
tab_bar_edge         1
tab_bar_style        powerline
tab_powerline_style  slanted
window_padding_width FloatEdges(left=20.0, top=20.0, right=20.0, bottom=20.0)

Important environment variables seen by the kitty process:
    PATH                                /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
    LANG                                en_US.UTF-8
    VISUAL                              nvim
    EDITOR                              nvim
    SHELL                               /bin/fish
    DISPLAY                             :0
    USER                                larry
    XDG_SESSION_CLASS                   user
    XDG_RUNTIME_DIR                     /run/user/1000
    XDG_VTNR                            7
    XDG_SEAT_PATH                       /org/freedesktop/DisplayManager/Seat0
    XDG_SESSION_ID                      5
    XDG_GREETER_DATA_DIR                /var/lib/lightdm-data/larry
    XDG_SESSION_TYPE                    x11
    XDG_SESSION_DESKTOP                 bspwm
    XDG_SEAT                            seat0
    XDG_SESSION_PATH                    /org/freedesktop/DisplayManager/Session1

Additional context Problem isn't reproducible with kitty --config NONE . Minimal kitty.conf that the problem persists with

font_family      CodeNewRoman Nerd Font Mono
bold_font        CodeNewRoman Nerd Font Mono Bold
italic_font      CodeNewRoman Nerd Font Mono Italic
bold_italic_font auto
font_size 14.0
cursor_shape underline
window_padding_width 20
allow_remote_control socket-only
listen_on unix:@mykitty
editor nvim
tab_bar_style powerline
tab_bar_edge top
tab_powerline_style slanted
background_blur 17
background_opacity 0.85
# BEGIN_KITTY_THEME
# Default
include current-theme.conf
# END_KITTY_THEME
kovidgoyal commented 9 months ago

The cause of the issue is window_padding_width

remove that and you will be fine. Or invoke the kitten as

kitty +kitten panel -o window_padding_width=0 sh ...

neelchakrabrty commented 9 months ago

Thank you, that solves my issue.