server: handlers defined after `serve!` starts fail with a world-age error on 2.x
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 56/100
Research direction
Read the HTTP 1.x handler call in src/Servers.jl and compare it with the HTTP 2.x server path. Start by reproducing the late registration example against a running Router, then inspect the server handler tests. Done means the late route and a handler redefined under Revise return successful responses without a world-age error.
Written by the indexing model from the issue text.
Description
Claude:
HTTP 1.x calls server handlers through Base.invokelatest ("makes live-editing handlers more Revise friendly", src/Servers.jl). HTTP 2.x doesn't: there is no invokelatest in src, so a handler defined after serve! starts is too new for the server task's world age.
This breaks routes registered on a running Router, and redefining a handler under Revise.
using HTTP
router = HTTP.Router()
HTTP.register!(router, "GET", "/early", req -> HTTP.Response(200))
srv = HTTP.serve!(router, "127.0.0.1", 38123)
HTTP.register!(router, "GET", "/late", req -> HTTP.Response(200))
HTTP.get("http://127.0.0.1:38123/late"; status_exception=false).status
- HTTP 1.11.1: 200
- HTTP 2.12.3 (Julia 1.13.3): 500, logged as
┌ Error: server handler error
│ exception =
│ MethodError: no method matching (::var"#5#6")(::HTTP.Request{HTTP.EmptyBody})
│ The applicable method may be too new: running in world age 39321, while current world is 39323.
The workaround is serve!(req -> Base.invokelatest(router, req), ...). Found in JuliaCI/PkgEvalFarm.jl#86, whose test stub server broke when it moved to HTTP 2.
Written with Claude Code (Opus 5.5).
- Dominant language
- Julia
- Stars
- 688
- Forks
- 196
- Avg merge
- 5h 59m
- Merged PRs (30d)
- 148
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JuliaWeb/HTTP.jl
-
query handling with arrays has changed between 1.x and 2.xPossibly taken @rehmansaeed06-byte claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
All issues in JuliaWeb/HTTP.jl
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
JuliaDiff/ChainRules.jl#871 · 1 comment ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
JuliaStats/LogExpFunctions.jl#134 · 2 comments ·
-
code bug PowerSystems 6.0
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Sienna-Platform/PowerSystems.jl#1849 ·
Maintainers usually reply within 7 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day