Graceful shutdown should not interrupt output printing
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- backend
Research direction
Reproduce the issue with the provided Racket program, especially the serve call using #:confirmation-channel and stop. Trace the shutdown path and its output handling; done means stop returns only after the server's error output has finished, without requiring sleep or manual flushing.
Written by the indexing model from the issue text.
Description
Consider the following program:
#lang racket
(require web-server/web-server
racket/async-channel)
(define ach
(make-async-channel))
(define stop
(serve #:confirmation-channel ach
#:port 80 ;<-- needs privileges
#:dispatch void))
(begin0 (sync ach)
#;(sleep 1)
(flush-output (current-error-port))
(stop)
(flush-output (current-error-port)))
For me, running in DrRacket (and thus without privileges) typically produces the following output:
🛑 ../../gnu/store/da1fz8sjsy0r21mm02dy7hwqpq08hbzp-racket-pkg-web-server-sources/share/racket/pkgs/web-server-lib/web-server/private/dispatch-server-with-connect-unit.rkt(exn:fail:network:errno
"tcp-listen: listen failed\n port number: 80\n system error: Permission denied; errno=13"
#<continuation-mark-set>
'(13 . posix))
>
I've used 🛑 to replace the icons DrRacket prints. The path at the beginning of the message is in printed in red as error output; beginning with the opening parenthesis, the rest is in blue, as a printed value.
Because the program calls (stop) before returning the value of (syn ach), I expected the server to have finished gracefully shutting down, which IMO should include finishing its output to (current-error-port).
In fact, I didn't even need to need to call flush-output, but commenting out the first call (with or without the second call) just changes when the interruption happens. DrRacket still prints its icons, but the path is not printed:
🛑 (exn:fail:network:errno
"tcp-listen: listen failed\n port number: 80\n system error: Permission denied; errno=13"
#<continuation-mark-set>
'(13 . posix))
For a Discourse post, I managed to get what I wanted by uncomenting (sleep 1) (with or without the calls to flush-output), but that is obviously a hack.
- Dominant language
- Racket
- Stars
- 100
- Forks
- 48
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
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 racket/web-server
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
racket/web-server#46 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
racket/web-server#141 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
racket/web-server#135 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
racket/web-server#131 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
racket/web-server#127 ·
All issues in racket/web-server
Similar issues
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100