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

jwm -p option segfaults #563

Closed
01micko opened this issue May 9, 2022 · 10 comments
Closed

jwm -p option segfaults #563

01micko opened this issue May 9, 2022 · 10 comments
Milestone

Comments

@01micko
Copy link
Contributor

01micko commented May 9, 2022

release 2.4.1.

I can't see anything in the commit log that would fix it since February release.

~$ dmesg | tail -n 6
[ 1554.005169] jwm[31592]: segfault at 10 ip 000000000040f218 sp 00007ffed5ac9620 error 4 in jwm[406000+25000]
[ 1554.005187] Code: 01 00 00 41 89 df 8d 83 00 01 00 00 44 39 e8 76 ce eb b9 0f 1f 80 00 00 00 00 31 c0 31 d2 e9 3b ff ff ff 48 8b 05 28 b8 02 00 <8b> 78 10 e8 d0 7d ff ff 8b 7c 24 18 e8 c7 7d ff ff 8b 7c 24 1c be
[ 1710.878069] jwm[31993]: segfault at 10 ip 000000000040f218 sp 00007fff8049c770 error 4 in jwm[406000+25000]
[ 1710.878086] Code: 01 00 00 41 89 df 8d 83 00 01 00 00 44 39 e8 76 ce eb b9 0f 1f 80 00 00 00 00 31 c0 31 d2 e9 3b ff ff ff 48 8b 05 28 b8 02 00 <8b> 78 10 e8 d0 7d ff ff 8b 7c 24 18 e8 c7 7d ff ff 8b 7c 24 1c be
[ 1730.998025] jwm[32036]: segfault at 10 ip 000000000040f218 sp 00007fffdbee86f0 error 4 in jwm[406000+25000]
[ 1730.998042] Code: 01 00 00 41 89 df 8d 83 00 01 00 00 44 39 e8 76 ce eb b9 0f 1f 80 00 00 00 00 31 c0 31 d2 e9 3b ff ff ff 48 8b 05 28 b8 02 00 <8b> 78 10 e8 d0 7d ff ff 8b 7c 24 18 e8 c7 7d ff ff 8b 7c 24 1c be

Every time I run jwm -p it hangs. I have to ctrl-C to bail and I see a new dmesg error each time as noted above. Do you need a debug build test?

Thanks for looking.

@joewing
Copy link
Owner

joewing commented May 9, 2022

Unfortunately, I don't think there's enough information in that for me to do anything with. jwm -p runs ok for me, so I'm guessing it's something specific to your configuration maybe? If you could attach a debugger and get me a backtrace from a debug build that would be helpful. Or if you could somehow find a minimal change from the example configuration that causes the issue.

@01micko
Copy link
Contributor Author

01micko commented May 10, 2022

Hi @joewing and thank you for the response.

There definitely is things wrong with my configuration as I just upgraded from 2.3.7 to 2.4.1. However I don't think there is too much to cause a segfault. The whole point of me running jwm -p was to have a quick look at errors in the config and fix them. I still think it's a bug

I don't think there's enough information in that for me to do anything with.

Of course. When I get time I'll do a debug build and a backtrace with gdb. I actually just learnt how to do this remotely debugging a segfault in labwc (issue 194)

@joewing
Copy link
Owner

joewing commented May 10, 2022

Thanks for looking into it.

It's almost certainly a JWM bug as it shouldn't be possible to cause a crash. What I meant to say is that being configuration related, it might be possible to provide me with a self-contained configuration so that I can reproduce the problem locally.

@01micko
Copy link
Contributor Author

01micko commented May 11, 2022

So this is really interesting (interesting = strange)

I'll use dotpoints

  • kernel says there's a segfault (dmesg)
