Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminal crashes on input #1087

Closed
chrjen opened this issue Oct 23, 2018 · 9 comments
Closed

Terminal crashes on input #1087

chrjen opened this issue Oct 23, 2018 · 9 comments

Comments

@chrjen
Copy link

chrjen commented Oct 23, 2018

The terminal crashes when trying to display the example below. This includes using cat, vim, less, tail, etc. I am using kitty 0.12.3.

Name[te]=అడ్డదారుల కూర్పకం

Same, but outputted using xxd, can be reverted back to binary using command «xxd -r».

00000000: 4e61 6d65 5b74 655d 3de0 b085 e0b0 a1e0  Name[te]=.......
00000010: b18d e0b0 a1e0 b0a6 e0b0 bee0 b0b0 e0b1  ................
00000020: 81e0 b0b2 20e0 b095 e0b1 82e0 b0b0 e0b1  .... ...........
00000030: 8de0 b0aa e0b0 95e0 b082 0a              ...........

The crash gives the following error in the terminal «double free or corruption (fasttop)».

@kovidgoyal
Copy link
Owner

I cannot reproduce, running with:

kitty sh -c "xxd -r /t/crash.txt; read"

where /t/crash.txt contains the xxd output you posted. Post a backtrace for the crash, or a minimal kitty config that reproduces it. And what OS you are on.

@chrjen
Copy link
Author

chrjen commented Oct 24, 2018

It crashes when trying to display the characters, not reading them.

Try kitty sh -c "xxd -r /t/crash.txt" instead, crashes for me.

@kovidgoyal
Copy link
Owner

The code I posted is displaying them, and no your command line does not
crash for me.

@chrjen
Copy link
Author

chrjen commented Oct 24, 2018

I see, well it doesn't seem to be a config issue. I removed ~/.config/kitty/kitty.conf and it still happens.

Well here is my setup

  • OS: Manjaro Linux x86_64
  • Kernel: 4.19.0-1-MANJARO
  • DE: i3-with-shmlog
  • WM: i3
  • Terminal: kitty (duh)
  • CPU: Intel i7-8700K (12) @ 4.700GHz
  • GPU: NVIDIA GeForce GTX 1080

Do you have instructions on how I would get/generate a backtrace of the crash?

@kovidgoyal
Copy link
Owner

I'm not familiar with your distro, but in general. Build kitty from source with debug symbols using

make debug

https://sw.kovidgoyal.net/kitty/build.html

then use whatever facility your distro provides for generating backtraces. On systemd based systems, it is

echo bt | coredumpctl gdb

@chrjen
Copy link
Author

chrjen commented Oct 24, 2018

Ok, I think I did everything. This is what I got.
It seems to be at kitty/freetype.c:252 when it crashes.

[New LWP 12566]
[New LWP 12568]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `python3 .'.
Program terminated with signal SIGABRT, Aborted.
#0  0x00007fdf345f9d7f in raise () from /usr/lib/libc.so.6
[Current thread is 1 (Thread 0x7fdf340b9600 (LWP 12566))]
(gdb) #0  0x00007fdf345f9d7f in raise () from /usr/lib/libc.so.6
#1  0x00007fdf345e4672 in abort () from /usr/lib/libc.so.6
#2  0x00007fdf3463c878 in __libc_message () from /usr/lib/libc.so.6
#3  0x00007fdf3464318a in malloc_printerr () from /usr/lib/libc.so.6
#4  0x00007fdf34644b27 in _int_free () from /usr/lib/libc.so.6
#5  0x00007fdf346471d5 in _int_realloc () from /usr/lib/libc.so.6
#6  0x00007fdf346484cb in realloc () from /usr/lib/libc.so.6
#7  0x00007fdf32fd7f77 in ?? () from /usr/lib/libfreetype.so.6
#8  0x00007fdf32fdc403 in FT_Bitmap_Copy () from /usr/lib/libfreetype.so.6
#9  0x00007fdf33362002 in load_glyph (load_type=4, glyph_index=3106, self=0x7fdf31ae9a50) at /home/chrjen/src/other/github.com/kovidgoyal/kitty/kitty/freetype.c:252
#10 render_bitmap (fg=0x55acf07362f0, rescale=true, italic=false, bold=<optimized out>, num_cells=1, cell_height=18, cell_width=9, ans=0x7ffe80c701d0, glyph_id=3106, self=0x7fdf31ae9a50) at /home/chrjen/src/other/github.com/kovidgoyal/kitty/kitty/freetype.c:330
#11 render_glyphs_in_cells (f=<optimized out>, bold=<optimized out>, italic=false, info=info@entry=0x55acf0657d8c, positions=positions@entry=0x55acf064c27c, num_glyphs=num_glyphs@entry=1, canvas=0x55acf0acbc10, cell_width=<optimized out>, cell_height=18, num_cells=1, baseline=14, 
    was_colored=0x7ffe80c702fb, fg=0x55acf07362f0) at /home/chrjen/src/other/github.com/kovidgoyal/kitty/kitty/freetype.c:501
#12 0x00007fdf3336c4c3 in render_group (extra_glyphs=0x7ffe80c70300, glyph=3106, font=0x55acf0a91100, positions=0x55acf064c27c, info=0x55acf0657d8c, gpu_cells=0x55acf0e5bb90, cpu_cells=0x55acf0e43ef0, num_glyphs=1, num_cells=1, fg=0x55acf07362f0)
    at /home/chrjen/src/other/github.com/kovidgoyal/kitty/kitty/fonts.c:654
#13 render_groups (font=0x55acf0a91100, fg=0x55acf07362f0) at /home/chrjen/src/other/github.com/kovidgoyal/kitty/kitty/fonts.c:927
#14 render_run (pua_space_ligature=false, font_idx=<optimized out>, num_cells=<optimized out>, first_gpu_cell=<optimized out>, first_cpu_cell=<optimized out>, fg=0x55acf07362f0) at /home/chrjen/src/other/github.com/kovidgoyal/kitty/kitty/fonts.c:978
#15 render_line (fg_=fg_@entry=0x55acf07362f0, line=0x7fdf31a96ae0) at /home/chrjen/src/other/github.com/kovidgoyal/kitty/kitty/fonts.c:1028
#16 0x00007fdf3332ffda in screen_update_cell_data (self=self@entry=0x55acf0d19570, address=0x7fdf2d758a00, fonts_data=fonts_data@entry=0x55acf07362f0) at /home/chrjen/src/other/github.com/kovidgoyal/kitty/kitty/screen.c:1480
#17 0x00007fdf3331240b in cell_prepare_to_render (fonts_data=0x55acf07362f0, dy=0.0259552989, dx=0.0142970616, ystart=1, xstart=-0.993645728, screen=0x55acf0d19570, gvao_idx=4, vao_idx=3) at /home/chrjen/src/other/github.com/kovidgoyal/kitty/kitty/shaders.c:281
#18 send_cell_data_to_gpu (vao_idx=3, gvao_idx=4, xstart=-0.993645728, ystart=1, dx=0.0142970616, dy=0.0259552989, screen=0x55acf0d19570, os_window=os_window@entry=0x55acf083e9c0) at /home/chrjen/src/other/github.com/kovidgoyal/kitty/kitty/shaders.c:446
#19 0x00007fdf33389b2d in prepare_to_render_os_window (num_visible_windows=<synthetic pointer>, active_window_bg=<synthetic pointer>, active_window_id=<synthetic pointer>, now=28488.76440629, os_window=0x55acf083e9c0)
    at /home/chrjen/src/other/github.com/kovidgoyal/kitty/kitty/child-monitor.c:596
#20 render (now=28488.76440629) at /home/chrjen/src/other/github.com/kovidgoyal/kitty/kitty/child-monitor.c:652
#21 main_loop (self=0x7fdf31a9c390, a=<optimized out>) at /home/chrjen/src/other/github.com/kovidgoyal/kitty/kitty/child-monitor.c:779
#22 0x00007fdf3439eb81 in _PyMethodDef_RawFastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#23 0x00007fdf343ca31f in _PyMethodDescr_FastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#24 0x00007fdf3441644d in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#25 0x00007fdf3439e2fb in _PyFunction_FastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#26 0x00007fdf34411d3d in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#27 0x00007fdf3439e2fb in _PyFunction_FastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#28 0x00007fdf34411d3d in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#29 0x00007fdf3439e2fb in _PyFunction_FastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#30 0x00007fdf34411d3d in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#31 0x00007fdf3439e2fb in _PyFunction_FastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#32 0x00007fdf34411d3d in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#33 0x00007fdf3439e2fb in _PyFunction_FastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#34 0x00007fdf34411d3d in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#35 0x00007fdf34356ee9 in _PyEval_EvalCodeWithName () from /usr/lib/libpython3.7m.so.1.0
#36 0x00007fdf34357de4 in PyEval_EvalCodeEx () from /usr/lib/libpython3.7m.so.1.0
#37 0x00007fdf34357e0c in PyEval_EvalCode () from /usr/lib/libpython3.7m.so.1.0
#38 0x00007fdf344289bd in ?? () from /usr/lib/libpython3.7m.so.1.0
#39 0x00007fdf3439eb13 in _PyMethodDef_RawFastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#40 0x00007fdf3439ed21 in _PyCFunction_FastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#41 0x00007fdf34416112 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#42 0x00007fdf34356ee9 in _PyEval_EvalCodeWithName () from /usr/lib/libpython3.7m.so.1.0
#43 0x00007fdf3439e4a2 in _PyFunction_FastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#44 0x00007fdf34411d3d in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#45 0x00007fdf34356ee9 in _PyEval_EvalCodeWithName () from /usr/lib/libpython3.7m.so.1.0
#46 0x00007fdf3435811c in _PyFunction_FastCallDict () from /usr/lib/libpython3.7m.so.1.0
#47 0x00007fdf34487267 in ?? () from /usr/lib/libpython3.7m.so.1.0
#48 0x00007fdf34488556 in ?? () from /usr/lib/libpython3.7m.so.1.0
#49 0x00007fdf34488810 in _Py_UnixMain () from /usr/lib/libpython3.7m.so.1.0
#50 0x00007fdf345e6223 in __libc_start_main () from /usr/lib/libc.so.6
#51 0x000055aceee6e05e in _start ()

@kovidgoyal
Copy link
Owner

that's a crash in freetype, not kitty. Most likely freetype does not like whatever font is being used for those characters on your system. Probably some bitmap font. Install a scalable font that is capable of displaying those chars and you will be fine. My system uses Arial Unicode MS.

Or run kitty with --debug-font-fallback which will show you what font is being used, and post that, I will take a look and see if I can workaround the crash in freetype.

@chrjen
Copy link
Author

chrjen commented Oct 24, 2018

Well in that case I hope you will take this up with whoever is responsible for that library. In any case this is what I got running with kitty with --debug-font-fallback.

% kitty --debug-font-fallback
[297 03:57:28.451330] Preloaded font faces:
[297 03:57:28.451364] normal face: /usr/share/fonts/TTF/VeraMono.ttf:0
[297 03:57:28.451374] bold face: /usr/share/fonts/TTF/VeraMoBd.ttf:0
[297 03:57:28.451381] italic face: /usr/share/fonts/TTF/VeraMoIt.ttf:0
[297 03:57:28.451388] bi face: /usr/share/fonts/TTF/VeraMoBI.ttf:0
[297 03:57:28.786252] [PARSE ERROR] Unknown OSC code: 13
[297 03:57:28.786370] [PARSE ERROR] Unknown OSC code: 708
[297 03:57:28.786381] [PARSE ERROR] Unknown OSC code: 13
U+c05 Face(family=Unifont, style=Sans-Serif, ps_name=, path=/usr/share/fonts/misc/unifont.bdf, index=0, is_scalable=False, has_color=False, ascender=0, descender=0, height=0, underline_position=0, underline_thickness=0) (new face)
U+c21 U+c4d Face(family=Unifont, style=Sans-Serif, ps_name=, path=/usr/share/fonts/misc/unifont.bdf, index=0, is_scalable=False, has_color=False, ascender=0, descender=0, height=0, underline_position=0, underline_thickness=0)
U+c21 Face(family=Unifont, style=Sans-Serif, ps_name=, path=/usr/share/fonts/misc/unifont.bdf, index=0, is_scalable=False, has_color=False, ascender=0, descender=0, height=0, underline_position=0, underline_thickness=0)
U+c26 U+c3e Face(family=Unifont, style=Sans-Serif, ps_name=, path=/usr/share/fonts/misc/unifont.bdf, index=0, is_scalable=False, has_color=False, ascender=0, descender=0, height=0, underline_position=0, underline_thickness=0)
U+c30 U+c41 Face(family=Unifont, style=Sans-Serif, ps_name=, path=/usr/share/fonts/misc/unifont.bdf, index=0, is_scalable=False, has_color=False, ascender=0, descender=0, height=0, underline_position=0, underline_thickness=0)
U+c32 Face(family=Unifont, style=Sans-Serif, ps_name=, path=/usr/share/fonts/misc/unifont.bdf, index=0, is_scalable=False, has_color=False, ascender=0, descender=0, height=0, underline_position=0, underline_thickness=0)
double free or corruption (fasttop)
[1]    2387 abort (core dumped)  kitty --debug-font-fallback

@kovidgoyal
Copy link
Owner

now fixed by working around the freetype issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants