erickt / erickt/rust-zmq

Unbind fails in release mode on Windows using IPC transport

Open
#415 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
997
Forks
212
PR merge metrics
No merged PRs in 30d

Description

**Issue**

When using the `zmq` crate (version `0.10.0`) on Windows, calling `unbind` on an IPC socket works correctly in debug mode (`cargo run`) but fails in release mode (`cargo run --release`). The code panics with:

```
called `Result::unwrap()` on an `Err` value: No such file or directory
```

This seems to indicate that `unbind` cannot find the path, despite it being the exact same path used in the preceding `bind` call.

**Platform**
- OS: Windows
- Crate version: `zmq = "0.10.0"`
- Rust: stable
- Transport: IPC

**Reproduction**

```rust
fn main() {
let context = zmq::Context::new();
let socket_path = "ipc://test_soc";

let responder = context.socket(zmq::REP).unwrap();
responder.bind(socket_path).unwrap();

responder.unbind(socket_path).unwrap(); // <- fails in release mode
}
```

**`Cargo.toml`**

```toml
[dependencies]
zmq = "0.10.0"
```

**Steps to reproduce**

1. Run in debug mode (works fine):
```
cargo run
```

2. Run in release mode (fails):
```
cargo run --release
```

**Expected Behavior**

`unbind` should succeed in release mode just like it does in debug mode, using the same code and socket path.

**Additional Notes**

- This might relate to compiler optimizations, IPC path handling on Windows, or a race condition exposed only in release builds.
- The behavior is consistent and reproducible.
- If I try this with TCP, inproc, it works.
- If I try this using C++, it works.

Please let me know if further diagnostics or logs are needed.

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied Rust reproduction with zmq 0.10.0 on Windows using both `cargo run` and `cargo run --release`. Investigate the IPC bind/unbind path and compare the release behavior with TCP, inproc, and the reported C++ behavior; done means `responder.unbind(socket_path)` succeeds in release mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.