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

Segmentation fault when toggling threads visibility while paused #1517

Closed
SpaghettiBorgar opened this issue Aug 14, 2024 · 2 comments · Fixed by #1519
Closed

Segmentation fault when toggling threads visibility while paused #1517

SpaghettiBorgar opened this issue Aug 14, 2024 · 2 comments · Fixed by #1519
Labels
bug 🐛 Something isn't working
Milestone

Comments

@SpaghettiBorgar
Copy link

Making process threads visible while process updates are paused causes a crash if tree view is enabled.
Other permutations of the steps seems to result in the same issue.

Version: 3.4.0-dev-3.3.0-179-g59578af
Linux arch 6.10.2-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Sat, 27 Jul 2024 16:49:32 +0000 x86_64 GNU/Linux

Steps to reproduce:

  1. make sure process threads are hidden
  2. Open tree view (F5)
  3. Pause process updates (Shift+Z)
  4. Show process threads (Shift+H)
Backtrace information:
----------------------
 0: 0x59ae5f4116a8  ./htop  (CRT_handleSIGSEGV+0xf6)  [0x59ae5f4116a8]
 1: 0x708ab81691d0  /usr/lib/libc.so.6  (+0)  [0x708ab81691cf]  {signal frame}
 2: 0x59ae5f418f86  ./htop  (Object_isA+0x12)  [0x59ae5f418f86]
 3: 0x59ae5f428aec  ./htop  (Vector_get+0x2a)  [0x59ae5f428aec]
 4: 0x59ae5f427838  ./htop  (Table_rebuildPanel+0xc2)  [0x59ae5f427838]
 5: 0x59ae5f421ee9  ./htop  (checkRecalculation+0x138)  [0x59ae5f421ee9]
 6: 0x59ae5f42265f  ./htop  (ScreenManager_run+0xba)  [0x59ae5f42265f]
 7: 0x59ae5f40f74e  ./htop  (CommandLine_run+0x2e3)  [0x59ae5f40f74e]
 8: 0x59ae5f40ad42  ./htop  (main+0x9)  [0x59ae5f40ad42]
 9: 0x708ab8151e08  /usr/lib/libc.so.6  (+0)  [0x708ab8151d90]
10: 0x708ab8151ecc  /usr/lib/libc.so.6  (__libc_start_main+0x8c)  [0x708ab8151ecc]
11: 0x59ae5f40ac65  ./htop  (_start+0x25)  [0x59ae5f40ac65]
@natoscott
Copy link
Member

I poked at it for awhile but haven't been able to get to the root cause so far. Valgrind suggests it relates to a process/thread that has been deleted (exited) and is removed from the Table hash but still exists in the displayList somehow.

==3122235== Invalid read of size 8
==3122235==    at 0x42B004: Table_rebuildPanel (Table.c:258)
==3122235==    by 0x42592B: checkRecalculation (ScreenManager.c:156)
==3122235==    by 0x42613B: ScreenManager_run (ScreenManager.c:247)
==3122235==    by 0x4154B7: CommandLine_run (CommandLine.c:407)
==3122235==    by 0x410CF7: main (htop.c:17)
==3122235==  Address 0x1330f040 is 0 bytes inside a block of size 808 free'd
==3122235==    at 0x48C3AAC: free (vg_replace_malloc.c:989)
==3122235==    by 0x430BDF: Process_delete (LinuxProcess.c:134)
==3122235==    by 0x42C33B: Vector_softRemove (Vector.c:268)
==3122235==    by 0x42ADB3: Table_removeIndex (Table.c:79)
==3122235==    by 0x42B313: Table_cleanupRow (Table.c:348)
==3122235==    by 0x4233DF: ProcessTable_cleanupEntries (ProcessTable.c:77)
==3122235==    by 0x41B3C7: Machine_scanTables (Machine.c:125)
==3122235==    by 0x4115F7: actionToggleUserlandThreads (Action.c:250)
==3122235==    by 0x41B7E3: MainPanel_eventHandler (MainPanel.c:116)
==3122235==    by 0x4263DF: ScreenManager_run (ScreenManager.c:334)
==3122235==    by 0x4154B7: CommandLine_run (CommandLine.c:407)
==3122235==    by 0x410CF7: main (htop.c:17)
==3122235==  Block was alloc'd at
==3122235==    at 0x48C7BAC: calloc (vg_replace_malloc.c:1675)
==3122235==    by 0x42C747: xCalloc (XUtils.c:57)
==3122235==    by 0x43178F: LinuxProcess_new (LinuxProcess.c:118)
==3122235==    by 0x4234F7: ProcessTable_getProcess (ProcessTable.c:39)
==3122235==    by 0x433AF3: LinuxProcessTable_recurseProcTree (LinuxProcessTable.c:1507)
==3122235==    by 0x433B2F: LinuxProcessTable_recurseProcTree (LinuxProcessTable.c:1514)
==3122235==    by 0x43449B: ProcessTable_goThroughEntries (LinuxProcessTable.c:1834)
==3122235==    by 0x42343F: ProcessTable_iterateEntries (ProcessTable.c:59)
==3122235==    by 0x41B3B3: Machine_scanTables (Machine.c:122)
==3122235==    by 0x41547B: CommandLine_run (CommandLine.c:399)
==3122235==    by 0x410CF7: main (htop.c:17)

@cgzones
Copy link
Member

cgzones commented Aug 14, 2024

Should be addressed by #1519; thanks for reporting!

@BenBE BenBE added this to the 3.4.0 milestone Aug 14, 2024
@BenBE BenBE added the bug 🐛 Something isn't working label Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants