Skip to content

Conversation

@Rexicon226
Copy link
Contributor

Correctly uses the netReceive API.
If an error was returned, we propagate that error, otherwise assert we only received one message.

follow-up question: for these types of tests where we need to bind to a specific port, how to decide the port?
can't use port 0 here, since we're binding, not allocating a port.
i just used port 8000, but i'd like to avoid hardcoding it if possible.

@Rexicon226 Rexicon226 changed the title Io: fix compile error in receive and receiveTimeout Io.net: fix compile error in receive and receiveTimeout Nov 6, 2025
@alexrp
Copy link
Member

alexrp commented Nov 6, 2025

Can this sort of test even be made non-flaky?

@Rexicon226
Copy link
Contributor Author

Rexicon226 commented Nov 7, 2025

Probably not. Should I just remove it?
At least that test revealed another bug for 32-bit msghdr targets (message is set to undefined, which makes @intCast(message.control.len) panic when controllen is u32). Honestly the "setting message to undefined" thing is kinda bad. It also makes valgrind trip up, since we pass undefined pointer to a syscall.

@alexrp
Copy link
Member

alexrp commented Nov 7, 2025

We generally have a "no flaky tests" policy, to the point where intermittently failing tests get disabled until someone figures out what's wrong with them. So I think a test like this just isn't going to be practical unless someone has a reasonable suggestion for solving the problem of concurrent test processes using the same port.

@Rexicon226
Copy link
Contributor Author

Rexicon226 commented Nov 7, 2025

Understood, I'll remove this test then.
Now I'm thinking how to solve this 32-bit controllen thing, probably just the simplest solution; set message to something slightly less undefined.

Wait there's literally an init decl literal, I missed this. I'll just set it to that.

Correctly uses the `netReceive` API. If an error was
returned, we propagate that error, otherwise assert
we only received one message.
If we use `undefined`, then `netReceive` can `@intCast` the
control slice len to msghdr controllen, which is sometimes `u32`,
even on 64-bit platforms.

`init` just avoids this entirely by setting `control` to an empty
slice rather than undefined.
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.

2 participants