HTTP.jl
HTTP.jl copied to clipboard
serve() fails when run from an :interactive thread (Julia >=1.9)
The minimal example fails to return a valid response (but doesn't throw any errors) when run from an :interactive thread, but works fine if :interactive is removed. Julia should be started with -t2,1.
import HTTP
function run()
HTTP.serve() do request::HTTP.Request
return HTTP.Response(200, "hello")
end
end
t = Threads.@spawn :interactive run()
wait(t)
$ curl -v 127.0.0.1:8081
* Trying 127.0.0.1:8081...
* Connected to 127.0.0.1 (127.0.0.1) port 8081 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:8081
> User-Agent: curl/7.85.0
> Accept: */*
>
* Empty reply from server
* Closing connection 0
curl: (52) Empty reply from server
(foo) pkg> st
Status `/tmp/foo/Project.toml`
[cd3eb016] HTTP v1.5.5
julia> versioninfo()
Julia Version 1.10.0-DEV.46
Commit d0a211a9209 (2022-11-24 15:42 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 8 × AMD Ryzen 7 4700U with Radeon Graphics
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-14.0.6 (ORCJIT, znver2)
Threads: 3 on 8 virtual cores
Environment:
JULIA_DEPOT_PATH = /me/.julia
I also tested and got the same results with 1.9.0-alpha1.