Skip to content

fix: set TcpListener to non-blocking before registering with Tokio#8

Open
qianxiaoming wants to merge 1 commit into
chrislyonsKY:mainfrom
qianxiaoming:fix/blocking_socket
Open

fix: set TcpListener to non-blocking before registering with Tokio#8
qianxiaoming wants to merge 1 commit into
chrislyonsKY:mainfrom
qianxiaoming:fix/blocking_socket

Conversation

@qianxiaoming
Copy link
Copy Markdown

Description
This PR fixes a runtime panic when running the example report server.

Reproduction
Environment:
• Rust 1.94.0
• macOS 26.4

Command:

cargo run -- check examples/datasets/simple_points.geojson

Output:

[INFO ] Discovered 15 rules
[INFO ] Check complete: 0 findings from 15 rules
[INFO ] Report server running at http://127.0.0.1:53100
[INFO ] Opening report at http://127.0.0.1:53100

thread 'main' (516969) panicked at src/report/visual/server.rs:77:20:
Registering a blocking socket with the tokio runtime is unsupported. If you wish to do anyways, please add --cfg tokio_allow_from_blocking_fd to your RUSTFLAGS. See github.com/tokio-rs/tokio/issues/7172 for details.
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Fix
Set the TcpListener to non-blocking before registering it with Tokio:

listener.set_nonblocking(true)?;

This prevents the panic and allows the report server to run correctly.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant