Logs: liberachat/#xmonad
| 2022-06-16 19:34:04 | <geekosaur[m]> | problem with FFI most likely |
| 2022-06-16 19:35:13 | <Solid> | I run 9.0.2 myself and it's totally fine here |
| 2022-06-16 19:35:19 | <Solid> | so probably not the GHC thing |
| 2022-06-16 19:36:05 | <geekosaur[m]> | keep in mind I couldn't reproduce the crash locally with my config and 9.2.2, and you'd think if any config would provoke it, it'd be my monstrosity |
| 2022-06-16 19:36:27 | <lyiriyah[m]> | I've rebuilt with 8.10.7 and it's still occuring |
| 2022-06-16 19:36:35 | <lyiriyah[m]> | s/occuring/occurring/ |
| 2022-06-16 19:36:38 | <geekosaur[m]> | while abastro reproduced it with a near minimal config |
| 2022-06-16 19:36:54 | <geekosaur[m]> | I'm not sure if that's good news or bad |
| 2022-06-16 19:37:05 | <Solid> | (I could actually reproduce that today (at some point, right now it's stable again ._.) but I also had to play around with xft stuff) |
| 2022-06-16 19:38:02 | <Solid> | lyiriyah[m]: I guess your best bet would be to play around with getName and getNameWmClass in a stack ghci session or something and perhaps print the exception that occurs |
| 2022-06-16 19:41:22 | × | terrorjack quits (~terrorjac@2a01:4f8:1c1e:509a::1) (Quit: The Lounge - https://thelounge.chat) |
| 2022-06-16 19:43:40 | → | terrorjack joins (~terrorjac@2a01:4f8:1c1e:509a::1) |
| 2022-06-16 19:46:27 | <lyiriyah[m]> | <Solid> "lyiriyah: I guess your best..." <- Can you give me some pointers on how I'd go about this? |
| 2022-06-16 19:48:54 | <geekosaur[m]> | that'll be difficult because it's in X, not IO |
| 2022-06-16 19:49:01 | <geekosaur[m]> | not even MonadIO |
| 2022-06-16 19:52:40 | → | steve__ joins (~steve@ool-182c2b80.dyn.optonline.net) |
| 2022-06-16 19:55:36 | <lyiriyah[m]> | hmm |
| 2022-06-16 20:00:48 | <Solid> | I would just copy the relevant parts out of getName |
| 2022-06-16 20:01:04 | <Solid> | all you need is to call openDisplay, really |
| 2022-06-16 20:01:28 | <Solid> | all the rest is X11 functions that are in IO natively |
| 2022-06-16 20:01:33 | × | gdd quits (~gdd@2001:470:1f13:187:c211:ee4c:6eca:b634) (Remote host closed the connection) |
| 2022-06-16 20:03:30 | <Solid> | I wish I could offer a few more pointers (heh) but I'm dead tired and will go to bed now |
| 2022-06-16 20:03:43 | <lyiriyah[m]> | Good night |
| 2022-06-16 20:14:45 | <geekosaur[m]> | oh god, I hope I haven't just found it |
| 2022-06-16 20:15:50 | <geekosaur[m]> | `getTextProperty`, when I chased it down, uses a `CString`. which has a trailing `NUL`. but X11 properties are counted strings |
| 2022-06-16 20:17:15 | <geekosaur[m]> | which means (a) we usually get lucky with trailing `NUL`s (b) we probably poke a `NUL` where it doesn't belong, which would explain GC crashes |
| 2022-06-16 20:18:11 | <lyiriyah[m]> | Any idea how I could see if this is the issue? |
| 2022-06-16 20:20:06 | <geekosaur[m]> | not easily. I need to doublecheck that something that is a `CString` is assumed to have trailing `NUL`. but I'm pretty sure there's a separate `CStringLen` for this case |
| 2022-06-16 20:31:53 | <geekosaur[m]> | mm, looks like it's okay aside from not being thread safe (and nobody allocates or frees the string so it must be internal, which makes me wonder if there's a length limit…) |
| 2022-06-16 20:32:19 | <geekosaur[m]> | wonder if we should switch to the raw property interface so we have control over that |
| 2022-06-16 20:35:27 | <geekosaur[m]> | `openDisplay [] >>= \d -> getTextProperty d `_windowid_`"_NET_WM_NAME" >>= print . tp_value` where _windowid_ comes from xwininfo |
| 2022-06-16 20:36:38 | <geekosaur[m]> | assuming a `CString` has a `Show` instance |
| 2022-06-16 20:37:26 | <geekosaur[m]> | (wat, why does this think I changed X11) |
| 2022-06-16 20:37:53 | <geekosaur[m]> | oh, wrong directory 👀 |
| 2022-06-16 20:39:19 | <geekosaur[m]> | and I think that needs to be an Atom, not a string |
| 2022-06-16 20:39:45 | <geekosaur[m]> | yep |
| 2022-06-16 20:43:28 | <geekosaur[m]> | well, that "worked" but the Show instance just prints the pointer. not real helpful |
| 2022-06-16 20:45:43 | <geekosaur[m]> | *Main Foreign.C.String> openDisplay [] >>= \d -> internAtom d "_NET_WM_NAME" False >>= \a -> getTextProperty d 0x400001f a >>= peekCString . tp_value >>= print |
| 2022-06-16 20:45:43 | <geekosaur[m]> | "Element [2] | xmonad - Google Chrome" |
| 2022-06-16 20:47:36 | lyiriyah[m] | sent a code block: https://libera.ems.host/_matrix/media/r0/download/libera.chat/3753f1e3a3e363a76fd797aee04d7502182281ab |
| 2022-06-16 20:47:46 | <lyiriyah[m]> | oh the window doesn't exist |
| 2022-06-16 20:47:50 | <lyiriyah[m]> | 🤦 |
| 2022-06-16 20:47:54 | <lyiriyah[m]> | it's been a long day |
| 2022-06-16 20:48:08 | <geekosaur[m]> | the window ID I used was for my Element app window, you need to use xwininfo to get the window ID for some window on your desktop |
| 2022-06-16 20:48:20 | <geekosaur[m]> | which I mentioned earlier |
| 2022-06-16 20:49:17 | <lyiriyah[m]> | Ok, when I actually use a window that exists that does work on my end |
| 2022-06-16 20:53:31 | <geekosaur[m]> | I still need to check that when we *set* a property we're not doing something stupid, since I'm not yet sure `NUL` is handled sanely on either the Haskell or the X11 end |
| 2022-06-16 20:53:55 | <lyiriyah[m]> | Alright |
| 2022-06-16 20:54:15 | <lyiriyah[m]> | Thanks for your help, by the way (you too Solid) |
| 2022-06-16 20:54:50 | <geekosaur[m]> | I do worry about the thread unsafeness of this stuff; I hope you aren't configured to link with `-threaded` or things may be going very wrong (although we don't use threads so they *shouldn't* be — famous last words…) |
| 2022-06-16 20:56:25 | <geekosaur[m]> | actually I think with `threaded` it may be being run in a different thread by the IO manager even if we don't make new Haskell threads, so |
| 2022-06-16 20:56:43 | <geekosaur[m]> | s/`/`-/ |
| 2022-06-16 21:00:11 | <geekosaur[m]> | mm, `XSetTextProperty` doesn't require a `NUL`, it uses `nitems`, good. |
| 2022-06-16 21:05:01 | <geekosaur[m]> | and the other side uses a `CStringLen`. we're golden |
| 2022-06-16 21:05:38 | <geekosaur[m]> | some ways I wish we weren't, though, it'd be good to find a smoking gun for all the 9.x crashes |
| 2022-06-16 21:09:44 | <geekosaur[m]> | you might have to patch NamedWindows.hs to show what's happening |
| 2022-06-16 21:16:28 | <lyiriyah[m]> | Alright, I can do that |
| 2022-06-16 21:41:50 | × | alternateved quits (~alternate@194.99.105.235) (Remote host closed the connection) |
| 2022-06-16 21:46:09 | → | gdd joins (~gdd@2001:470:1f13:187:49b9:231c:6a88:73db) |
| 2022-06-16 21:50:45 | → | Guest67 joins (~Guest67@2607:fea8:7ca0:2270:6044:2b47:5cac:b70f) |
| 2022-06-16 22:48:46 | <liskin> | geekosaur[m]: the main thread is bound, and you can't fork a thread while staying inside of the X monad, and most people don't run xmonad with -threaded, so… |
| 2022-06-16 22:49:47 | <liskin> | but yeah with -threaded and manually forking a thread in IO and calling thread unsafe function that use global storage, things might go awry |
| 2022-06-16 22:50:22 | <liskin> | but then maybe the current Xlib uses thread-local storage? it certainly does use mutexes to protect its own shared data |
| 2022-06-16 22:52:58 | <geekosaur> | only if so enabled, which is a call I don't recall us making (and it slows X11 down a lot) |
| 2022-06-16 22:53:37 | <geekosaur> | but the real worry is internal state (that is, a static buffer). and we have modules which fork threads that open their own connections to the X server |
| 2022-06-16 22:54:14 | <geekosaur> | I don't offhand recall any of those calling directly or indirectly XGetTextProperty, but if any do there's one source of problems |
| 2022-06-16 22:54:33 | <geekosaur> | the other potential source is of course that presumably static buffer… and buffer overflows |
| 2022-06-16 22:54:58 | <geekosaur> | since there's no evident call to XFree anywhere, I have to assume it's static and therefore overflowable |
| 2022-06-16 22:55:42 | <geekosaur> | but I don't really want to dig into Xlib source to find out |
| 2022-06-16 23:01:22 | <geekosaur> | flip side, we've never heard of problems here before, so it either can't be too bad or is really hard to hit in most cases (but that leaves why lyiriyah[m] would be hitting it so consistently, which is some of what makes me wonder if `-threaded` might be involved) |
| 2022-06-16 23:03:56 | <liskin> | it's enabled by default since last xlib or two |
| 2022-06-16 23:04:03 | <geekosaur> | oh |
| 2022-06-16 23:04:20 | <geekosaur> | surprised I haven't heard any bitching about performance |
| 2022-06-16 23:14:13 | × | steve__ quits (~steve@ool-182c2b80.dyn.optonline.net) (Ping timeout: 246 seconds) |
| 2022-06-16 23:33:39 | <geekosaur> | oh wait,m they included their build script, and no `-threaded` |
| 2022-06-16 23:34:07 | <geekosaur> | sigh. I have no clue why `getName` would be taking the fallback path through `WM_CLASS` |
| 2022-06-16 23:37:42 | × | Guest67 quits (~Guest67@2607:fea8:7ca0:2270:6044:2b47:5cac:b70f) (Quit: Client closed) |
| 2022-06-17 00:57:10 | × | werneta quits (~werneta@137.79.230.15) (Ping timeout: 240 seconds) |
| 2022-06-17 00:59:16 | → | werneta joins (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) |
| 2022-06-17 01:08:30 | × | werneta quits (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Ping timeout: 240 seconds) |
| 2022-06-17 01:08:46 | → | werneta joins (~werneta@137.79.224.184) |
| 2022-06-17 02:03:16 | × | banc quits (banc@gateway/vpn/airvpn/banc) (Ping timeout: 246 seconds) |
| 2022-06-17 02:05:01 | × | werneta quits (~werneta@137.79.224.184) (Ping timeout: 246 seconds) |
| 2022-06-17 02:06:51 | → | werneta joins (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) |
| 2022-06-17 02:09:14 | × | td_ quits (~td@muedsl-82-207-238-107.citykom.de) (Ping timeout: 246 seconds) |
| 2022-06-17 02:11:15 | → | td_ joins (~td@muedsl-82-207-238-251.citykom.de) |
| 2022-06-17 02:22:54 | → | banc joins (banc@gateway/vpn/airvpn/banc) |
| 2022-06-17 03:00:01 | × | haasn quits (~nand@haasn.dev) (Quit: ZNC 1.7.5+deb4 - https://znc.in) |
| 2022-06-17 03:01:22 | → | haasn joins (~nand@haasn.dev) |
| 2022-06-17 04:41:20 | → | steve__ joins (~steve@ool-182c2b80.dyn.optonline.net) |
| 2022-06-17 05:11:37 | → | benin joins (~benin@183.82.28.222) |
| 2022-06-17 05:58:20 | → | briannag[m] joins (~briannagm@2001:470:69fc:105::2:2f90) |
| 2022-06-17 06:06:29 | × | geekosaur quits (~geekosaur@xmonad/geekosaur) (Killed (NickServ (GHOST command used by allbery_b))) |
| 2022-06-17 06:06:29 | → | allbery_b joins (~geekosaur@xmonad/geekosaur) |
| 2022-06-17 06:06:32 | allbery_b | is now known as geekosaur |
| 2022-06-17 06:10:27 | × | mvk quits (~mvk@2607:fea8:5ce3:8500::4588) (Ping timeout: 240 seconds) |
| 2022-06-17 06:16:41 | × | Hash quits (~Hash@tunnel686959-pt.tunnel.tserv15.lax1.ipv6.he.net) (Quit: ZNC - https://znc.in) |
| 2022-06-17 06:27:51 | → | alternateved joins (~alternate@37.120.211.100) |
| 2022-06-17 06:39:19 | → | Hash joins (~Hash@tunnel686959-pt.tunnel.tserv15.lax1.ipv6.he.net) |
| 2022-06-17 06:52:44 | × | alternateved quits (~alternate@37.120.211.100) (Remote host closed the connection) |
All times are in UTC.