Skip to content

Got error.ConnectionResetByPeer on receive. This indicates that a previous message did not find a valid destination. #1322

Closed

Description

@Argmaster

When leaving local world:

Got error.ConnectionResetByPeer on receive. This indicates that a previous message did not find a valid destination.

I will investigate how to reproduce it soon. Found while working on SBBs. Not sure if save matters, including in case it does.

latest.log

Save1.zip

Activity

  1. IntegratedQuantum commented on Apr 21, 2025

    @IntegratedQuantum
    Member

    That's weird. This means that your operating system cleaned up the network connection before the other side received the disconnect signal (which is sent before closing the socket).

  2. Argmaster commented on Apr 21, 2025

    @Argmaster
    CollaboratorAuthor

    I should have mentioned that this is on Windows 11, I get this consistently when leaving local worlds.

  3. IntegratedQuantum commented on Apr 26, 2025

    @IntegratedQuantum
    Member

    Alright, so previously the disconnect function would wait for a total of 30 ms after sending the disconnect signal before closing the socket.
    So I guess we could just reintroduce some delay. Could check if adding this code in network.zig helps?

    --- a/src/network.zig
    +++ b/src/network.zig
    @@ -2079,6 +2079,9 @@ pub const Connection = struct { // MARK: Connection
            pub fn disconnect(self: *Connection) void {
                    self.manager.send(&.{@intFromEnum(ChannelId.disconnect)}, self.remoteAddress, null);
                    self.connectionState.store(.disconnectDesired, .unordered);
    +               if(builtin.os.tag == .windows and !self.isServerSide() and main.server.world != null) {
    +                       std.time.sleep(10000000);
    +               }
                    self.manager.removeConnection(self);
                    if(self.user) |user| {
                            main.server.disconnect(user);
  4. Argmaster commented on Apr 26, 2025

    @Argmaster
    CollaboratorAuthor

    Yes, after that change I was not able to reproduce the error anymore.

  5. added a commit that references this issue on Apr 26, 2025
    6fc7e60
  6. calebstenberg commented on Aug 12, 2026

    @calebstenberg
    Contributor

    @IntegratedQuantum I keep getting the error. I didn't in 3.0 but it did start a while ago. It may have started after This PR
    @Argmaster Are you getting this again?

  7. Argmaster commented on Aug 12, 2026

    @Argmaster
    CollaboratorAuthor

    I saw it, but it might have been when I was ungracefully closing the game, I have to double check.

  8. IntegratedQuantum commented on Aug 12, 2026

    @IntegratedQuantum
    Member

    Please make a new issue then.

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 in the intended waynetworkIssues with the protocol

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions