FGasper / zmodemjs

zmodem.js - ZMODEM in JavaScript
Apache License 2.0
129 stars 25 forks source link

Uncaught RangeError: Maximum call stack size exceeded #2

Closed tsl0922 closed 7 years ago

tsl0922 commented 7 years ago

I'm debugging my server side C code, this happens when I changed the server code to send all the buffered data at once.

Uncaught RangeError: Maximum call stack size exceeded
    at ZmodemReceiveSession._strip_and_enqueue_input ((index):9501)
    at ZmodemReceiveSession.consume ((index):9292)
    at ZmodemSentry.consume ((index):8900)
    at WebSocket.ws.onmessage ((index):339)

Chrome Network Tab shows the maximum websocket message size is 327751.

tsl0922 commented 7 years ago

Changed the buffer size to 32K, it works fine now.

FGasper commented 7 years ago

Zmodem (the protocol) specifies 1 KiB packet size. The classic lrzsz tool supports up to 8, so that’s what zmodem.js sends.

Just for curiosity, why are you writing new C code for Zmodem? Does none of the existing libraries suffice?

tsl0922 commented 7 years ago

I'm changing ttyd's code (C, not zmodem 😄 ) to support zmodem on the browser (with zmodemjs).

It's initially done now, may be lack of some error handling. You may wan't to try it:

https://github.com/tsl0922/ttyd/commits/dev