Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

JSON instruction parsing on node process fails for large instructions #39

Open
tpetry opened this issue Jan 6, 2022 · 1 comment
Open

Comments

@tpetry
Copy link

tpetry commented Jan 6, 2022

In my first tests everything was working correctly and rialto seemed like a nice solution. But after implementing everything, I encountered a strange bug which took a long to debug: Sending large instructions (10KB or 100KB) fails with the nodejs part throwing an error because of malformed JSON instructions. With small instructions, everything is working correctly.

I was able to pin-down the exact issue: When sending results from nodejs to php a chunked protocol is used. But it is not used when sending data from php to nodejs. The nodejs logic expects the instruction to be read in one single receive statement:

socket.on('data', data => {
this.emit('activity');
this.handleSocketData(data);
});

But with large instructions like sending large html documents this is not possible, there will be packet fragmentation. Chunking needs to be done on both ways.

@lacieri
Copy link

lacieri commented Jul 13, 2022

This is a duplicate of #87

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants