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

__pthread_tpp_change_priority: Assertion failed #345

Closed
raboof opened this issue Jul 30, 2022 · 10 comments
Closed

__pthread_tpp_change_priority: Assertion failed #345

raboof opened this issue Jul 30, 2022 · 10 comments

Comments

@raboof
Copy link
Owner

raboof commented Jul 30, 2022

originally reported at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1016363#15

notion 4.0.2+dfsg-6 with libx11-6 2:1.8.1-1 crashes with this message:

  notion: tpp.c:82: __pthread_tpp_change_priority: Assertion `new_prio == -1 || (new_prio >= fifo_min_prio && new_prio <= fifo_max_prio)' failed.

Rebuilding libx11 with the new --disable-thread-safety-constructor flag reportedly makes notion work again.

@raboof
Copy link
Owner Author

raboof commented Jul 31, 2022

inconvenient day for https://gitlab.freedesktop.org to be down 😆

raboof added a commit to raboof/nixpkgs that referenced this issue Aug 1, 2022
@raboof
Copy link
Owner Author

raboof commented Aug 1, 2022

I linked notion to libX11 1.8.1 in raboof/nixpkgs@bb8ba82 but that did not reproduce the problem.

Verified it does link to libX11 1.8.1:

ldd /nix/store/88yv92n0x32z7
7ifs678qf10ki2i0qn0-notion-4.0.2/bin/.notion-wrapped
	linux-vdso.so.1 (0x00007ffddb0e9000)
	libX11.so.6 => /nix/store/5p8aiag8knq7bp7x5gvv6srf0k3n7rqa-libX11-1.8.1/lib/libX11.so.6 (0x00007fde9a59d000)
	libXext.so.6 => /nix/store/x0cpggi73rhsm6cwfl9r8q0qvzx72ysl-libXext-1.3.4/lib/libXext.so.6 (0x00007fde9a588000)
	liblua.so.5.2 => /nix/store/67dsy6ca9cmf82d4sax2xhig7wxmqw10-lua-5.2.4/lib/liblua.so.5.2 (0x00007fde9a550000)
	libm.so.6 => /nix/store/mhhlymrg2m70r8h94cwhv2d7a0c8l7g6-glibc-2.34-210/lib/libm.so.6 (0x00007fde9a477000)
	libc.so.6 => /nix/store/mhhlymrg2m70r8h94cwhv2d7a0c8l7g6-glibc-2.34-210/lib/libc.so.6 (0x00007fde9a277000)
	libxcb.so.1 => /nix/store/dy7i1aqsf0rfm91bcif0z5m9zg6clmd7-libxcb-1.14/lib/libxcb.so.1 (0x00007fde9a24c000)
	libdl.so.2 => /nix/store/mhhlymrg2m70r8h94cwhv2d7a0c8l7g6-glibc-2.34-210/lib/libdl.so.2 (0x00007fde9a247000)
	libreadline.so.6 => /nix/store/4cg6k2d48ym4jqp4py9vdy3rqy5hw4s4-readline-6.3p08/lib/libreadline.so.6 (0x00007fde9a1fd000)
	libncursesw.so.6 => /nix/store/pkv4ngqc7arfqpr1bsn1bappvms9xbfg-ncurses-6.3-p20220507/lib/libncursesw.so.6 (0x00007fde9a186000)
	/nix/store/mhhlymrg2m70r8h94cwhv2d7a0c8l7g6-glibc-2.34-210/lib/ld-linux-x86-64.so.2 => /nix/store/mhhlymrg2m70r8h94cwhv2d7a0c8l7g6-glibc-2.34-210/lib64/ld-linux-x86-64.so.2 (0x00007fde9a6e5000)
	libXau.so.6 => /nix/store/7xrnhzflapyl0vgj6n3vsjppwm7ls747-libXau-1.0.9/lib/libXau.so.6 (0x00007fde9a181000)
	libXdmcp.so.6 => /nix/store/1rqksyzxkl81r4703m6a0gns5pjc5njs-libXdmcp-1.1.3/lib/libXdmcp.so.6 (0x00007fde9a179000)

... but works normally.

Can anyone reproduce this and provide a backtrace?

@raboof
Copy link
Owner Author

raboof commented Aug 1, 2022

/cc @weinholt

@weinholt
Copy link

weinholt commented Aug 1, 2022

Here's the backtrace. I noticed now that it doesn't crash like this every time, but when it doesn't crash it instead hides all windows and doesn't respond to any commands.

warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
notion: tpp.c:82: __pthread_tpp_change_priority: Assertion `new_prio == -1 || (new_prio >= fifo_min_prio && new_prio <= fifo_max_prio)' failed.

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
49	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
=> 0x00007ffff7b198c1 <__GI_raise+321>:	48 8b 84 24 08 01 00 00	mov    rax,QWORD PTR [rsp+0x108]
   0x00007ffff7b198c9 <__GI_raise+329>:	64 48 2b 04 25 28 00 00 00	sub    rax,QWORD PTR fs:0x28
   0x00007ffff7b198d2 <__GI_raise+338>:	75 20	jne    0x7ffff7b198f4 <__GI_raise+372>
   0x00007ffff7b198d4 <__GI_raise+340>:	44 89 c0	mov    eax,r8d
   0x00007ffff7b198d7 <__GI_raise+343>:	48 81 c4 18 01 00 00	add    rsp,0x118
   0x00007ffff7b198de <__GI_raise+350>:	c3	ret    
   0x00007ffff7b198df <__GI_raise+351>:	90	nop