[  935.677788] Code: c0 0f 8e 2c 01 00 00 41 89 df 8d 83 00 01 00 00 44 39 e8 76 ce eb af 0f 1f 00 31 c0 31 d2 e9 2b ff ff ff 48 8b 05 40 f8 02 00 <8b> 78 10 e8 30 6d ff ff 8b 7c 24 18 e8 27 6d ff ff 8b 7c 24 1c be
[  995.738476] jwm[15202]: segfault at 10 ip 00000000004102f8 sp 00007fff76869170 error 4 in jwm[406000+2a000]
[  995.738495] Code: c0 0f 8e 2c 01 00 00 41 89 df 8d 83 00 01 00 00 44 39 e8 76 ce eb af 0f 1f 00 31 c0 31 d2 e9 2b ff ff ff 48 8b 05 40 f8 02 00 <8b> 78 10 e8 30 6d ff ff 8b 7c 24 18 e8 27 6d ff ff 8b 7c 24 1c be
[ 1055.798961] jwm[15325]: segfault at 10 ip 00000000004102f8 sp 00007fff76869170 error 4 in jwm[406000+2a000]
[ 1055.798979] Code: c0 0f 8e 2c 01 00 00 41 89 df 8d 83 00 01 00 00 44 39 e8 76 ce eb af 0f 1f 00 31 c0 31 d2 e9 2b ff ff ff 48 8b 05 40 f8 02 00 <8b> 78 10 e8 30 6d ff ff 8b 7c 24 18 e8 27 6d ff ff 8b 7c 24 1c be
[ 1115.859932] jwm[15446]: segfault at 10 ip 00000000004102f8 sp 00007fff76869170 error 4 in jwm[406000+2a000]
[ 1115.859955] Code: c0 0f 8e 2c 01 00 00 41 89 df 8d 83 00 01 00 00 44 39 e8 76 ce eb af 0f 1f 00 31 c0 31 d2 e9 2b ff ff ff 48 8b 05 40 f8 02 00 <8b> 78 10 e8 30 6d ff ff 8b 7c 24 18 e8 27 6d ff ff 8b 7c 24 1c be
[ 1175.897096] jwm[15746]: segfault at 10 ip 00000000004102f8 sp 00007fff76869170 error 4 in jwm[406000+2a000]
[ 1175.897117] Code: c0 0f 8e 2c 01 00 00 41 89 df 8d 83 00 01 00 00 44 39 e8 76 ce eb af 0f 1f 00 31 c0 31 d2 e9 2b ff ff ff 48 8b 05 40 f8 02 00 <8b> 78 10 e8 30 6d ff ff 8b 7c 24 18 e8 27 6d ff ff 8b 7c 24 1c be

  • jwm does not crash - kernel says there's a segfault
  • jwm is compiled with debuging and attaching gdb to the running process says so
  • notice how these little 'crashes' occur almost every 60 seconds; ~150 milliseconds over
~$ gdb -p `pidof jwm`  
GNU gdb (GDB) 11.2
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-slackware-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 9286
Reading symbols from /usr/bin/jwm...
Reading symbols from /usr/lib64/libX11.so.6...
(No debugging symbols found in /usr/lib64/libX11.so.6)
Reading symbols from /usr/lib64/libpng16.so.16...
.. and so on
  • and output of jwm -restart ; jwm -p
~$ jwm -restart
DEBUG: main.c[116]: debug mode started
DEBUG: main.c[235]: debug mode stopped
DEBUG: MEMORY: no memory leaks
~$ jwm -p
DEBUG: main.c[116]: debug mode started
JWM: warning: timeout: /root/.jwm/root_menus/menu1 did not complete in 60000 milliseconds
JWM: warning: $HOME/.jwmrc[15]: invalid include: exec:$HOME/.jwm/root_menus/menu1
JWM: warning: timeout: /root/.jwm/root_menus/menu2 did not complete in 60000 milliseconds
JWM: warning: $HOME/.jwmrc[16]: invalid include: exec:$HOME/.jwm/root_menus/menu2
JWM: warning: timeout: /root/.jwm/root_menus/menu3 did not complete in 60000 milliseconds
JWM: warning: $HOME/.jwmrc[17]: invalid include: exec:$HOME/.jwm/root_menus/menu3
JWM: warning: timeout: /root/.jwm/root_menus/menu4 did not complete in 60000 milliseconds
JWM: warning: $HOME/.jwmrc[18]: invalid include: exec:$HOME/.jwm/root_menus/menu4
JWM: warning: timeout: /root/.jwm/root_menus/menu5 did not complete in 60000 milliseconds
JWM: warning: $HOME/.jwmrc[19]: invalid include: exec:$HOME/.jwm/root_menus/menu5
JWM: warning: timeout: /usr/local/jwm_config/menu_build_bookmarks did not complete in 60000 milliseconds
JWM: warning: $HOME/.jwmrc[22]: invalid include: exec:/usr/local/jwm_config/menu_build_bookmarks
JWM: warning: timeout: /usr/local/jwm_config/menu_build_clock did not complete in 60000 milliseconds
JWM: warning: $HOME/.jwmrc[23]: invalid include: exec:/usr/local/jwm_config/menu_build_clock
JWM: warning: timeout: /usr/local/jwm_config/menu_build_places did not complete in 60000 milliseconds
JWM: warning: $HOME/.jwmrc[24]: invalid include: exec:/usr/local/jwm_config/menu_build_places
DEBUG: main.c[235]: debug mode stopped
DEBUG: MEMORY: no memory leaks

I'm typing this from the "bad" install right now, a pristine puppy, like I have been building for years on bare metal. (ryzen, amd graphics lots of RAM - usb install). ALL the menus work as expected!

Most (if not all) of these are dynamic. I noticed some trouble in previous jwm issues in this repo with dynamic menus.

As I can't cause a crash I can't give a backtrace. Been running near an hour now. 😕

Thanks for taking a look Joe.

@joewing
Copy link
Owner

joewing commented May 11, 2022

I think what's happening is that JWM is killing subprocesses which the kernel is reporting as a segfault in JWM. As of 2.4, JWM gives subprocesses used for menu/config generation a timeout so they don't stall forever (it looks like JWM is just going through and killing a bunch of different menu generation programs).
So it could be that something is wrong with they way that works for jwm -p or that the menu generation scripts don't return in this case, what happens if you run the menu generation scripts directly?

@01micko
Copy link
Contributor Author

01micko commented May 11, 2022

Each program completes in a matter milliseconds, all with start and end <JWM>...</JWM> tags.

Only one shows a bad config (which can be easy fixed). You can see the scripts here.

/usr/local/jwm_config$ ./menu_build_none 
<?xml version="1.0"?>
<JWM></JWM>
/usr/local/jwm_config$ ./menu_build_places

<JWM>
	<Program label="Home" icon="/usr/local/lib/X11/pixmaps/home48.png">rox $HOME</Program>
	<Program label="System" icon="/usr/local/lib/X11/pixmaps/pc48.png">rox /</Program>
	<Program label="Network" icon="/usr/local/lib/X11/pixmaps/connect48.png">rox $HOME/network</Program>
<Program label="Downloads" icon="/usr/local/lib/X11/pixmaps/folder48.png">rox $HOME/Downloads</Program>
<Separator/>
	<Dynamic label="Drives" icon="/usr/local/lib/X11/pixmaps/drive48.png">exec:/usr/local/jwm_config/menu_build_places_drives</Dynamic>
	<Dynamic label="Recently used" icon="file.svg">exec:/usr/local/jwm_config/menu_build_recent_docs</Dynamic>
	<Separator/>
	<Program label="Web" icon="/usr/local/lib/X11/pixmaps/www48.png">defaultbrowser</Program>
	<Program label="Help" icon="/usr/local/lib/X11/pixmaps/help48.png">/usr/sbin/puppyhelp</Program>
