I think I have encounted that issue using Python as a Native Messaging host.
The Native Messaging protocol specifies capablility to pass 1MB to the host from client. The hosts exits when 873816 bytes are read from sys.stding.buffer
How to read exactly N bytes from stdin in Native Messaging host?.