-
Notifications
You must be signed in to change notification settings - Fork 228
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
The default meson option epoll=false
causes a busy loop and segmentation fault.
#1391
Comments
With (import spork/sh)
(def devnull (sh/devnull))
(ev/spawn-thread (ev/write devnull "ok")) Welcome to hell. |
epoll=false
causes a busy loop.epoll=false
causes a busy loop and segmentation fault.
I got the segfault as well. I edited #define JANET_EV_NO_EPOLL and rebuilt I don't know how reliable the results are but I used This is the output I got around the report of a segfault:
I guess that's this line. |
The issue is the copying of streams between threads. There is some thread local (interpreter global) state that needs copying. This only exists for the poll implementation, though. |
This should be fixed for me as of 12630d3 - the issue was janet_unmarshal_stream didn't re-register the stream with the event loop. |
I built the latest commit with |
Is the segfault still happening? The 100% cpu is not yet addressed |
At least, the segmentation fault is gone now. The 100% cpu usage is not gone, yet. |
I used "TCP Echo Server" example from README as the server and 0ff8f58 is the first bad commit. Server strace before commit (fd=5 - connection socket):
Server strace after commit (fd=5 - connection socket):
From Janet doesn't want to write anything to the socket, yet still waits for it to be writable. Poll immediately signals that it is writable, hence the busy loop. |
See https://groups.google.com/g/comp.unix.programmer/c/bNNadBIEpTo/m/G5gs1mqNhbIJ?pli=1 for a conversation and workaround.
Found the issue, the problem is that passing a valid file descriptor to poll with events = 0 immediately returns with POLLHUP. See https://groups.google.com/g/comp.unix.programmer/c/bNNadBIEpTo/m/G5gs1mqNhbIJ?pli=1 for a conversation and workaround. |
Properly set read_fiber and write_fiber to NULL when unused. This was causing extra listening in the poll implemenation leading to busy loops where a read was accidentally listening for POLLOUT.
If I build janet with the default meson option
epoll=false
, then the following code causes a busy loop.The workaround is to replace
ev/sleep
withos/sleep
, remove{:out :pipe}
, or closeproc
withos/proc-close
which closes pipes and callsos/proc-wait
if it hasn't been called already.If I build janet with
epoll=true
, then the issue goes away.This issue was separated from #1386
The text was updated successfully, but these errors were encountered: