microsoft / microsoft/demikernel

[catnap] Windows: connect incorrectly signals completion

Open
#971 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
1.2k
Forks
151
PR merge metrics
No merged PRs in 30d

Description

Description

In catnap/socket.rs impl Socket method try_connect calls connect on the underlying socket2::Socket. The result handling code from this call treats the WSAEWOULDBLOCK error code as positive confirmation of connection. If the user then issues another operation on the socket prior to the connection completing, the user may see unpredictable behavior.

How to Reproduce

int qt;
assert(demi_connect(&qt, ...) == 0);
assert(demi_wait(&qr, qt, ...) == 0);
assert(demi_pop(&qt, ...) == 0);

demi_wait(&qr, qt, ...) == ?

The final demi_wait call may indicate WSAENOTCONN.

Expected Behavior

demi_wait should not indicate completion of a complete qt until the underlying connection is established. This likely requires the catnap backend to poll the completion state of the connection. An example can be found in socket2 internals: sys::poll_connect for the Windows target.

Related Issues

None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in catnap/socket.rs at impl Socket::try_connect and inspect how the underlying socket2::Socket connect result is handled on Windows. Compare the completion-state approach with socket2's Windows sys::poll_connect and reproduce the demi_connect, demi_wait, and demi_pop sequence. Done means demi_wait does not report completion until the underlying connection is established.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.