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

Single Message Sent is received as multiple Messages #14

Open
christandlg opened this issue Aug 16, 2024 · 3 comments
Open

Single Message Sent is received as multiple Messages #14

christandlg opened this issue Aug 16, 2024 · 3 comments

Comments

@christandlg
Copy link

christandlg commented Aug 16, 2024

I have observed that occasionally (depending on message length) a single message sent by either server or client is received as multiple messages by the other party.

Steps to reproduce:

  1. add waveform chart indicators to Client Single Connection and Server Single Connection examples to display received string length
  2. build .exe from examples and run server and client on separate machines (issue also exists when both are running on the same machine, but much less frequent)
  3. send a large payload (in my case, 8 MBs of 'a')
  4. observe that waveform chart displays multiple received string lengths:
    grafik
@christandlg
Copy link
Author

wireshark reports correct number of bytes transmitted:
grafik

@samsharp99
Copy link
Contributor

samsharp99 commented Aug 16, 2024

Hi @christandlg - thanks for raising the issue. There are a couple of things this could be:

  • The 'read' is timing out and returning the partial data/message (the timeout error is dropped in the example VIs)
  • There is known limit on a single frame of 2048MB but we're probably not hitting that here
  • Some other bug/issue that I'm not aware of

For large messages, the use of WS framing is recommended but the implementation of it in my library is not extensively tested.

Testing locally (i.e. localhost with the client running on the same machine as the server), I can do 60MB no problem (but it start to take a long time):
image

It would perhaps make sense to distinguish (e.g. with a different error code) between 'no data received' and 'data received but did not complete within timeout period'.

@christandlg
Copy link
Author

christandlg commented Aug 17, 2024

* The 'read' is timing out and returning the partial data/message (the timeout error is dropped in the example VIs)

I think this may be the core issue. It would explain the inconsistency in received message length and also explain !15, if in WebSocket.lvclass:Low-Level Read.vi a byte is parsed as opcode that actually is part of the message payload.
grafik

For large messages, the use of WS framing is recommended

How can I try that? Do I need to control the Finished? input of WebSocket.lvclass:Low-Level Write.vi ?

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

No branches or pull requests

2 participants