Skip to content

Suspendable port difficulties

I'm trying to investigate https://codeberg.org/guix/guix-packages-website/issues/23 which in general terms is an artanis site which makes HTTP requests when serving pages. Unfortunately it performs poorly since making the HTTP requests blocks the server.

Making the socket suspendable did "work" in that it no longer blocks, but the read and write waiters installed by artanis don't seem to handle waiting? Looking at the implementation, there's nothing about waiting for the file descriptor associated with the port? https://gitlab.com/hardenedlinux/artanis/-/blob/master/artanis/server/aio.scm?ref_type=heads#L37

Maybe that's the clearest bug here, the current-read-waiter and current-write-waiter in artanis don't wait for the port to be readable or writable.

I did try working around this by switching to the fibers server engine, but there must be some separation between fibers and the code generating responses, as it doesn't seem to be happening in fibers. What am I missing, is there a simple way of getting fibers or something like fibers working for responding to requests?