fibers
fibers copied to clipboard
concurrent-web-server doesn't wait for the server to be started
trafficstars
(There is nothing non-Fibers-test-suite listening on port 8080) (I thought this was already reported by civodul, but looking at issues & PRs, apparently not?)
In tests/concurrent-web-server.scm, we have:
(call-with-new-thread
(lambda ()
(run-server handler #:port 8080)))
(call-with-values
(lambda ()
(http-get (string->uri "http://127.0.0.1:8080/proc")
#:decode-body? #f))
The problem here is that http-get is run without waiting for the server to have started listening yet. Also, a problem is that it assumes port 8080 instead of letting the OS pick a port from the appropriate range.
guix/tests/http.scm from Guix has some code that handles this.
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /home/antipode/source-code/fibers/./tests/concurrent-web-server.scm
;;; compiled /home/antipode/.cache/guile/ccache/3.0-LE-8-4.6/home/antipode/source-code/fibers/tests/concurrent-web-server.scm.go
Backtrace:
In ice-9/boot-9.scm:
1752:10 8 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
7 (apply-smob/0 #<thunk 7ff7144e4300>)
In ice-9/boot-9.scm:
724:2 6 (call-with-prompt _ _ #<procedure default-prompt-handle…>)
In ice-9/eval.scm:
619:8 5 (_ #(#(#<directory (guile-user) 7ff7144e7c80>)))
In ice-9/boot-9.scm:
2836:4 4 (save-module-excursion _)
4388:12 3 (_)
In tests/concurrent-web-server.scm:
77:7 2 (_)
In web/client.scm:
576:0 1 (http-get #<<uri> scheme: http userinfo: #f host: "127…> …)
348:4 0 (open-socket-for-uri _ #:verify-certificate? _)
web/client.scm:348:4: In procedure open-socket-for-uri:
In procedure connect: Verbinding is geweigerd
FAIL: tests/concurrent-web-server.scm
Looks like I was thinking of https://github.com/wingo/fibers/pull/91, which fixes a different instance of the same thing.