(gdb) set print elements 100
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
#1  0x00007ffff7b03546 in __GI_abort () at abort.c:79
#2  0x00007ffff7b0342f in __assert_fail_base (fmt=0x7ffff7c79fb8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7ffff77a21b0 "new_prio == -1 || (new_prio >= fifo_min_prio && new_prio <= fifo_max_prio)", file=0x7ffff77a21a4 "tpp.c", line=82, function=<optimized out>) at assert.c:92
#3  0x00007ffff7b12242 in __GI___assert_fail (assertion=assertion@entry=0x7ffff77a21b0 "new_prio == -1 || (new_prio >= fifo_min_prio && new_prio <= fifo_max_prio)", file=file@entry=0x7ffff77a21a4 "tpp.c", line=line@entry=82, function=function@entry=0x7ffff77a2260 <__PRETTY_FUNCTION__.0> "__pthread_tpp_change_priority") at assert.c:101
#4  0x00007ffff779ee19 in __pthread_tpp_change_priority (previous_prio=previous_prio@entry=-1, new_prio=new_prio@entry=7929) at tpp.c:82
#5  0x00007ffff7795975 in __pthread_mutex_lock_full (mutex=0x5555555e3470) at ../nptl/pthread_mutex_lock.c:541
#6  0x00007ffff7e86968 in _XLockDisplay (dpy=0x5555555e5560) at ../../src/locking.c:466
#7  0x00007ffff7e838ad in XInternAtom (dpy=dpy@entry=0x5555555e5560, name=name@entry=0x7ffff7f738f8 "XDCCC_LINEAR_RGB_CORRECTION", onlyIfExists=onlyIfExists@entry=1) at ../../src/IntAtom.c:175
#8  0x00007ffff7ed8f98 in LINEAR_RGB_InitSCCData (dpy=0x5555555e5560, screenNumber=0, pPerScrnInfo=0x555555764bd0) at ../../../src/xcms/LRGB.c:467
#9  0x00007ffff7ee0e22 in _XcmsInitScrnInfo (dpy=0x5555555e5560, screenNumber=0) at ../../../src/xcms/cmsInt.c:333
#10 0x00007ffff7ed4a05 in XcmsDefaultCCC (dpy=dpy@entry=0x5555555e5560, screenNumber=screenNumber@entry=0) at ../../../src/xcms/CCC.c:237
#11 0x00007ffff7ed4a62 in XcmsCreateCCC (dpy=dpy@entry=0x5555555e5560, screenNumber=screenNumber@entry=0, visual=0x5555555f2ac0, clientWhitePt=clientWhitePt@entry=0x0, gamutCompProc=gamutCompProc@entry=0x0, gamutCompClientData=gamutCompClientData@entry=0x0, whitePtAdjProc=0x0, whitePtAdjClientData=0x0) at ../../../src/xcms/CCC.c:108
#12 0x00007ffff7edf675 in CmapRecForColormap (dpy=dpy@entry=0x5555555e5560, cmap=<optimized out>, cmap@entry=32) at ../../../src/xcms/cmsCmap.c:109
#13 0x00007ffff7edfafd in XcmsCCCOfColormap (dpy=dpy@entry=0x5555555e5560, cmap=cmap@entry=32) at ../../../src/xcms/cmsCmap.c:428
#14 0x00007ffff7e7d076 in XAllocNamedColor (dpy=0x5555555e5560, cmap=32, colorname=0x7ffff7a24114 "black", hard_def=0x7fffffffcd20, exact_def=0x7fffffffcd30) at ../../src/GetColor.c:59
#15 0x00007ffff77b1a6b in XftColorAllocName () from /usr/lib/x86_64-linux-gnu/libXft.so.2
#16 0x00007ffff7a2247b in de_alloc_colour (rootwin=<optimized out>, ret=<optimized out>, name=<optimized out>) at ./de/colour.c:18
#17 0x00007ffff7a234f8 in destyle_init (style=style@entry=0x55555575f2b0, rootwin=rootwin@entry=0x5555555c3d70, name=name@entry=0x7ffff7a2464c "*") at ./de/style.c:208
#18 0x00007ffff7a23669 in do_create_style (name=0x7ffff7a2464c "*", rootwin=0x5555555c3d70) at ./de/style.c:264
#19 de_create_style (rootwin=rootwin@entry=0x5555555c3d70, name=name@entry=0x7ffff7a2464c "*") at ./de/style.c:277
#20 0x00007ffff7a20592 in de_init () at ./de/init.c:442
#21 0x0000555555575497 in call_init (modulename=0x5555555c3fa0 "de", handle=0x55555575e140) at ./ioncore/modules.c:136
#22 try_load (file=0x5555555c38d0 "/usr/lib/notion/de.so", UNUSED_param=UNUSED_param@entry=0x0) at ./ioncore/modules.c:227
#23 0x0000555555595b3b in do_try (dir=dir@entry=0x55555563de60 "/usr/lib/notion", file=<optimized out>, tryfn=tryfn@entry=0x555555575255 <try_load>, tryfnparam=tryfnparam@entry=0x0) at ./libextl/readconfig.c:163
#24 0x0000555555595c92 in try_etcpath (files=files@entry=0x7fffffffcf68, tryfn=tryfn@entry=0x555555575255 <try_load>, tryfnparam=tryfnparam@entry=0x0) at ./libextl/readconfig.c:221
#25 0x00005555555961a5 in extl_try_config (fname=fname@entry=0x555555689728 "de", cfdir=cfdir@entry=0x0, tryfn=tryfn@entry=0x555555575255 <try_load>, tryfnparam=tryfnparam@entry=0x0, ext1=ext1@entry=0x5555555a0c71 "so", ext2=ext2@entry=0x0) at ./libextl/readconfig.c:334
#26 0x00005555555755bb in do_load_module (modname=0x555555689728 "de") at ./ioncore/modules.c:248
#27 ioncore_load_module (modname=modname@entry=0x555555689728 "de") at ./ioncore/modules.c:379
#28 0x0000555555587c5b in gr_select_engine (engine=0x555555689728 "de", engine@entry=<error reading variable: value has been optimized out>) at ./ioncore/gr.c:113
#29 0x0000555555592677 in l2chnd_b_s__ (fn=<optimized out>, in=<optimized out>, out=0x7fffffffd350) at ./ioncore/exports.c:142
#30 0x0000555555597ef4 in extl_l1_call_handler2 (st=0x5555555d3db8) at ./libextl/luaextl.c:1904
#31 0x00007ffff7e11d1f in luaD_precall (L=L@entry=0x5555555d3db8, func=0x5555556a9bd0, nresults=-1) at ./ldo.c:434
#32 0x00007ffff7e1209b in luaD_call (nResults=<optimized out>, func=<optimized out>, L=0x5555555d3db8) at ./ldo.c:498
#33 luaD_callnoyield (L=0x5555555d3db8, func=<optimized out>, nResults=<optimized out>) at ./ldo.c:509
#34 0x00007ffff7e1145f in luaD_rawrunprotected (L=L@entry=0x5555555d3db8, f=f@entry=0x7ffff7e0b070 <f_call>, ud=ud@entry=0x7fffffffd250) at ./ldo.c:142
#35 0x00007ffff7e1244b in luaD_pcall (L=L@entry=0x5555555d3db8, func=func@entry=0x7ffff7e0b070 <f_call>, u=u@entry=0x7fffffffd250, old_top=208, ef=<optimized out>) at ./ldo.c:729
#36 0x00007ffff7e0d65a in lua_pcallk (L=L@entry=0x5555555d3db8, nargs=nargs@entry=1, nresults=nresults@entry=-1, errfunc=errfunc@entry=0, ctx=ctx@entry=0, k=k@entry=0x0) at ./lapi.c:969
#37 0x0000555555598b6c in extl_l1_call_handler (st=0x5555555d3db8) at ./libextl/luaextl.c:1992
#38 0x00007ffff7e11d1f in luaD_precall (L=L@entry=0x5555555d3db8, func=func@entry=0x5555556a9bc0, nresults=nresults@entry=1) at ./ldo.c:434
#39 0x00007ffff7e1f381 in luaV_execute (L=L@entry=0x5555555d3db8) at ./lvm.c:1134
#40 0x00007ffff7e120d8 in luaD_call (nResults=1432174008, func=<optimized out>, L=0x5555555d3db8) at ./ldo.c:499
#41 luaD_callnoyield (L=L@entry=0x5555555d3db8, func=<optimized out>, nResults=nResults@entry=-1) at ./ldo.c:509
#42 0x00007ffff7e0d599 in lua_callk (L=L@entry=0x5555555d3db8, nargs=nargs@entry=0, nresults=nresults@entry=-1, ctx=ctx@entry=0, k=k@entry=0x0) at ./lapi.c:925
#43 0x00005555555970f9 in call_loaded (st=0x5555555d3db8) at ./libextl/luaextl.c:1655
#44 0x00007ffff7e11d1f in luaD_precall (L=L@entry=0x5555555d3db8, func=0x5555556a9ba0, nresults=0) at ./ldo.c:434
#45 0x00007ffff7e1209b in luaD_call (nResults=<optimized out>, func=<optimized out>, L=0x5555555d3db8) at ./ldo.c:498
#46 luaD_callnoyield (L=0x5555555d3db8, func=<optimized out>, nResults=<optimized out>) at ./ldo.c:509
#47 0x00007ffff7e1145f in luaD_rawrunprotected (L=L@entry=0x5555555d3db8, f=f@entry=0x7ffff7e0b070 <f_call>, ud=ud@entry=0x7fffffffd740) at ./ldo.c:142
#48 0x00007ffff7e1244b in luaD_pcall (L=L@entry=0x5555555d3db8, func=func@entry=0x7ffff7e0b070 <f_call>, u=u@entry=0x7fffffffd740, old_top=160, ef=<optimized out>) at ./ldo.c:729
#49 0x00007ffff7e0d65a in lua_pcallk (L=L@entry=0x5555555d3db8, nargs=nargs@entry=0, nresults=nresults@entry=0, errfunc=errfunc@entry=0, ctx=ctx@entry=0, k=k@entry=0x0) at ./lapi.c:969
#50 0x0000555555598508 in extl_dodo_call_vararg (param=0x7fffffffda40, st=0x5555555d3db8) at ./libextl/luaextl.c:1554
#51 extl_do_call_vararg (st=0x5555555d3db8, param=0x7fffffffda40) at ./libextl/luaextl.c:1598
#52 0x0000555555597526 in extl_docpcall (st=0x5555555d3db8) at ./libextl/luaextl.c:128
#53 0x00007ffff7e11d1f in luaD_precall (L=L@entry=0x5555555d3db8, func=0x5555556a9b80, nresults=0) at ./ldo.c:434
#54 0x00007ffff7e1209b in luaD_call (nResults=<optimized out>, func=<optimized out>, L=0x5555555d3db8) at ./ldo.c:498
#55 luaD_callnoyield (L=0x5555555d3db8, func=<optimized out>, nResults=<optimized out>) at ./ldo.c:509
#56 0x00007ffff7e1145f in luaD_rawrunprotected (L=L@entry=0x5555555d3db8, f=f@entry=0x7ffff7e0b070 <f_call>, ud=ud@entry=0x7fffffffd990) at ./ldo.c:142
#57 0x00007ffff7e1244b in luaD_pcall (L=L@entry=0x5555555d3db8, func=func@entry=0x7ffff7e0b070 <f_call>, u=u@entry=0x7fffffffd990, old_top=128, ef=<optimized out>) at ./ldo.c:729
#58 0x00007ffff7e0d65a in lua_pcallk (L=L@entry=0x5555555d3db8, nargs=nargs@entry=1, nresults=nresults@entry=0, errfunc=errfunc@entry=0, ctx=ctx@entry=0, k=k@entry=0x0) at ./lapi.c:969
#59 0x00005555555965da in extl_cpcall (st=0x5555555d3db8, fn=fn@entry=0x555555598412 <extl_do_call_vararg>, ptr=ptr@entry=0x7fffffffda40) at ./libextl/luaextl.c:149
#60 0x000055555559949e in extl_cpcall_call (fn=0x555555598412 <extl_do_call_vararg>, param=0x7fffffffda40, st=<optimized out>) at ./libextl/luaextl.c:1574
#61 extl_call_vararg (fnref=<optimized out>, spec=<optimized out>, rspec=<optimized out>, args=args@entry=0x7fffffffda90) at ./libextl/luaextl.c:1615
#62 0x00005555555995ae in extl_call (fnref=<optimized out>, spec=spec@entry=0x0, rspec=rspec@entry=0x0) at ./libextl/luaextl.c:1625
#63 0x0000555555595e0f in try_call (file=<optimized out>, param=0x7fffffffdcac) at ./libextl/readconfig.c:271
#64 try_call (file=<optimized out>, param=param@entry=0x7fffffffdcac) at ./libextl/readconfig.c:264
#65 0x0000555555595b3b in do_try (dir=dir@entry=0x55555575d460 "/etc/X11/notion", file=<optimized out>, tryfn=tryfn@entry=0x555555595df2 <try_call>, tryfnparam=tryfnparam@entry=0x7fffffffdcac) at ./libextl/readconfig.c:163
#66 0x0000555555595c92 in try_etcpath (files=files@entry=0x7fffffffdc38, tryfn=tryfn@entry=0x555555595df2 <try_call>, tryfnparam=tryfnparam@entry=0x7fffffffdcac) at ./libextl/readconfig.c:221
#67 0x00005555555961a5 in extl_try_config (fname=fname@entry=0x55555563ded8 "look_dusky", cfdir=cfdir@entry=0x55555575d368 "/home/weinholt/.notion/default-session--0", tryfn=tryfn@entry=0x555555595df2 <try_call>, tryfnparam=tryfnparam@entry=0x7fffffffdcac, ext1=ext1@entry=0x5555555a018d "lc", ext2=ext2@entry=0x5555555a4011 "lua") at ./libextl/readconfig.c:334
#68 0x00005555555962eb in extl_read_config (file=file@entry=0x55555563ded8 "look_dusky", sp=0x55555575d368 "/home/weinholt/.notion/default-session--0", warn_nx=warn_nx@entry=1) at ./libextl/readconfig.c:389
#69 0x000055555559773a in extl_dopath (st=0x5555555d3db8) at ./libextl/luaextl.c:447
#70 0x00007ffff7e11d1f in luaD_precall (L=L@entry=0x5555555d3db8, func=func@entry=0x5555556a9b50, nresults=nresults@entry=0) at ./ldo.c:434
#71 0x00007ffff7e1f381 in luaV_execute (L=L@entry=0x5555555d3db8) at ./lvm.c:1134
#72 0x00007ffff7e120d8 in luaD_call (nResults=1432174008, func=<optimized out>, L=0x5555555d3db8) at ./ldo.c:499
#73 luaD_callnoyield (L=L@entry=0x5555555d3db8, func=<optimized out>, nResults=nResults@entry=-1) at ./ldo.c:509
#74 0x00007ffff7e0d599 in lua_callk (L=L@entry=0x5555555d3db8, nargs=nargs@entry=0, nresults=nresults@entry=-1, ctx=ctx@entry=0, k=k@entry=0x0) at ./lapi.c:925
#75 0x00005555555970f9 in call_loaded (st=0x5555555d3db8) at ./libextl/luaextl.c:1655
#76 0x00007ffff7e11d1f in luaD_precall (L=L@entry=0x5555555d3db8, func=0x5555556a9b30, nresults=0) at ./ldo.c:434
#77 0x00007ffff7e1209b in luaD_call (nResults=<optimized out>, func=<optimized out>, L=0x5555555d3db8) at ./ldo.c:498
#78 luaD_callnoyield (L=0x5555555d3db8, func=<optimized out>, nResults=<optimized out>) at ./ldo.c:509
#79 0x00007ffff7e1145f in luaD_rawrunprotected (L=L@entry=0x5555555d3db8, f=f@entry=0x7ffff7e0b070 <f_call>, ud=ud@entry=0x7fffffffe0c0) at ./ldo.c:142
#80 0x00007ffff7e1244b in luaD_pcall (L=L@entry=0x5555555d3db8, func=func@entry=0x7ffff7e0b070 <f_call>, u=u@entry=0x7fffffffe0c0, old_top=48, ef=<optimized out>) at ./ldo.c:729
#81 0x00007ffff7e0d65a in lua_pcallk (L=L@entry=0x5555555d3db8, nargs=nargs@entry=0, nresults=nresults@entry=0, errfunc=errfunc@entry=0, ctx=ctx@entry=0, k=k@entry=0x0) at ./lapi.c:969
#82 0x0000555555598508 in extl_dodo_call_vararg (param=0x7fffffffe3c0, st=0x5555555d3db8) at ./libextl/luaextl.c:1554
#83 extl_do_call_vararg (st=0x5555555d3db8, param=0x7fffffffe3c0) at ./libextl/luaextl.c:1598
#84 0x0000555555597526 in extl_docpcall (st=0x5555555d3db8) at ./libextl/luaextl.c:128
#85 0x00007ffff7e11d1f in luaD_precall (L=L@entry=0x5555555d3db8, func=0x5555556a9b10, nresults=0) at ./ldo.c:434
#86 0x00007ffff7e1209b in luaD_call (nResults=<optimized out>, func=<optimized out>, L=0x5555555d3db8) at ./ldo.c:498
#87 luaD_callnoyield (L=0x5555555d3db8, func=<optimized out>, nResults=<optimized out>) at ./ldo.c:509
#88 0x00007ffff7e1145f in luaD_rawrunprotected (L=L@entry=0x5555555d3db8, f=f@entry=0x7ffff7e0b070 <f_call>, ud=ud@entry=0x7fffffffe310) at ./ldo.c:142
#89 0x00007ffff7e1244b in luaD_pcall (L=L@entry=0x5555555d3db8, func=func@entry=0x7ffff7e0b070 <f_call>, u=u@entry=0x7fffffffe310, old_top=16, ef=<optimized out>) at ./ldo.c:729
#90 0x00007ffff7e0d65a in lua_pcallk (L=L@entry=0x5555555d3db8, nargs=nargs@entry=1, nresults=nresults@entry=0, errfunc=errfunc@entry=0, ctx=ctx@entry=0, k=k@entry=0x0) at ./lapi.c:969
#91 0x00005555555965da in extl_cpcall (st=0x5555555d3db8, fn=fn@entry=0x555555598412 <extl_do_call_vararg>, ptr=ptr@entry=0x7fffffffe3c0) at ./libextl/luaextl.c:149
#92 0x000055555559949e in extl_cpcall_call (fn=0x555555598412 <extl_do_call_vararg>, param=0x7fffffffe3c0, st=<optimized out>) at ./libextl/luaextl.c:1574
#93 extl_call_vararg (fnref=<optimized out>, spec=<optimized out>, rspec=<optimized out>, args=args@entry=0x7fffffffe410) at ./libextl/luaextl.c:1615
#94 0x00005555555995ae in extl_call (fnref=<optimized out>, spec=spec@entry=0x0, rspec=rspec@entry=0x0) at ./libextl/luaextl.c:1625
#95 0x0000555555595e0f in try_call (file=<optimized out>, param=0x7fffffffe62c) at ./libextl/readconfig.c:271
#96 try_call (file=<optimized out>, param=param@entry=0x7fffffffe62c) at ./libextl/readconfig.c:264
#97 0x0000555555595b3b in do_try (dir=<optimized out>, file=<optimized out>, tryfn=tryfn@entry=0x555555595df2 <try_call>, tryfnparam=tryfnparam@entry=0x7fffffffe62c) at ./libextl/readconfig.c:163
#98 0x0000555555595c0a in try_etcpath (files=files@entry=0x7fffffffe5b8, tryfn=tryfn@entry=0x555555595df2 <try_call>, tryfnparam=tryfnparam@entry=0x7fffffffe62c) at ./libextl/readconfig.c:199
#99 0x00005555555961a5 in extl_try_config (fname=fname@entry=0x5555555a2c71 "look", cfdir=cfdir@entry=0x0, tryfn=tryfn@entry=0x555555595df2 <try_call>, tryfnparam=tryfnparam@entry=0x7fffffffe62c, ext1=ext1@entry=0x5555555a018d "lc", ext2=ext2@entry=0x5555555a4011 "lua") at ./libextl/readconfig.c:334
#100 0x00005555555962eb in extl_read_config (file=file@entry=0x5555555a2c71 "look", sp=sp@entry=0x0, warn_nx=warn_nx@entry=1) at ./libextl/readconfig.c:389
#101 0x0000555555588145 in gr_read_config () at ./ioncore/gr.c:646
#102 0x00005555555788c0 in ioncore_startup (display=display@entry=0x0, cfgfile=cfgfile@entry=0x5555555a009f "cfg_notion", stflags=stflags@entry=0) at ./ioncore/ioncore.c:619
#103 0x0000555555571402 in main (argc=<optimized out>, argv=<optimized out>) at ./notion/notion.c:249

