Skip to content

Minor, panic in Rust must be treated as an exceptional event. #33

Description

@drejabi

Hi, Great work I must say!
Minor issue, if a rustdesk client has a different, not same public key as the server is running with, the hbbs service throws some panic statements in the log file!

Running "sctg/sctgdesk-server:latest" with docker compose on UB 24 LTS

Log details:
{"log":"\n","stream":"stderr","time":"2026-01-29T18:45:03.3032246Z"}
{"log":"thread 'rocket-worker-thread' (18) panicked at /root/.cargo/git/checkouts/sctgdesk-api-server-0857e1001ad9c80e/b5e300c/libs/utils/src/tokens.rs:41:13:\n","stream":"stderr",">
{"log":"copy_from_slice: source slice length (24) does not match destination slice length (32)\n","stream":"stderr","time":"2026-01-29T18:45:03.303291534Z"}
{"log":"note: run with RUST_BACKTRACE=1 environment variable to display a backtrace\n","stream":"stderr","time":"2026-01-29T18:45:03.303314359Z"}
{"log":"2026-01-29 18:45:03.302460144 +00:00 [INFO] server.rs:327 - Matched: (current_user) POST /api/currentUser application/json\n","stream":"stdout","time":"2026-01-29T18:45:03.3>
{"log":"2026-01-29 18:45:03.303714745 +00:00 [ERROR] server.rs:58 - Handler current_user panicked.\n","stream":"stdout","time":"2026-01-29T18:45:03.304421656Z"}
{"log":"2026-01-29 18:45:03.303746457 +00:00 [INFO] server.rs:58 - This is an application bug.\n","stream":"stdout","time":"2026-01-29T18:45:03.304466796Z"}
{"log":"2026-01-29 18:45:03.303757303 +00:00 [INFO] server.rs:58 - A panic in Rust must be treated as an exceptional event.\n","stream":"stdout","time":"2026-01-29T18:45:03.30449051>
{"log":"2026-01-29 18:45:03.303764728 +00:00 [INFO] server.rs:58 - Panicking is not a suitable error handling mechanism.\n","stream":"stdout","time":"2026-01-29T18:45:03.304537966Z"}
{"log":"2026-01-29 18:45:03.303771776 +00:00 [INFO] server.rs:58 - Unwinding, the result of a panic, is an expensive operation.\n","stream":"stdout","time":"2026-01-29T18:45:03.3045>
{"log":"2026-01-29 18:45:03.303778237 +00:00 [INFO] server.rs:58 - Panics will degrade application performance.\n","stream":"stdout","time":"2026-01-29T18:45:03.304584847Z"}
{"log":"2026-01-29 18:45:03.303785476 +00:00 [INFO] server.rs:58 - Instead of panicking, return Option and/or Result.\n","stream":"stdout","time":"2026-01-29T18:45:03.304605892Z>
{"log":"2026-01-29 18:45:03.304072485 +00:00 [INFO] server.rs:58 - Values of either type can be returned directly from handlers.\n","stream":"stdout","time":"2026-01-29T18:45:03.304>
{"log":"2026-01-29 18:45:03.304082532 +00:00 [WARN] server.rs:58 - A panic is treated as an internal server error.\n","stream":"stdout","time":"2026-01-29T18:45:03.304649882Z"}
{"log":"2026-01-29 18:45:03.304089979 +00:00 [INFO] server.rs:337 - Outcome: Error(500 Internal Server Error)\n","stream":"stdout","time":"2026-01-29T18:45:03.305972154Z"}
{"log":"2026-01-29 18:45:03.305089669 +00:00 [WARN] server.rs:376 - No 500 catcher registered. Using Rocket default.\n","stream":"stdout","time":"2026-01-29T18:45:03.306017586Z"}
{"log":"2026-01-29 18:45:03.305293601 +00:00 [INFO] server.rs:132 - Response succeeded.\n","stream":"stdout","time":"2026-01-29T18:45:03.306515947Z"}
{"log":"\n","stream":"stderr","time":"2026-01-29T18:45:03.666745378Z"}
{"log":"thread 'rocket-worker-thread' (17) panicked at /root/.cargo/git/checkouts/sctgdesk-api-server-0857e1001ad9c80e/b5e300c/libs/utils/src/tokens.rs:41:13:\n","stream":"stderr",">
{"log":"copy_from_slice: source slice length (24) does not match destination slice length (32)\n","stream":"stderr","time":"2026-01-29T18:45:03.666821193Z"}
{"log":"2026-01-29 18:45:03.666318415 +00:00 [INFO] server.rs:252 - POST /api/ab/personal application/json:\n","stream":"stdout","time":"2026-01-29T18:45:03.666875412Z"}
{"log":"2026-01-29 18:45:03.666383267 +00:00 [INFO] server.rs:327 - Matched: (ab_personal) POST /api/ab/personal\n","stream":"stdout","time":"2026-01-29T18:45:03.667466146Z"}
{"log":"2026-01-29 18:45:03.667385448 +00:00 [ERROR] server.rs:58 - Handler ab_personal panicked.\n","stream":"stdout","time":"2026-01-29T18:45:03.66858568Z"}
{"log":"2026-01-29 18:45:03.668150081 +00:00 [INFO] server.rs:58 - This is an application bug.\n","stream":"stdout","time":"2026-01-29T18:45:03.669182173Z"}
{"log":"2026-01-29 18:45:03.668163650 +00:00 [INFO] server.rs:58 - A panic in Rust must be treated as an exceptional event.\n","stream":"stdout","time":"2026-01-29T18:45:03.66921154>
{"log":"2026-01-29 18:45:03.668230678 +00:00 [INFO] server.rs:58 - Panicking is not a suitable error handling mechanism.\n","stream":"stdout","time":"2026-01-29T18:45:03.66922473Z"}
{"log":"2026-01-29 18:45:03.668236567 +00:00 [INFO] server.rs:58 - Unwinding, the result of a panic, is an expensive operation.\n","stream":"stdout","time":"2026-01-29T18:45:03.6692>
{"log":"2026-01-29 18:45:03.668242401 +00:00 [INFO] server.rs:58 - Panics will degrade application performance.\n","stream":"stdout","time":"2026-01-29T18:45:03.669290529Z"}
{"log":"2026-01-29 18:45:03.668249153 +00:00 [INFO] server.rs:58 - Instead of panicking, return Option and/or Result.\n","stream":"stdout","time":"2026-01-29T18:45:03.669301076Z>
{"log":"2026-01-29 18:45:03.668254135 +00:00 [INFO] server.rs:58 - Values of either type can be returned directly from handlers.\n","stream":"stdout","time":"2026-01-29T18:45:03.669>
{"log":"2026-01-29 18:45:03.668260468 +00:00 [WARN] server.rs:58 - A panic is treated as an internal server error.\n","stream":"stdout","time":"2026-01-29T18:45:03.669321848Z"}
{"log":"2026-01-29 18:45:03.668266387 +00:00 [INFO] server.rs:337 - Outcome: Error(500 Internal Server Error)\n","stream":"stdout","time":"2026-01-29T18:45:03.669331563Z"}
{"log":"2026-01-29 18:45:03.668279539 +00:00 [WARN] server.rs:376 - No 500 catcher registered. Using Rocket default.\n","stream":"stdout","time":"2026-01-29T18:45:03.669341193Z"}
{"log":"2026-01-29 18:45:03.668482806 +00:00 [INFO] server.rs:132 - Response succeeded.\n","stream":"stdout","time":"2026-01-29T18:45:03.669353992Z"}
{"log":"2026-01-29 18:45:03.769665556 +00:00 [INFO] server.rs:252 - GET /api/device-group/accessible?current=1\u0026pageSize=100:\n","stream":"stdout","time":"2026-01-29T18:45:03.77>
{"log":"2026-01-29 18:45:03.769742059 +00:00 [ERROR] server.rs:344 - No matching routes for GET /api/device-group/accessible?current=1\u0026pageSize=100.\n","stream":"stdout","time">
{"log":"2026-01-29 18:45:03.769755052 +00:00 [WARN] server.rs:376 - No 404 catcher registered. Using Rocket default.\n","stream":"stdout","time":"2026-01-29T18:45:03.770548969Z"}
{"log":"2026-01-29 18:45:03.769839143 +00:00 [INFO] server.rs:132 - Response succeeded.\n","stream":"stdout","time":"2026-01-29T18:45:03.770561429Z"}
{"log":"2026-01-29 18:45:04.052274475 +00:00 [INFO] server.rs:252 - GET /api/ab:\n","stream":"stdout","time":"2026-01-29T18:45:04.052669358Z"}
{"log":"2026-01-29 18:45:04.052349197 +00:00 [INFO] server.rs:327 - Matched: (ab_get) GET /api/ab application/json\n","stream":"stdout","time":"2026-01-29T18:45:04.052747601Z"}
{"log":"\n","stream":"stderr","time":"2026-01-29T18:45:04.054185169Z"}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions