Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] WebSocketBot tries to send different pieces of data simutaneously, causing an error #2804

Open
4 tasks done
DGCK81LNN opened this issue Oct 10, 2024 · 0 comments
Open
4 tasks done
Labels
a:bug Crash or feature not working as expected

Comments

@DGCK81LNN
Copy link

DGCK81LNN commented Oct 10, 2024

Prerequisites

  • I made sure I am running the latest development build
  • I tried to look for similar issues before opening a new one
  • I have set debugmessages=true in config to diagnose my issue
  • I have redacted session tokens and passwords before attaching screenshots

Minecraft Version

1.18.2

Console Client Version

20240906-276

Expected Behavior

The WebSocketBot should use a lock, request queue or something else to prevent webSocket.SendAsync() being called before the previous send operation finishes.

Actual Behavior

My bot was near a farm filled with mobs, and there were a lot of events being reported. The WebSocket connection constantly dies as the client reports System.InvalidOperationException: There is already one outstanding 'SendAsync' call for this WebSocket instance. ReceiveAsync and SendAsync can be called simultaneously, but at most one outstanding operation for each of them is allowed at the same time.

Steps to Reproduce the bug

I haven't found a stable way to reproduce the issue but my bot was near a lot of mobs while entity handling was enabled, and I was using MCC.js to control the bot.

Attach screenshot here (If applicable)

No response

Anythings that could help diagnosing the bug

The exception occured here:

await webSocketSession.WebSocket.SendAsync(new ArraySegment<byte>(buffer), WebSocketMessageType.Text,
true,
CancellationToken.None);

Device

Desktop

Operating System

Windows

Server Address (If applicable)

No response

@DGCK81LNN DGCK81LNN added the a:bug Crash or feature not working as expected label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug Crash or feature not working as expected
Projects
None yet
Development

No branches or pull requests

1 participant