Skip to content
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

concurrent-web-server doesn't wait for the server to be started #94

Open
emixa-d opened this issue Aug 27, 2023 · 1 comment
Open

concurrent-web-server doesn't wait for the server to be started #94

emixa-d opened this issue Aug 27, 2023 · 1 comment
Labels

Comments

@emixa-d
Copy link
Collaborator

emixa-d commented Aug 27, 2023

(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
@emixa-d
Copy link
Collaborator Author

emixa-d commented Aug 27, 2023

Looks like I was thinking of #91, which fixes a different instance of the same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant