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

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

@tpetry

Description

@tpetry

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions