Skip to content

Chapter 20.3 Webserver Deadlock #3356

@buggymcbugfix

Description

@buggymcbugfix

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions