book icon indicating copy to clipboard operation
book copied to clipboard

Chapter 20.3 Webserver Deadlock

Open buggymcbugfix opened this issue 1 year ago • 3 comments

When I run the final webserver project, exactly as given in the book, it deadlocks for me. My setup is running the server in one shell and the following loop in the other:

for i in {1..10}
do
        curl http://127.0.0.1:7878/sleep &
done

I got the following output:

-> % cargo run
   Compiling hello v0.1.0 (/Users/me/rust/hello)
    Finished dev [unoptimized + debuginfo] target(s) in 0.47s
     Running `target/debug/hello`
Shutting down.
Shutting down worker 0
Worker 0 got a job; executing.
Worker 1 got a job; executing.
^C

Apparently the server deadlocked because I left it for several minutes without anything happening until I ctrl-cd. I thought it was a bit suspicious that the shutdown and "got a job" messages are inverted, although obviously one can't necessarily rely on the order of the output.

I believe this may not be a known issue, as I haven't found anything in the issue tracker, but I might be wrong, so I haven't done any further investitation.

buggymcbugfix avatar Sep 19 '22 13:09 buggymcbugfix