ianic / websocket.zig

websocket protocol in zig
MIT License
16 stars 4 forks source link

JSON message Syntax Error #2

Open jdgriffith opened 10 months ago

jdgriffith commented 10 months ago

I'm encountering an issue where it appears there is a memory address leak or some other binary thing happening with the message and it's mixed with the normal UTF8 part of the message.

This appears to come from cli.nextMessage() initially as you can see where I output the message to the screen.

Screenshot 2023-11-20 at 10 11 01 AM

Let me know if you have any thoughts or need more information.

jdgriffith commented 10 months ago

I wonder if this is related to some weirdness that happens from @memcpy.

So essentially could be happening at one of these two lines:

https://github.com/ianic/websocket.zig/blob/main/src/stream.zig#L146 https://github.com/ianic/websocket.zig/blob/main/src/stream.zig#L159

ianic commented 10 months ago

Those two lines are only invoked if message is fragmented. But that is also deeply tested with autobahn. Do you know; are your messages fragmented, are they compressed. Is there a public url on which I can connect to get this error?

jdgriffith commented 10 months ago

I am connecting to polygon.io and their stocks websocket. I only experience this error during a high volume of messages during intraday trading, so I suspect tests may not catch it.

I'm not sure the best way for you to test without me giving credentials. I could maybe share my screen on a call?

jdgriffith commented 10 months ago

I realized I didn't fully answer your question(s). The messages are fragmented but I'm not sure about them being compressed.