Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Timeout occurred while waiting for a slot to become available #3661

Closed
4 tasks done
delendum opened this issue Jul 19, 2023 · 12 comments
Closed
4 tasks done

[Bug]: Timeout occurred while waiting for a slot to become available #3661

delendum opened this issue Jul 19, 2023 · 12 comments
Labels
area: database bug Something isn't working

Comments

@delendum
Copy link

Requirements

  • Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support
  • Did you check to see if this issue already exists?
  • Is this only a single bug? Do not put multiple bugs in one issue.
  • Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.

Summary

I'm not sure what triggered this, but the Lemmy server service suddenly started churning out this error, causing the instance to stop working (UI would load and display the server error message).

Restarting the Lemmy server service resolved the issue.

Steps to Reproduce

I'm not sure how it can be reproduced, logs don't reveal anything out of the ordinary before this started happening.

Technical Details

Jul 19 14:54:20 lemdit lemmy_server[749]: 2023-07-19T02:54:20.203703Z INFO actix_web::middleware::logger: 135.181.143.230 'POST /inbox HTTP/1.0' 200 0 '-' 'Lemmy/0.18.2-1-g68276b2f9; +https://lemmy.world' 0.024973
Jul 19 14:54:20 lemdit lemmy_server[749]: 2023-07-19T02:54:20.362034Z INFO actix_web::middleware::logger: 135.181.143.230 'POST /inbox HTTP/1.0' 200 0 '-' 'Lemmy/0.18.2-1-g68276b2f9; +https://lemmy.world' 0.028401
Jul 19 14:54:20 lemdit lemmy_server[749]: 2023-07-19T02:54:20.397566Z INFO actix_web::middleware::logger: 54.36.178.108 'POST /inbox HTTP/1.0' 200 0 '-' 'Lemmy/0.18.2; +https://lemmy.ml' 0.024983
Jul 19 14:54:25 lemdit lemmy_server[749]: 2023-07-19T02:54:25.580980Z WARN Error encountered while processing the incoming HTTP request: lemmy_server::root_span_builder: Timeout occurred while waiting for a slot to become available
Jul 19 14:54:25 lemdit lemmy_server[749]: 0: lemmy_apub::objects::person::read_from_id
Jul 19 14:54:25 lemdit lemmy_server[749]: at crates/apub/src/objects/person.rs:66
Jul 19 14:54:25 lemdit lemmy_server[749]: 1: lemmy_apub::fetcher::user_or_community::read_from_id
Jul 19 14:54:25 lemdit lemmy_server[749]: at crates/apub/src/fetcher/user_or_community.rs:47
Jul 19 14:54:25 lemdit lemmy_server[749]: 2: lemmy_server::root_span_builder::HTTP request
Jul 19 14:54:25 lemdit lemmy_server[749]: with http.method=POST http.scheme="https" http.host=lemdit.com http.target=/inbox otel.kind="server" request_id=626f8997-8cf5-45c3-9cd0-0d3a10401081 http.status_code=400 otel.status_code="OK"
Jul 19 14:54:25 lemdit lemmy_server[749]: at src/root_span_builder.rs:16
Jul 19 14:54:25 lemdit lemmy_server[749]: 3: tokio::task::runtime.spawn
Jul 19 14:54:25 lemdit lemmy_server[749]: with kind=local task.name= task.id=1605241 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/service.rs" loc.line=74 loc.col=17
Jul 19 14:54:25 lemdit lemmy_server[749]: at /home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs:16
Jul 19 14:54:25 lemdit lemmy_server[749]: 4: tokio::task::runtime.spawn
Jul 19 14:54:25 lemdit lemmy_server[749]: with kind=local task.name= task.id=23 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=367 loc.col=29
Jul 19 14:54:25 lemdit lemmy_server[749]: at /home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs:16
Jul 19 14:54:25 lemdit lemmy_server[749]: 5: tokio::task::runtime.spawn
Jul 19 14:54:25 lemdit lemmy_server[749]: with kind=block_on task.name= task.id=22 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=402 loc.col=32
Jul 19 14:54:25 lemdit lemmy_server[749]: at /home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs:16
Jul 19 14:54:25 lemdit lemmy_server[749]: LemmyError { message: None, inner: Timeout occurred while waiting for a slot to become available, context: SpanTrace [{ target: "lemmy_apub::objects::person", name: "read_from_id", file: "crates/apub/src/objects/person.rs", line: 66 }, { target: "lemmy_apub::fetcher::user_or_community", name: "read_from_id", file: "crates/apub/src/fetcher/user_or_community.rs", line: 47 }, { target: "lemmy_server::root_span_builder", name: "HTTP request", fields: "\u{1b}[3mhttp.method\u{1b}[0m\u{1b}[2m=\u{1b}[0mPOST \u{1b}[3mhttp.scheme\u{1b}[0m\u{1b}[2m=\u{1b}[0m"https" \u{1b}[3mhttp.host\u{1b}[0m\u{1b}[2m=\u{1b}[0mlemdit.com \u{1b}[3mhttp.target\u{1b}[0m\u{1b}[2m=\u{1b}[0m/inbox \u{1b}[3motel.kind\u{1b}[0m\u{1b}[2m=\u{1b}[0m"server" \u{1b}[3mrequest_id\u{1b}[0m\u{1b}[2m=\u{1b}[0m626f8997-8cf5-45c3-9cd0-0d3a10401081 \u{1b}[3mhttp.status_code\u{1b}[0m\u{1b}[2m=\u{1b}[0m400 \u{1b}[3motel.status_code\u{1b}[0m\u{1b}[2m=\u{1b}[0m"OK"", file: "src/root_span_builder.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=1605241 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/service.rs" loc.line=74 loc.col=17", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=23 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=367 loc.col=29", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=block_on task.name= task.id=22 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=402 loc.col=32", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }] }
Jul 19 14:54:25 lemdit lemmy_server[749]: 2023-07-19T02:54:25.581063Z INFO actix_web::middleware::logger: 54.36.178.108 'POST /inbox HTTP/1.0' 400 61 '-' 'Lemmy/0.18.2; +https://lemmy.ml' 5.001815
Jul 19 14:54:25 lemdit lemmy_server[749]: 2023-07-19T02:54:25.652182Z WARN Error encountered while processing the incoming HTTP request: lemmy_server::root_span_builder: Timeout occurred while waiting for a slot to become available
Jul 19 14:54:25 lemdit lemmy_server[749]: 0: lemmy_apub::objects::person::read_from_id
Jul 19 14:54:25 lemdit lemmy_server[749]: at crates/apub/src/objects/person.rs:66
Jul 19 14:54:25 lemdit lemmy_server[749]: 1: lemmy_apub::fetcher::user_or_community::read_from_id
Jul 19 14:54:25 lemdit lemmy_server[749]: at crates/apub/src/fetcher/user_or_community.rs:47
Jul 19 14:54:25 lemdit lemmy_server[749]: 2: lemmy_server::root_span_builder::HTTP request
Jul 19 14:54:25 lemdit lemmy_server[749]: with http.method=POST http.scheme="https" http.host=lemdit.com http.target=/inbox otel.kind="server" request_id=35d844db-8822-4ac6-8c13-cf7bab92a749 http.status_code=400 otel.status_code="OK"
Jul 19 14:54:25 lemdit lemmy_server[749]: at src/root_span_builder.rs:16
Jul 19 14:54:25 lemdit lemmy_server[749]: 3: tokio::task::runtime.spawn
Jul 19 14:54:25 lemdit lemmy_server[749]: with kind=local task.name= task.id=1605242 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/service.rs" loc.line=74 loc.col=17
Jul 19 14:54:25 lemdit lemmy_server[749]: at /home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs:16
Jul 19 14:54:25 lemdit lemmy_server[749]: 4: tokio::task::runtime.spawn
Jul 19 14:54:25 lemdit lemmy_server[749]: with kind=local task.name= task.id=27 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=367 loc.col=29
Jul 19 14:54:25 lemdit lemmy_server[749]: at /home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs:16
Jul 19 14:54:25 lemdit lemmy_server[749]: 5: tokio::task::runtime.spawn
Jul 19 14:54:25 lemdit lemmy_server[749]: with kind=block_on task.name= task.id=26 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=402 loc.col=32
Jul 19 14:54:25 lemdit lemmy_server[749]: at /home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs:16
Jul 19 14:54:25 lemdit lemmy_server[749]: LemmyError { message: None, inner: Timeout occurred while waiting for a slot to become available, context: SpanTrace [{ target: "lemmy_apub::objects::person", name: "read_from_id", file: "crates/apub/src/objects/person.rs", line: 66 }, { target: "lemmy_apub::fetcher::user_or_community", name: "read_from_id", file: "crates/apub/src/fetcher/user_or_community.rs", line: 47 }, { target: "lemmy_server::root_span_builder", name: "HTTP request", fields: "\u{1b}[3mhttp.method\u{1b}[0m\u{1b}[2m=\u{1b}[0mPOST \u{1b}[3mhttp.scheme\u{1b}[0m\u{1b}[2m=\u{1b}[0m"https" \u{1b}[3mhttp.host\u{1b}[0m\u{1b}[2m=\u{1b}[0mlemdit.com \u{1b}[3mhttp.target\u{1b}[0m\u{1b}[2m=\u{1b}[0m/inbox \u{1b}[3motel.kind\u{1b}[0m\u{1b}[2m=\u{1b}[0m"server" \u{1b}[3mrequest_id\u{1b}[0m\u{1b}[2m=\u{1b}[0m35d844db-8822-4ac6-8c13-cf7bab92a749 \u{1b}[3mhttp.status_code\u{1b}[0m\u{1b}[2m=\u{1b}[0m400 \u{1b}[3motel.status_code\u{1b}[0m\u{1b}[2m=\u{1b}[0m"OK"", file: "src/root_span_builder.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=1605242 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/service.rs" loc.line=74 loc.col=17", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=27 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=367 loc.col=29", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=block_on task.name= task.id=26 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=402 loc.col=32", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }] }
Jul 19 14:54:25 lemdit lemmy_server[749]: 2023-07-19T02:54:25.652268Z INFO actix_web::middleware::logger: 135.181.143.230 'POST /inbox HTTP/1.0' 400 61 '-' 'Lemmy/0.18.2-1-g68276b2f9; +https://lemmy.world' 5.001380
Jul 19 14:54:25 lemdit lemmy_server[749]: 2023-07-19T02:54:25.744999Z WARN Error encountered while processing the incoming HTTP request: lemmy_server::root_span_builder: Timeout occurred while waiting for a slot to become available
Jul 19 14:54:25 lemdit lemmy_server[749]: 0: lemmy_apub::objects::person::read_from_id
Jul 19 14:54:25 lemdit lemmy_server[749]: at crates/apub/src/objects/person.rs:66
Jul 19 14:54:25 lemdit lemmy_server[749]: 1: lemmy_apub::fetcher::user_or_community::read_from_id
Jul 19 14:54:25 lemdit lemmy_server[749]: at crates/apub/src/fetcher/user_or_community.rs:47
Jul 19 14:54:25 lemdit lemmy_server[749]: 2: lemmy_server::root_span_builder::HTTP request
Jul 19 14:54:25 lemdit lemmy_server[749]: with http.method=POST http.scheme="https" http.host=lemdit.com http.target=/inbox otel.kind="server" request_id=5acf8a3d-163c-430b-807e-f0f08edc0c64 http.status_code=400 otel.status_code="OK"
Jul 19 14:54:25 lemdit lemmy_server[749]: at src/root_span_builder.rs:16
Jul 19 14:54:25 lemdit lemmy_server[749]: 3: tokio::task::runtime.spawn
Jul 19 14:54:25 lemdit lemmy_server[749]: with kind=local task.name= task.id=1605243 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/service.rs" loc.line=74 loc.col=17
Jul 19 14:54:25 lemdit lemmy_server[749]: at /home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs:16
Jul 19 14:54:25 lemdit lemmy_server[749]: 4: tokio::task::runtime.spawn
Jul 19 14:54:25 lemdit lemmy_server[749]: with kind=local task.name= task.id=31 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=367 loc.col=29
Jul 19 14:54:25 lemdit lemmy_server[749]: at /home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs:16
Jul 19 14:54:25 lemdit lemmy_server[749]: 5: tokio::task::runtime.spawn
Jul 19 14:54:25 lemdit lemmy_server[749]: with kind=block_on task.name= task.id=30 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=402 loc.col=32
Jul 19 14:54:25 lemdit lemmy_server[749]: at /home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs:16
Jul 19 14:54:25 lemdit lemmy_server[749]: LemmyError { message: None, inner: Timeout occurred while waiting for a slot to become available, context: SpanTrace [{ target: "lemmy_apub::objects::person", name: "read_from_id", file: "crates/apub/src/objects/person.rs", line: 66 }, { target: "lemmy_apub::fetcher::user_or_community", name: "read_from_id", file: "crates/apub/src/fetcher/user_or_community.rs", line: 47 }, { target: "lemmy_server::root_span_builder", name: "HTTP request", fields: "\u{1b}[3mhttp.method\u{1b}[0m\u{1b}[2m=\u{1b}[0mPOST \u{1b}[3mhttp.scheme\u{1b}[0m\u{1b}[2m=\u{1b}[0m"https" \u{1b}[3mhttp.host\u{1b}[0m\u{1b}[2m=\u{1b}[0mlemdit.com \u{1b}[3mhttp.target\u{1b}[0m\u{1b}[2m=\u{1b}[0m/inbox \u{1b}[3motel.kind\u{1b}[0m\u{1b}[2m=\u{1b}[0m"server" \u{1b}[3mrequest_id\u{1b}[0m\u{1b}[2m=\u{1b}[0m5acf8a3d-163c-430b-807e-f0f08edc0c64 \u{1b}[3mhttp.status_code\u{1b}[0m\u{1b}[2m=\u{1b}[0m400 \u{1b}[3motel.status_code\u{1b}[0m\u{1b}[2m=\u{1b}[0m"OK"", file: "src/root_span_builder.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=1605243 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/service.rs" loc.line=74 loc.col=17", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=31 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=367 loc.col=29", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=block_on task.name= task.id=30 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=402 loc.col=32", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }] }
Jul 19 14:54:25 lemdit lemmy_server[749]: 2023-07-19T02:54:25.745070Z INFO actix_web::middleware::logger: 54.36.178.108 'POST /inbox HTTP/1.0' 400 61 '-' 'Lemmy/0.18.2; +https://lemmy.ml' 5.001828
Jul 19 14:54:26 lemdit lemmy_server[749]: 2023-07-19T02:54:26.125780Z WARN Error encountered while processing the incoming HTTP request: lemmy_server::root_span_builder: Timeout occurred while waiting for a slot to become available
Jul 19 14:54:26 lemdit lemmy_server[749]: 0: lemmy_apub::objects::person::read_from_id
Jul 19 14:54:26 lemdit lemmy_server[749]: at crates/apub/src/objects/person.rs:66
Jul 19 14:54:26 lemdit lemmy_server[749]: 1: lemmy_apub::fetcher::user_or_community::read_from_id
Jul 19 14:54:26 lemdit lemmy_server[749]: at crates/apub/src/fetcher/user_or_community.rs:47
Jul 19 14:54:26 lemdit lemmy_server[749]: 2: lemmy_server::root_span_builder::HTTP request
Jul 19 14:54:26 lemdit lemmy_server[749]: with http.method=POST http.scheme="https" http.host=lemdit.com http.target=/inbox otel.kind="server" request_id=d6e8011a-f9f4-4164-9cff-1c8495d1b3bc http.status_code=400 otel.status_code="OK"
Jul 19 14:54:26 lemdit lemmy_server[749]: at src/root_span_builder.rs:16
Jul 19 14:54:26 lemdit lemmy_server[749]: 3: tokio::task::runtime.spawn
Jul 19 14:54:26 lemdit lemmy_server[749]: with kind=local task.name= task.id=1605244 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/service.rs" loc.line=74 loc.col=17
Jul 19 14:54:26 lemdit lemmy_server[749]: at /home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs:16
Jul 19 14:54:26 lemdit lemmy_server[749]: 4: tokio::task::runtime.spawn
Jul 19 14:54:26 lemdit lemmy_server[749]: with kind=local task.name= task.id=35 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=367 loc.col=29
Jul 19 14:54:26 lemdit lemmy_server[749]: at /home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs:16
Jul 19 14:54:26 lemdit lemmy_server[749]: 5: tokio::task::runtime.spawn
Jul 19 14:54:26 lemdit lemmy_server[749]: with kind=block_on task.name= task.id=34 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=402 loc.col=32
Jul 19 14:54:26 lemdit lemmy_server[749]: at /home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs:16
Jul 19 14:54:26 lemdit lemmy_server[749]: LemmyError { message: None, inner: Timeout occurred while waiting for a slot to become available, context: SpanTrace [{ target: "lemmy_apub::objects::person", name: "read_from_id", file: "crates/apub/src/objects/person.rs", line: 66 }, { target: "lemmy_apub::fetcher::user_or_community", name: "read_from_id", file: "crates/apub/src/fetcher/user_or_community.rs", line: 47 }, { target: "lemmy_server::root_span_builder", name: "HTTP request", fields: "\u{1b}[3mhttp.method\u{1b}[0m\u{1b}[2m=\u{1b}[0mPOST \u{1b}[3mhttp.scheme\u{1b}[0m\u{1b}[2m=\u{1b}[0m"https" \u{1b}[3mhttp.host\u{1b}[0m\u{1b}[2m=\u{1b}[0mlemdit.com \u{1b}[3mhttp.target\u{1b}[0m\u{1b}[2m=\u{1b}[0m/inbox \u{1b}[3motel.kind\u{1b}[0m\u{1b}[2m=\u{1b}[0m"server" \u{1b}[3mrequest_id\u{1b}[0m\u{1b}[2m=\u{1b}[0md6e8011a-f9f4-4164-9cff-1c8495d1b3bc \u{1b}[3mhttp.status_code\u{1b}[0m\u{1b}[2m=\u{1b}[0m400 \u{1b}[3motel.status_code\u{1b}[0m\u{1b}[2m=\u{1b}[0m"OK"", file: "src/root_span_builder.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=1605244 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/service.rs" loc.line=74 loc.col=17", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=35 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=367 loc.col=29", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=block_on task.name= task.id=34 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=402 loc.col=32", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }] }

... This carries on, eventually it turns into:

Jul 19 14:54:34 lemdit lemmy_server[749]: 2023-07-19T02:54:34.741543Z INFO actix_web::middleware::logger: 135.181.143.230 'POST /inbox HTTP/1.0' 400 61 '-' 'Lemmy/0.18.2-1-g68276b2f9; +https://lemmy.world' 5.002246
Jul 19 14:54:34 lemdit lemmy_server[749]: thread 'actix-server worker 6' panicked at 'read local site data: LemmyError { message: None, inner: Timeout occurred while waiting for a slot to become available, context: SpanTrace [{ target: "lemmy_server::root_span_builder", name: "HTTP request", fields: "\u{1b}[3mhttp.method\u{1b}[0m\u{1b}[2m=\u{1b}[0mPOST \u{1b}[3mhttp.scheme\u{1b}[0m\u{1b}[2m=\u{1b}[0m"https" \u{1b}[3mhttp.host\u{1b}[0m\u{1b}[2m=\u{1b}[0mlemdit.com \u{1b}[3mhttp.target\u{1b}[0m\u{1b}[2m=\u{1b}[0m/inbox \u{1b}[3motel.kind\u{1b}[0m\u{1b}[2m=\u{1b}[0m"server" \u{1b}[3mrequest_id\u{1b}[0m\u{1b}[2m=\u{1b}[0mfbe38939-6622-4526-a83f-bcfa2b6abc37", file: "src/root_span_builder.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=1605310 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/service.rs" loc.line=74 loc.col=17", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=43 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=367 loc.col=29", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=block_on task.name= task.id=42 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=402 loc.col=32", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }] }', crates/apub/src/lib.rs:51:8
Jul 19 14:54:34 lemdit lemmy_server[749]: note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
Jul 19 14:54:34 lemdit lemmy_server[749]: thread 'actix-server worker 1' panicked at 'read local site data: LemmyError { message: None, inner: Timeout occurred while waiting for a slot to become available, context: SpanTrace [{ target: "lemmy_server::root_span_builder", name: "HTTP request", fields: "\u{1b}[3mhttp.method\u{1b}[0m\u{1b}[2m=\u{1b}[0mPOST \u{1b}[3mhttp.scheme\u{1b}[0m\u{1b}[2m=\u{1b}[0m"https" \u{1b}[3mhttp.host\u{1b}[0m\u{1b}[2m=\u{1b}[0mlemdit.com \u{1b}[3mhttp.target\u{1b}[0m\u{1b}[2m=\u{1b}[0m/inbox \u{1b}[3motel.kind\u{1b}[0m\u{1b}[2m=\u{1b}[0m"server" \u{1b}[3mrequest_id\u{1b}[0m\u{1b}[2m=\u{1b}[0m4e414a48-0d41-4ae2-8f2a-842624444fd3", file: "src/root_span_builder.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=1605313 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/service.rs" loc.line=74 loc.col=17", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=23 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=367 loc.col=29", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=block_on task.name= task.id=22 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=402 loc.col=32", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }] }', crates/apub/src/lib.rs:51:8
Jul 19 14:54:34 lemdit lemmy_server[749]: thread 'actix-server worker 2' panicked at 'read local site data: LemmyError { message: None, inner: Timeout occurred while waiting for a slot to become available, context: SpanTrace [{ target: "lemmy_server::root_span_builder", name: "HTTP request", fields: "\u{1b}[3mhttp.method\u{1b}[0m\u{1b}[2m=\u{1b}[0mPOST \u{1b}[3mhttp.scheme\u{1b}[0m\u{1b}[2m=\u{1b}[0m"https" \u{1b}[3mhttp.host\u{1b}[0m\u{1b}[2m=\u{1b}[0mlemdit.com \u{1b}[3mhttp.target\u{1b}[0m\u{1b}[2m=\u{1b}[0m/inbox \u{1b}[3motel.kind\u{1b}[0m\u{1b}[2m=\u{1b}[0m"server" \u{1b}[3mrequest_id\u{1b}[0m\u{1b}[2m=\u{1b}[0mcee1f4c7-536e-4827-85ef-7a66cbc26138", file: "src/root_span_builder.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=1605314 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/service.rs" loc.line=74 loc.col=17", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=27 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=367 loc.col=29", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=block_on task.name= task.id=26 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=402 loc.col=32", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }] }', crates/apub/src/lib.rs:51:8
Jul 19 14:54:34 lemdit lemmy_server[749]: thread 'actix-server worker 3' panicked at 'read local site data: LemmyError { message: None, inner: Timeout occurred while waiting for a slot to become available, context: SpanTrace [{ target: "lemmy_server::root_span_builder", name: "HTTP request", fields: "\u{1b}[3mhttp.method\u{1b}[0m\u{1b}[2m=\u{1b}[0mPOST \u{1b}[3mhttp.scheme\u{1b}[0m\u{1b}[2m=\u{1b}[0m"https" \u{1b}[3mhttp.host\u{1b}[0m\u{1b}[2m=\u{1b}[0mlemdit.com \u{1b}[3mhttp.target\u{1b}[0m\u{1b}[2m=\u{1b}[0m/inbox \u{1b}[3motel.kind\u{1b}[0m\u{1b}[2m=\u{1b}[0m"server" \u{1b}[3mrequest_id\u{1b}[0m\u{1b}[2m=\u{1b}[0m2d0f629c-d982-40b0-957c-330c6edfad46", file: "src/root_span_builder.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=1605315 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/service.rs" loc.line=74 loc.col=17", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=31 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=367 loc.col=29", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=block_on task.name= task.id=30 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=402 loc.col=32", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }] }', crates/apub/src/lib.rs:51:8
Jul 19 14:54:34 lemdit lemmy_server[749]: thread 'actix-server worker 4' panicked at 'read local site data: LemmyError { message: None, inner: Timeout occurred while waiting for a slot to become available, context: SpanTrace [{ target: "lemmy_server::root_span_builder", name: "HTTP request", fields: "\u{1b}[3mhttp.method\u{1b}[0m\u{1b}[2m=\u{1b}[0mPOST \u{1b}[3mhttp.scheme\u{1b}[0m\u{1b}[2m=\u{1b}[0m"https" \u{1b}[3mhttp.host\u{1b}[0m\u{1b}[2m=\u{1b}[0mlemdit.com \u{1b}[3mhttp.target\u{1b}[0m\u{1b}[2m=\u{1b}[0m/inbox \u{1b}[3motel.kind\u{1b}[0m\u{1b}[2m=\u{1b}[0m"server" \u{1b}[3mrequest_id\u{1b}[0m\u{1b}[2m=\u{1b}[0mf002526b-9a73-43d2-a711-67278be02a88", file: "src/root_span_builder.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=1605316 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/service.rs" loc.line=74 loc.col=17", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=local task.name= task.id=35 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=367 loc.col=29", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }, { target: "tokio::task", name: "runtime.spawn", fields: "kind=block_on task.name= task.id=34 loc.file="/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.1.1/src/worker.rs" loc.line=402 loc.col=32", file: "/home/lemdit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/util/trace.rs", line: 16 }] }', crates/apub/src/lib.rs:51:8

The error continued until the Lemmy server service was restarted.

Version

BE: 0.18.2

Lemmy Instance URL

https://lemdit.com

@delendum delendum added the bug Something isn't working label Jul 19, 2023
@verymilan
Copy link

also just started to happen at discuss.tchncs.de 🤔

@RikudouSage
Copy link

Happens on lemmings.world as well.

@Crashdoom
Copy link

Also happened on pawb.social, restarted the postgres container and it seemed to temporarily fix it. Looks like this is not a new issue: #3112 and isn't isolated as a ton of outbound requests to other instances are failing.

@Crashdoom
Copy link

lemmy.ml also appears to be offline @dessalines @Nutomic

@verymilan
Copy link

Hmm i was quite generous with the postgres settings and hardware resources... and its a bit suspicious how we gather with the same problem like this :)

@RikudouSage
Copy link

lemmy.ml also appears to be offline @dessalines @Nutomic

And the link on the error page that should lead to the Matrix room leads to the support forum (which is offline together with the whole instance).

@phiresky
Copy link
Collaborator

phiresky commented Jul 24, 2023

This error comes from diesel-async / deadpool. The cause is pool exhaustion, the pool is full. The reason is too many DB queries running. The stack traces will be useless because it's unrelated to the query that times out. The relevant timeout is POOL_TIMEOUT in db_schema/src/util.rs.

To diagnose, set alter system set pg_stat_statements.track='all';. Then look at select * from pg_stat_statements order by total_exec_time desc limit 10 after a while of running.

Quick workarounds would include setting `alter system set statement_timeout = '10s'; to kill long running queries that are the most likely cause of the contention, and increasing the db pool size.

It's probably an unintentional or intentional DDOS since real activity hasn't really improved much in the past week afaik. #3704 will probably improve it. There must be more other queries that take up pool space, since the db should be no where near the limit with the current amount of activity.

@Nutomic
Copy link
Member

Nutomic commented Jul 24, 2023

Here are slow from lemmy.ml from the last few hours by mean execution time, captured with sudo docker-compose exec postgres psql -U lemmy -c "select * from pg_stat_statements order by mean_exec_time desc limit 10;" -P pager=off --expanded > ~/slow_queries.log. I forgot to set pg_stat_statements.track='all' though.

There are many queries for post/comment deletion and removal which should be optimized by #3704. However there are also select queries with up to 30s mean execution time. I wonder where these are coming from, because they are called very rarely and I cant think of any page which takes so long to load. Maybe scheduled tasks?

@phiresky
Copy link
Collaborator

phiresky commented Jul 24, 2023

Thanks for sharing. Of those top 10 queries:

@Nutomic
Copy link
Member

Nutomic commented Jul 26, 2023

Here are more stats of lemmy.ml slow queries.

  • There are some very slow queries using COPY x TO stdout, I suppose these are from backups using pg_dumpall. - You can also clearly see queries for user deletion with UPDATE "post" SET "removed" = $1, "updated" = $2 WHERE ("post"."creator_id" = $3) taking 115s on average. That probably needs to be handled with a scheduled task which updates 1000 rows or so at a time.
  • INSERT INTO "site" is oddly slow, taking up to 50 seconds. There is a trigger but it only performs a simple insert to site_aggregates.
  • There are some quite slow insertions into post table (22s) which are coming from federation code (ON CONFLICT ("ap_id") DO UPDATE)

@phiresky
Copy link
Collaborator

phiresky commented Jul 26, 2023

  • Yeah, you can ignore the COPY ones.
  • The delete from activity query is coming from the scheduled task. That's why i said it should probably be an index on published for that table
  • The update post set removed=x is probably due to the O(n^2) triggers, not directly due to user deletion being slow intrinsically. See Move expensive DB triggers to scheduled jobs. #3528 (comment) . If it's still a problem after that's fixed, then yeah it should probably be in a scheduled task.
  • Not sure about that insert into site query. I see no reason for it to be slow intrinsically. Might be some long-running transactions with locks it has to wait for.
  • Same for insert post query. Nothing obvious, maybe a locking transaction. But really that query should only happen ~once for each post, and locks on different rows wouldn't affect each other.
  • Would be good if you can turn on alter system set pg_stat_statements.track='all'; select pg_reload_conf() so we can also see the triggers taking a long time Edit: I see that it is turned on. You can see maybe see the slow trigger on post delete as Record 18 (update person_aggregates ua ...) though that seems to be related to comment delete not post delete

@Nutomic
Copy link
Member

Nutomic commented Oct 2, 2023

Havent seen this problem anymore, should be fixed by code optimizations and config changes (db query timeout/pool size).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: database bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants