htop icon indicating copy to clipboard operation
htop copied to clipboard

Segmentation fault: Error: A signal 11 (Segmentation fault) was received.

Open eval-exec opened this issue 2 years ago • 6 comments

I just start htop, and it crashed.

❯ htop


FATAL PROGRAM ERROR DETECTED
============================
Please check at https://htop.dev/issues whether this issue has already been reported.
If no similar issue has been reported before, please create a new issue with the following information:
  - Your htop version: '3.2.1'
  - Your OS and kernel version (uname -a)
  - Your distribution and release (lsb_release -a)
  - Likely steps to reproduce (How did it happen?)
  - Backtrace of the issue (see below)

Error information:
------------------
A signal 11 (Segmentation fault) was received.

Setting information:
--------------------
htop_version=3.2.1;config_reader_min_version=3;fields=53 48 3 4 0 51 18 113 20 53 17 114 18 38 39 40 2 46 47 49 1;hide_kernel_threads=1;hide_userland_threads=0;shadow_other_users=0;show_thread_names=1;show_program_path=1;highlight_base_name=1;highlight_deleted_exe=1;highlight_megabytes=1;highlight_threads=1;highlight_changes=1;highlight_changes_delay_secs=1;find_comm_in_cmdline=1;strip_exe_from_cmdline=1;show_merged_command=1;header_margin=1;screen_tabs=0;detailed_cpu_time=1;cpu_count_from_one=0;show_cpu_usage=1;show_cpu_frequency=1;show_cpu_temperature=1;degree_fahrenheit=0;update_process_names=1;account_guest_in_cpu_meter=1;color_scheme=0;enable_mouse=0;delay=10;hide_function_bar=0;header_layout=two_50_50;column_meters_0=AllCPUs;column_meter_modes_0=1;column_meters_1=Memory Tasks LoadAverage Hostname Uptime DiskIO NetworkIO Systemd CPU;column_meter_modes_1=1 2 2 2 2 2 2 2 1;tree_view=0;sort_key=46;tree_sort_key=46;sort_direction=-1;tree_sort_direction=-1;tree_view_always_by_pid=1;all_branches_collapsed=0;screen:Main=ELAPSED USER PPID PGRP PID TGID NICE OOM STARTTIME ELAPSED PRIORITY IO_PRIORITY NICE M_VIRT M_RESIDENT M_SHARE STATE PERCENT_CPU PERCENT_MEM TIME Command;.sort_key=PERCENT_CPU;.tree_sort_key=PERCENT_CPU;.tree_view=0;.tree_view_always_by_pid=1;.sort_direction=-1;.tree_sort_direction=-1;.all_branches_collapsed=0;screen:I/O=PID USER IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE PERCENT_SWAP_DELAY PERCENT_IO_DELAY Command;.sort_key=IO_RATE;.tree_sort_key=PID;.tree_view=0;.tree_view_always_by_pid=0;.sort_direction=-1;.tree_sort_direction=1;.all_branches_collapsed=0;

Backtrace information:
----------------------
htop(+0x12dcc)[0x564d0598edcc]
htop(CRT_handleSIGSEGV+0xe9)[0x564d05997269]
/usr/lib/libc.so.6(+0x38a00)[0x7f70bed8aa00]
htop(Process_updateCPUFieldWidths+0x0)[0x564d0599c560]
htop(+0x3cfe5)[0x564d059b8fe5]
htop(+0x3cb2e)[0x564d059b8b2e]
htop(+0x2a646)[0x564d059a6646]
htop(ScreenManager_run+0x5aa)[0x564d059a706a]
htop(CommandLine_run+0x43e)[0x564d0599775e]
/usr/lib/libc.so.6(+0x23290)[0x7f70bed75290]
/usr/lib/libc.so.6(__libc_start_main+0x8a)[0x7f70bed7534a]
htop(_start+0x25)[0x564d0598d075]

To make the above information more practical to work with, please also provide a disassembly of your htop binary. This can usually be done by running the following command:

   objdump -d -S -w `which htop` > ~/htop.objdump

Please include the generated file in your report.
Running this program with debug symbols or inside a debugger may provide further insights.

Thank you for helping to improve htop!

[1]    1369654 segmentation fault (core dumped)  htop

eval-exec avatar Dec 20 '22 13:12 eval-exec

$ uname -a
Linux Mufasa 6.0.12-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 08 Dec 2022 11:03:38 +0000 x86_64 GNU/Linux
$ htop --version
htop 3.2.1
$ lsb_release -a
LSB Version:    n/a
Distributor ID: Arch
Description:    Arch Linux
Release:        rolling
Codename:       n/a