</JWM>
/usr/local/jwm_config$ ./menu_build_places_drives 
<JWM>
grep: /root/.usb-drive-log-probedisk: No such file or directory
<Program label="nvme0n1p1   ext4   WDC WDS500G2B0C-00PXH0                  " icon="/usr/local/lib/X11/pixmaps/drive48.png">/tmp/pup_event_frontend/drive_nvme0n1p1/AppRun</Program>
grep: /root/.usb-drive-log-probedisk: No such file or directory
<Program label="sda1   vfat   ST1000DM010-2EP1" icon="/usr/local/lib/X11/pixmaps/drive48.png">/tmp/pup_event_frontend/drive_sda1/AppRun</Program>
grep: /root/.usb-drive-log-probedisk: No such file or directory
<Program label="sda2   ext4   ST1000DM010-2EP1" icon="/usr/local/lib/X11/pixmaps/drive48.png">/tmp/pup_event_frontend/drive_sda2/AppRun</Program>
grep: /root/.usb-drive-log-probedisk: No such file or directory
<Program label="sda3   ext4   ST1000DM010-2EP1" icon="/usr/local/lib/X11/pixmaps/drive48.png">/tmp/pup_event_frontend/drive_sda3/AppRun</Program>
grep: /root/.usb-drive-log-probedisk: No such file or directory
<Program label="sda4   ext4   ST1000DM010-2EP1" icon="/usr/local/lib/X11/pixmaps/drive48.png">/tmp/pup_event_frontend/drive_sda4/AppRun</Program>
grep: /root/.usb-drive-log-probedisk: No such file or directory
<Program label="sda5   ext4   ST1000DM010-2EP1" icon="/usr/local/lib/X11/pixmaps/drive48.png">/tmp/pup_event_frontend/drive_sda5/AppRun</Program>
grep: /root/.usb-drive-log-probedisk: No such file or directory
<Program label="sda6   ext4   ST1000DM010-2EP1" icon="/usr/local/lib/X11/pixmaps/drive48.png">/tmp/pup_event_frontend/drive_sda6/AppRun</Program>
grep: /root/.usb-drive-log-probedisk: No such file or directory
<Program label="sdc1   ntfs   Expansion Desk  " icon="/usr/local/lib/X11/pixmaps/drive48.png">/tmp/pup_event_frontend/drive_sdc1/AppRun</Program>
grep: /root/.usb-drive-log-probedisk: No such file or directory
<Program label="sdc2   ext4   Expansion Desk  " icon="/usr/local/lib/X11/pixmaps/drive48.png">/tmp/pup_event_frontend/drive_sdc2/AppRun</Program>
grep: /root/.usb-drive-log-probedisk: No such file or directory
</JWM>
/usr/local/jwm_config$ ./menu_build_bookmarks 
<?xml version="1.0"?>
<JWM>

<Program label="/mnt/home homedrive" icon="file.svg">exec rox "/mnt/home homedrive"</Program>
<Separator/>
<Program icon="bookmark.svg" label="Edit Bookmarks">exec /usr/local/jwm_config/menu -bookmarks</Program>
</JWM>
/usr/local/jwm_config$ ./menu_build_clock

<JWM>
	<Program label="Set time and date" icon="/usr/share/pixmaps/puppy/date_time.svg">set-time-for-puppy</Program>
	<Program label="Clock format" icon="/usr/share/pixmaps/puppy/clock.svg">/usr/local/jwm_config/tray -clock</Program>
	<Program label="Set timezone" icon="/usr/share/pixmaps/puppy/country_timezone.svg">timezone-set</Program>
	<Separator/>
<Program label="Calendar" icon="/usr/share/pixmaps/puppy/calendar.svg">minixcal</Program>
<Program label="Task sheduler" icon="/usr/share/pixmaps/puppy/clock_interval.svg">pschedule</Program>
</JWM>

joewing added a commit that referenced this issue May 13, 2022
@joewing
Copy link
Owner

joewing commented May 13, 2022

Thanks for helping me narrow it down! I think I'm able to reproduce what you're seeing. I just pushed a commit that appears to fix it for me.
EDIT: that commit just breaks it in a different way... still working on a fix

joewing added a commit that referenced this issue May 13, 2022
@joewing
Copy link
Owner

joewing commented May 13, 2022

Hopefully that last commit fixes it.

@01micko
Copy link
Contributor Author

01micko commented May 13, 2022

Great! I'll do a build and test. Thanks!

EDIT: had to disable nls because of syntax errors in pt_BR translation and my build system flat refused to ignore!

@01micko
Copy link
Contributor Author

01micko commented May 13, 2022

Well, thanks Joe! All fixed and as it happens, my configs are perfect 😄

@01micko 01micko closed this as completed May 13, 2022
@joewing joewing added this to the Version 2.4.2 milestone May 13, 2022
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