Hammerspoon / hammerspoon

Staggeringly powerful macOS desktop automation with Lua
http://www.hammerspoon.org
MIT License
12.15k stars 587 forks source link

Continually crashing in ipc.lua module (ipc port is no longer valid) #3704

Open megalithic opened 1 month ago

megalithic commented 1 month ago

https://github.com/Hammerspoon/hammerspoon/blob/08cb81357dae2e9ecce33cba1a627b9dbc09af04/extensions/ipc/ipc.lua#L48

I'm rather consistently getting this error:

 2024-10-16 14:23:08: 14:23:08 ERROR: LuaSkin: hs.timer callback error: ...Hammerspoon.app/Contents/Resources/extensions/hs/ipc.lua:48: ipc port is no longer valid (early)

Most notably this happens with keybindings, but also has happened with the hs.layout and hs.screen modules. I don't have an exact root cause, unfortunately. The easiest workaround is just to reload the config again, and all is well. Some days, it errors only once, some days it's 1-5 times. I'll notice it once a keybinding fails to execute as expected.

This has happening on 100.x; also, I'm on Sonoma 14.6.1.

Anyone else experiencing this??

megalithic commented 2 weeks ago

Just confirming that I believe this is happening because I have one of my tmux plugins spamming hs -c <some_cmd>, so, that said, removing the offending sequential calls to the hs cli tool from tmux ended up fixing it (haven't seen this error again).

I'll add a debounce of some sort to these calls from tmux and see if that alleviates (unfortunately what i was using this for needed near-real-time feedback).

cmsj commented 2 weeks ago

It would be great if we could narrow this down to a reproducer. It's probably not related, but one of our long-standing complete crashes of Hammerspoon is something to do with IPC ports ceasing being valid for some reason.

megalithic commented 2 weeks ago

It would be great if we could narrow this down to a reproducer. It's probably not related, but one of our long-standing complete crashes of Hammerspoon is something to do with IPC ports ceasing being valid for some reason.

Definitely happy to provide more context as i can