My htoprc is htoprc.txt

eval-exec avatar Dec 20 '22 13:12 eval-exec

objdump file is attached here:

objdump -d -S -w `which htop` > ~/htop.objdump

htop.objdump.tar.gz

eval-exec avatar Dec 20 '22 14:12 eval-exec

Maybe your glibc trips on these calculations?

https://github.com/htop-dev/htop/blob/4e6ec4a0873c56ca9de63eadf730c5bd677bd8da/Process.c#L1277

Although percentage should be a sane value:

https://github.com/htop-dev/htop/blob/4e6ec4a0873c56ca9de63eadf730c5bd677bd8da/linux/LinuxProcessList.c#L1599-L1603

Is it always reproducible (in particular on an idle system)?

Could you try to reproduce under gdb?

cgzones avatar Dec 22 '22 21:12 cgzones

Is it always reproducible (in particular on an idle system)?

No, it rarely happens.

Could you try to reproduce under gdb?

It's hard to reproduce this bug, but if I do, I'll let you know.

eval-exec avatar Dec 23 '22 05:12 eval-exec

Two attempts to add a third screen generated these backtrace and objdumps

  • Your htop version: '3.4.1-3.4.1'
  • Your OS and kernel version (uname -a) Linux dad-B650-GAMING-X-AX-UbuntuStudio 6.14.0-32-generic #32-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 29 14:21:26 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
  • Your distribution and release (lsb_release -a) No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 25.04 Release: 25.04 Codename: plucky
  • Likely steps to reproduce (How did it happen?) While in settings->Screen tried adding new screen
  • Backtrace of the issue (see below)

Error information:

A signal 11 (Segmentation fault) was received.

Setting information:

htop_version=3.4.1-3.4.1;config_reader_min_version=3;fields=0 48 17 18 38 39 40 2 46 47 49 1;hide_kernel_threads=1;hide_userland_threads=0;hide_running_in_container=0;shadow_other_users=0;show_thread_names=1;show_program_path=1;highlight_base_name=1;highlight_deleted_exe=1;shadow_distribution_path_prefix=0;highlight_megabytes=1;highlight_threads=1;highlight_changes=1;highlight_changes_delay_secs=5;find_comm_in_cmdline=1;strip_exe_from_cmdline=1;show_merged_command=1;header_margin=1;screen_tabs=1;detailed_cpu_time=1;cpu_count_from_one=1;show_cpu_usage=1;show_cpu_frequency=1;show_cpu_temperature=0;degree_fahrenheit=0;show_cached_memory=1;update_process_names=1;account_guest_in_cpu_meter=1;color_scheme=0;enable_mouse=1;delay=15;hide_function_bar=0;header_layout=two_50_50;column_meters_0=LeftCPUs2 Memory Swap;column_meter_modes_0=1 1 1;column_meters_1=RightCPUs2 Tasks LoadAverage Uptime;column_meter_modes_1=1 2 2 2;tree_view=1;sort_key=47;tree_sort_key=0;sort_direction=-1;tree_sort_direction=1;tree_view_always_by_pid=1;all_branches_collapsed=1;screen:Main=PID USER PRIORITY NICE M_VIRT M_RESIDENT M_SHARE STATE PERCENT_CPU PERCENT_MEM TIME Command;.sort_key=PERCENT_MEM;.tree_sort_key=PID;.tree_view_always_by_pid=1;.tree_view=1;.sort_direction=-1;.tree_sort_direction=1;.all_branches_collapsed=1;screen:I/O=PID USER IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE PERCENT_SWAP_DELAY PERCENT_IO_DELAY Command;.sort_key=IO_RATE;.tree_sort_key=PID;.tree_view_always_by_pid=0;.tree_view=0;.sort_direction=-1;.tree_sort_direction=1;.all_branches_collapsed=0;

Backtrace information:

/snap/htop/5181/usr/local/bin/htop(CRT_handleSIGSEGV+0x127)[0x5d41a33fa0b7] /lib/x86_64-linux-gnu/libc.so.6(+0x45330)[0x7dd845602330] /snap/htop/5181/usr/local/bin/htop(+0x2b3de)[0x5d41a340b3de] /snap/htop/5181/usr/local/bin/htop(ScreenManager_run+0x2ab)[0x5d41a340a43b] /snap/htop/5181/usr/local/bin/htop(+0x13f37)[0x5d41a33f3f37] /snap/htop/5181/usr/local/bin/htop(+0x1f642)[0x5d41a33ff642] /snap/htop/5181/usr/local/bin/htop(ScreenManager_run+0x2ab)[0x5d41a340a43b] /snap/htop/5181/usr/local/bin/htop(CommandLine_run+0x7d8)[0x5d41a33f8658] /lib/x86_64-linux-gnu/libc.so.6(+0x2a1ca)[0x7dd8455e71ca] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x8b)[0x7dd8455e728b] /snap/htop/5181/usr/local/bin/htop(_start+0x25)[0x5d41a33f37e5]