@raboof
Copy link
Owner Author

raboof commented Aug 1, 2022

Okay... so apparently it's happening while processing the graphics engine (gr_read_config), which allocates a color on the global display (de_alloc_colour), which initializes some atom, which tries to lock the display, and apparently there's something fishy going on with the mutex used to lock the display.

This is well after ioncore_init_x (which opens and initializes the global display) has finished, and I'd presume that would trigger the xlib ctor, so I'm kinda lost as to why that would trigger a problem.

Any ideas?

@raboof
Copy link
Owner Author

raboof commented Aug 1, 2022

Could you perhaps try explicitly calling XInitThreads() from early in ioncore_init_x, so we're really sure it's the first XLib call notion makes, and completes before we do any other Xlib calls?

@weinholt
Copy link

weinholt commented Aug 2, 2022

I've now tried calling XInitThreads() early with libX11 still configured with --disable-thread-safety-constructor. It still hangs/crashes the same way as before.

I rebuilt notion with this patch:

--- notion-4.0.2+dfsg.orig/ioncore/ioncore.c
+++ notion-4.0.2+dfsg/ioncore/ioncore.c
@@ -485,6 +485,7 @@ static bool ioncore_init_x(const char *d
      */
     assert(!called);
     called=TRUE;
+    XInitThreads();
 
     /* Open the display. */
     dpy=XOpenDisplay(display);

Recall that notion sometimes fails with an assertion and other times it just hangs. I've captured a backtrace from notion when it just hanged:

#0  futex_wait (private=0, expected=2, futex_word=0x5555555e1090) at ../sysdeps/nptl/futex-internal.h:146
#1  __lll_lock_wait (futex=futex@entry=0x5555555e1090, private=0) at lowlevellock.c:52
#2  0x00007ffff76abfe3 in __GI___pthread_mutex_lock (mutex=0x5555555e1090) at ../nptl/pthread_mutex_lock.c:80
#3  0x00007ffff7eb543f in _XOpenLC () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#4  0x00007ffff7e880cd in XOpenOM () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#5  0x00007ffff7e7c468 in XCreateFontSet () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#6  0x00007ffff7a2eaae in de_create_font_in_current_locale (fontname=fontname@entry=0x7ffff7a3027f "-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*") at ./de/fontset.c:111
#7  0x00007ffff7a2ef45 in de_create_font_set (fontname=fontname@entry=0x7ffff7a3027f "-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*") at ./de/fontset.c:218
#8  0x00007ffff7a2dc64 in de_load_font (fontname=fontname@entry=0x7ffff7a3027f "-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*") at ./de/font.c:95
#9  0x00007ffff7a2df39 in de_load_font_for_style (style=style@entry=0x55555575def0, fontname=0x7ffff7a3027f "-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*") at ./de/font.c:171
#10 0x00007ffff7a2c585 in de_init () at ./de/init.c:445
#11 0x0000555555575366 in call_init (modulename=0x5555555fbe10 "de", handle=0x55555575cd80) at ./ioncore/modules.c:136
#12 try_load (file=0x5555555c1fc0 "/usr/lib/notion/de.so", UNUSED_param=UNUSED_param@entry=0x0) at ./ioncore/modules.c:227
#13 0x00005555555954ab in do_try (dir=dir@entry=0x55555563be60 "/usr/lib/notion", file=<optimized out>, tryfn=tryfn@entry=0x555555575119 <try_load>, tryfnparam=tryfnparam@entry=0x0) at ./libextl/readconfig.c:163
#14 0x000055555559561b in try_etcpath (files=files@entry=0x7fffffffcf38, tryfn=tryfn@entry=0x555555575119 <try_load>, tryfnparam=tryfnparam@entry=0x0) at ./libextl/readconfig.c:221
#15 0x0000555555595b1a in extl_try_config (fname=fname@entry=0x55555568d5b8 "de", cfdir=cfdir@entry=0x0, tryfn=tryfn@entry=0x555555575119 <try_load>, tryfnparam=tryfnparam@entry=0x0, ext1=ext1@entry=0x55555559fc71 "so", ext2=ext2@entry=0x0) at ./libextl/readconfig.c:334
#16 0x0000555555575489 in do_load_module (modname=0x55555568d5b8 "de") at ./ioncore/modules.c:248
#17 ioncore_load_module (modname=modname@entry=0x55555568d5b8 "de") at ./ioncore/modules.c:379
#18 0x00005555555875fe in gr_select_engine (engine=0x55555568d5b8 "de", engine@entry=<error reading variable: value has been optimized out>) at ./ioncore/gr.c:113
#19 0x0000555555591f8b in l2chnd_b_s__ (fn=<optimized out>, in=<optimized out>, out=0x7fffffffd310) at ./ioncore/exports.c:142
#20 0x0000555555596d0d in extl_l1_call_handler2 (st=0x5555555d1d28) at ./libextl/luaextl.c:1904
#21 0x00007ffff7e11d1f in luaD_precall (L=L@entry=0x5555555d1d28, func=0x5555556a9460, nresults=-1) at ./ldo.c:434
#22 0x00007ffff7e1209b in luaD_call (nResults=<optimized out>, func=<optimized out>, L=0x5555555d1d28) at ./ldo.c:498
#23 luaD_callnoyield (L=0x5555555d1d28, func=<optimized out>, nResults=<optimized out>) at ./ldo.c:509
#24 0x00007ffff7e1145f in luaD_rawrunprotected (L=L@entry=0x5555555d1d28, f=f@entry=0x7ffff7e0b070 <f_call>, ud=ud@entry=0x7fffffffd210) at ./ldo.c:142
#25 0x00007ffff7e1244b in luaD_pcall (L=L@entry=0x5555555d1d28, func=func@entry=0x7ffff7e0b070 <f_call>, u=u@entry=0x7fffffffd210, old_top=208, ef=<optimized out>) at ./ldo.c:729
#26 0x00007ffff7e0d65a in lua_pcallk (L=L@entry=0x5555555d1d28, nargs=<optimized out>, nresults=nresults@entry=-1, errfunc=errfunc@entry=0, ctx=ctx@entry=0, k=k@entry=0x0) at ./lapi.c:969
#27 0x0000555555598443 in extl_l1_call_handler (st=0x5555555d1d28) at ./libextl/luaextl.c:1992
#28 0x00007ffff7e11d1f in luaD_precall (L=L@entry=0x5555555d1d28, func=func@entry=0x5555556a9450, nresults=nresults@entry=1) at ./ldo.c:434
#29 0x00007ffff7e1f381 in luaV_execute (L=L@entry=0x5555555d1d28) at ./lvm.c:1134
#30 0x00007ffff7e120d8 in luaD_call (nResults=1432165672, func=<optimized out>, L=0x5555555d1d28) at ./ldo.c:499
#31 luaD_callnoyield (L=L@entry=0x5555555d1d28, func=<optimized out>, nResults=nResults@entry=-1) at ./ldo.c:509
#32 0x00007ffff7e0d599 in lua_callk (L=L@entry=0x5555555d1d28, nargs=nargs@entry=0, nresults=nresults@entry=-1, ctx=ctx@entry=0, k=k@entry=0x0) at ./lapi.c:925
#33 0x000055555559730e in call_loaded (st=0x5555555d1d28) at ./libextl/luaextl.c:1655
#34 0x00007ffff7e11d1f in luaD_precall (L=L@entry=0x5555555d1d28, func=0x5555556a9430, nresults=0) at ./ldo.c:434
#35 0x00007ffff7e1209b in luaD_call (nResults=<optimized out>, func=<optimized out>, L=0x5555555d1d28) at ./ldo.c:498
#36 luaD_callnoyield (L=0x5555555d1d28, func=<optimized out>, nResults=<optimized out>) at ./ldo.c:509
#37 0x00007ffff7e1145f in luaD_rawrunprotected (L=L@entry=0x5555555d1d28, f=f@entry=0x7ffff7e0b070 <f_call>, ud=ud@entry=0x7fffffffd700) at ./ldo.c:142
#38 0x00007ffff7e1244b in luaD_pcall (L=L@entry=0x5555555d1d28, func=func@entry=0x7ffff7e0b070 <f_call>, u=u@entry=0x7fffffffd700, old_top=160, ef=<optimized out>) at ./ldo.c:729
#39 0x00007ffff7e0d65a in lua_pcallk (L=L@entry=0x5555555d1d28, nargs=nargs@entry=0, nresults=nresults@entry=0, errfunc=errfunc@entry=0, ctx=ctx@entry=0, k=k@entry=0x0) at ./lapi.c:969
#40 0x0000555555597ded in extl_dodo_call_vararg (param=0x7fffffffda00, st=0x5555555d1d28) at ./libextl/luaextl.c:1554
#41 extl_do_call_vararg (st=0x5555555d1d28, param=0x7fffffffda00) at ./libextl/luaextl.c:1598
#42 0x0000555555597879 in extl_docpcall (st=0x5555555d1d28) at ./libextl/luaextl.c:128
#43 0x00007ffff7e11d1f in luaD_precall (L=L@entry=0x5555555d1d28, func=0x5555556a9410, nresults=0) at ./ldo.c:434
#44 0x00007ffff7e1209b in luaD_call (nResults=<optimized out>, func=<optimized out>, L=0x5555555d1d28) at ./ldo.c:498
#45 luaD_callnoyield (L=0x5555555d1d28, func=<optimized out>, nResults=<optimized out>) at ./ldo.c:509
#46 0x00007ffff7e1145f in luaD_rawrunprotected (L=L@entry=0x5555555d1d28, f=f@entry=0x7ffff7e0b070 <f_call>, ud=ud@entry=0x7fffffffd950) at ./ldo.c:142
#47 0x00007ffff7e1244b in luaD_pcall (L=L@entry=0x5555555d1d28, func=func@entry=0x7ffff7e0b070 <f_call>, u=u@entry=0x7fffffffd950, old_top=128, ef=<optimized out>) at ./ldo.c:729
#48 0x00007ffff7e0d65a in lua_pcallk (L=L@entry=0x5555555d1d28, nargs=nargs@entry=1, nresults=nresults@entry=0, errfunc=errfunc@entry=0, ctx=ctx@entry=0, k=k@entry=0x0) at ./lapi.c:969
#49 0x0000555555595f3b in extl_cpcall (st=0x5555555d1d28, fn=fn@entry=0x555555597ced <extl_do_call_vararg>, ptr=ptr@entry=0x7fffffffda00) at ./libextl/luaextl.c:149
#50 0x0000555555598d5f in extl_cpcall_call (fn=0x555555597ced <extl_do_call_vararg>, param=0x7fffffffda00, st=<optimized out>) at ./libextl/luaextl.c:1574
#51 extl_call_vararg (fnref=<optimized out>, spec=<optimized out>, rspec=<optimized out>, args=args@entry=0x7fffffffda50) at ./libextl/luaextl.c:1615
#52 0x0000555555598e6d in extl_call (fnref=<optimized out>, spec=spec@entry=0x0, rspec=rspec@entry=0x0) at ./libextl/luaextl.c:1625
#53 0x000055555559578a in try_call (file=<optimized out>, param=0x7fffffffdc6c) at ./libextl/readconfig.c:271
#54 try_call (file=<optimized out>, param=param@entry=0x7fffffffdc6c) at ./libextl/readconfig.c:264
#55 0x00005555555954ab in do_try (dir=dir@entry=0x55555575c0a0 "/etc/X11/notion", file=<optimized out>, tryfn=tryfn@entry=0x55555559576d <try_call>, tryfnparam=tryfnparam@entry=0x7fffffffdc6c) at ./libextl/readconfig.c:163
#56 0x000055555559561b in try_etcpath (files=files@entry=0x7fffffffdbf8, tryfn=tryfn@entry=0x55555559576d <try_call>, tryfnparam=tryfnparam@entry=0x7fffffffdc6c) at ./libextl/readconfig.c:221
#57 0x0000555555595b1a in extl_try_config (fname=fname@entry=0x55555563bed8 "look_dusky", cfdir=cfdir@entry=0x55555575bfa8 "/home/weinholt/.notion/default-session--0", tryfn=tryfn@entry=0x55555559576d <try_call>, tryfnparam=tryfnparam@entry=0x7fffffffdc6c, ext1=ext1@entry=0x55555559f10f "lc", ext2=ext2@entry=0x5555555a2fd1 "lua") at ./libextl/readconfig.c:334
#58 0x0000555555595c5a in extl_read_config (file=file@entry=0x55555563bed8 "look_dusky", sp=0x55555575bfa8 "/home/weinholt/.notion/default-session--0", warn_nx=warn_nx@entry=1) at ./libextl/readconfig.c:389
#59 0x0000555555597a88 in extl_dopath (st=0x5555555d1d28) at ./libextl/luaextl.c:447
#60 0x00007ffff7e11d1f in luaD_precall (L=L@entry=0x5555555d1d28, func=func@entry=0x5555556a93e0, nresults=nresults@entry=0) at ./ldo.c:434
#61 0x00007ffff7e1f381 in luaV_execute (L=L@entry=0x5555555d1d28) at ./lvm.c:1134
#62 0x00007ffff7e120d8 in luaD_call (nResults=1432165672, func=<optimized out>, L=0x5555555d1d28) at ./ldo.c:499
#63 luaD_callnoyield (L=L@entry=0x5555555d1d28, func=<optimized out>, nResults=nResults@entry=-1) at ./ldo.c:509
#64 0x00007ffff7e0d599 in lua_callk (L=L@entry=0x5555555d1d28, nargs=nargs@entry=0, nresults=nresults@entry=-1, ctx=ctx@entry=0, k=k@entry=0x0) at ./lapi.c:925
#65 0x000055555559730e in call_loaded (st=0x5555555d1d28) at ./libextl/luaextl.c:1655
#66 0x00007ffff7e11d1f in luaD_precall (L=L@entry=0x5555555d1d28, func=0x5555556a93c0, nresults=0) at ./ldo.c:434
#67 0x00007ffff7e1209b in luaD_call (nResults=<optimized out>, func=<optimized out>, L=0x5555555d1d28) at ./ldo.c:498
#68 luaD_callnoyield (L=0x5555555d1d28, func=<optimized out>, nResults=<optimized out>) at ./ldo.c:509
#69 0x00007ffff7e1145f in luaD_rawrunprotected (L=L@entry=0x5555555d1d28, f=f@entry=0x7ffff7e0b070 <f_call>, ud=ud@entry=0x7fffffffe080) at ./ldo.c:142
#70 0x00007ffff7e1244b in luaD_pcall (L=L@entry=0x5555555d1d28, func=func@entry=0x7ffff7e0b070 <f_call>, u=u@entry=0x7fffffffe080, old_top=48, ef=<optimized out>) at ./ldo.c:729
#71 0x00007ffff7e0d65a in lua_pcallk (L=L@entry=0x5555555d1d28, nargs=nargs@entry=0, nresults=nresults@entry=0, errfunc=errfunc@entry=0, ctx=ctx@entry=0, k=k@entry=0x0) at ./lapi.c:969
#72 0x0000555555597ded in extl_dodo_call_vararg (param=0x7fffffffe380, st=0x5555555d1d28) at ./libextl/luaextl.c:1554
#73 extl_do_call_vararg (st=0x5555555d1d28, param=0x7fffffffe380) at ./libextl/luaextl.c:1598
#74 0x0000555555597879 in extl_docpcall (st=0x5555555d1d28) at ./libextl/luaextl.c:128
#75 0x00007ffff7e11d1f in luaD_precall (L=L@entry=0x5555555d1d28, func=0x5555556a93a0, nresults=0) at ./ldo.c:434
#76 0x00007ffff7e1209b in luaD_call (nResults=<optimized out>, func=<optimized out>, L=0x5555555d1d28) at ./ldo.c:498
#77 luaD_callnoyield (L=0x5555555d1d28, func=<optimized out>, nResults=<optimized out>) at ./ldo.c:509
#78 0x00007ffff7e1145f in luaD_rawrunprotected (L=L@entry=0x5555555d1d28, f=f@entry=0x7ffff7e0b070 <f_call>, ud=ud@entry=0x7fffffffe2d0) at ./ldo.c:142
#79 0x00007ffff7e1244b in luaD_pcall (L=L@entry=0x5555555d1d28, func=func@entry=0x7ffff7e0b070 <f_call>, u=u@entry=0x7fffffffe2d0, old_top=16, ef=<optimized out>) at ./ldo.c:729
#80 0x00007ffff7e0d65a in lua_pcallk (L=L@entry=0x5555555d1d28, nargs=nargs@entry=1, nresults=nresults@entry=0, errfunc=errfunc@entry=0, ctx=ctx@entry=0, k=k@entry=0x0) at ./lapi.c:969
#81 0x0000555555595f3b in extl_cpcall (st=0x5555555d1d28, fn=fn@entry=0x555555597ced <extl_do_call_vararg>, ptr=ptr@entry=0x7fffffffe380) at ./libextl/luaextl.c:149
#82 0x0000555555598d5f in extl_cpcall_call (fn=0x555555597ced <extl_do_call_vararg>, param=0x7fffffffe380, st=<optimized out>) at ./libextl/luaextl.c:1574
#83 extl_call_vararg (fnref=<optimized out>, spec=<optimized out>, rspec=<optimized out>, args=args@entry=0x7fffffffe3d0) at ./libextl/luaextl.c:1615
#84 0x0000555555598e6d in extl_call (fnref=<optimized out>, spec=spec@entry=0x0, rspec=rspec@entry=0x0) at ./libextl/luaextl.c:1625
#85 0x000055555559578a in try_call (file=<optimized out>, param=0x7fffffffe5ec) at ./libextl/readconfig.c:271
#86 try_call (file=<optimized out>, param=param@entry=0x7fffffffe5ec) at ./libextl/readconfig.c:264
#87 0x00005555555954ab in do_try (dir=<optimized out>, file=<optimized out>, tryfn=tryfn@entry=0x55555559576d <try_call>, tryfnparam=tryfnparam@entry=0x7fffffffe5ec) at ./libextl/readconfig.c:163
#88 0x000055555559557c in try_etcpath (files=files@entry=0x7fffffffe578, tryfn=tryfn@entry=0x55555559576d <try_call>, tryfnparam=tryfnparam@entry=0x7fffffffe5ec) at ./libextl/readconfig.c:199
#89 0x0000555555595b1a in extl_try_config (fname=fname@entry=0x5555555a1c31 "look", cfdir=cfdir@entry=0x0, tryfn=tryfn@entry=0x55555559576d <try_call>, tryfnparam=tryfnparam@entry=0x7fffffffe5ec, ext1=ext1@entry=0x55555559f10f "lc", ext2=ext2@entry=0x5555555a2fd1 "lua") at ./libextl/readconfig.c:334
#90 0x0000555555595c5a in extl_read_config (file=file@entry=0x5555555a1c31 "look", sp=sp@entry=0x0, warn_nx=warn_nx@entry=1) at ./libextl/readconfig.c:389
#91 0x0000555555587ac0 in gr_read_config () at ./ioncore/gr.c:646
#92 0x000055555557868c in ioncore_startup (display=display@entry=0x0, cfgfile=cfgfile@entry=0x55555559f09f "cfg_notion", stflags=stflags@entry=0) at ./ioncore/ioncore.c:620
#93 0x00005555555713d8 in main (argc=<optimized out>, argv=<optimized out>) at ./notion/notion.c:249

@raboof
Copy link
Owner Author

raboof commented Aug 2, 2022

with libX11 still configured with --disable-thread-safety-constructor. It still hangs/crashes the same way as before.

Aha, so that suggests the problem might not have anything to do with https://gitlab.freedesktop.org/xorg/lib/libx11/-/commit/afcdb6fb0045c6186aa83d9298f327a7ec1b2cb9 after all? Definitely 'something with threads and mutexes' though - and still something we'd want to fix, of course.

other times it just hangs. I've captured a backtrace from notion when it just hanged

Thanks a lot, that at least gives us something to go on :). So it's also happening in the graphics engine initialization (gr_read_config). It looks like _XOpenLC wants to take the _Xi18n_lock mutex but it is already taken? Is there some way to see what thread might be holding that mutex?

I'm afraid I won't be able to dig much deeper right now, I'm rather busy the coming weeks - would be great if you could hunt it down further!

@weinholt
Copy link

weinholt commented Aug 7, 2022

I don't think this is a bug in notion. I think the problem is that libX11 uses pthreads but is not built with -pthread. I've written up my findings here: https://gitlab.freedesktop.org/xorg/lib/libx11/-/issues/157#note_1499394

@raboof
Copy link
Owner Author

raboof commented Aug 16, 2022

Thanks a lot for the analysis.

I guess there's nothing we can do from the Notion side - it would be nice if we could detect the problem and warn about it specifically, but even that sounds like it'd be a challenge.

Hopefully this issue gets indexed by search engines and provides a good hint for other people running into this problem :)

Feel free to re-open when you think of something we could do from the Notion side.

@raboof raboof closed this as completed Aug 16, 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