To make the above information more practical to work with, please also provide a disassembly of your htop binary. This can usually be done by running the following command:

objdump -d -S -w which htop > ~/htop.objdump

Second crash after trying to add new screen a second time. Error information:

A signal 11 (Segmentation fault) was received.

Setting information:

htop_version=3.4.1-3.4.1;config_reader_min_version=3;fields=0 48 17 18 38 39 40 2 46 47 49 1;hide_kernel_threads=1;hide_userland_threads=0;hide_running_in_container=0;shadow_other_users=0;show_thread_names=0;show_program_path=1;highlight_base_name=0;highlight_deleted_exe=1;shadow_distribution_path_prefix=0;highlight_megabytes=1;highlight_threads=1;highlight_changes=0;highlight_changes_delay_secs=5;find_comm_in_cmdline=1;strip_exe_from_cmdline=1;show_merged_command=0;header_margin=1;screen_tabs=1;detailed_cpu_time=0;cpu_count_from_one=0;show_cpu_usage=1;show_cpu_frequency=0;show_cpu_temperature=0;degree_fahrenheit=0;show_cached_memory=1;update_process_names=0;account_guest_in_cpu_meter=0;color_scheme=0;enable_mouse=1;delay=15;hide_function_bar=0;header_layout=two_50_50;column_meters_0=LeftCPUs2 Memory Swap;column_meter_modes_0=1 1 1;column_meters_1=RightCPUs2 Tasks LoadAverage Uptime;column_meter_modes_1=1 2 2 2;tree_view=0;sort_key=46;tree_sort_key=0;sort_direction=-1;tree_sort_direction=1;tree_view_always_by_pid=0;all_branches_collapsed=0;screen:Main=PID USER PRIORITY NICE M_VIRT M_RESIDENT M_SHARE STATE PERCENT_CPU PERCENT_MEM TIME Command;.sort_key=PERCENT_CPU;.tree_sort_key=PID;.tree_view_always_by_pid=0;.tree_view=0;.sort_direction=-1;.tree_sort_direction=1;.all_branches_collapsed=0;screen:I/O=PID USER IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE PERCENT_SWAP_DELAY PERCENT_IO_DELAY Command;.sort_key=IO_RATE;.tree_sort_key=PID;.tree_view_always_by_pid=0;.tree_view=0;.sort_direction=-1;.tree_sort_direction=1;.all_branches_collapsed=0;

Backtrace information:

/snap/htop/5181/usr/local/bin/htop(CRT_handleSIGSEGV+0x127)[0x5b48794390b7] /lib/x86_64-linux-gnu/libc.so.6(+0x45330)[0x7e35718b8330] /snap/htop/5181/usr/local/bin/htop(+0x2b3de)[0x5b487944a3de] /snap/htop/5181/usr/local/bin/htop(ScreenManager_run+0x2ab)[0x5b487944943b] /snap/htop/5181/usr/local/bin/htop(+0x13f37)[0x5b4879432f37] /snap/htop/5181/usr/local/bin/htop(+0x1f642)[0x5b487943e642] /snap/htop/5181/usr/local/bin/htop(ScreenManager_run+0x2ab)[0x5b487944943b] /snap/htop/5181/usr/local/bin/htop(CommandLine_run+0x7d8)[0x5b4879437658] /lib/x86_64-linux-gnu/libc.so.6(+0x2a1ca)[0x7e357189d1ca] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x8b)[0x7e357189d28b] /snap/htop/5181/usr/local/bin/htop(_start+0x25)[0x5b48794327e5]

attached is htop.objdump.tar.gz

kenmac999 avatar Oct 03 '25 05:10 kenmac999

There was a bug reported recently, that changing the existing CPU count on-the-fly (i.e. change number of CPUs in a VM), can cause crashes. Will have to look into the crash dumps, if these are related though.

Edit: The object dump seems to cover the snap loader executable instead of the actual htop binary. Please try to run a native version.

Edit 2: @kenmac999 Can you take a look at the branch screen-edit-fixes and report back if this fixes your issue? AFAICS your reports are likely unrelated to the original crash.

BenBE avatar Oct 03 '25 14:10 BenBE