Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility of a new formidable crash #4009

Closed
JohnMcLear opened this issue May 14, 2020 · 4 comments
Closed

Possibility of a new formidable crash #4009

JohnMcLear opened this issue May 14, 2020 · 4 comments

Comments

@JohnMcLear
Copy link
Member

JohnMcLear commented May 14, 2020

Not sure on steps to replicate.

[WARN] console - Uploading Error: Error: Request aborted
run.sh[43238]: at IncomingMessage.<anonymous> (/home/etherpad-lite/src/node_modules/formidable/lib/incoming_form.js:122:19)
run.sh[43238]: at IncomingMessage.emit (events.js:315:20)
run.sh[43238]: at IncomingMessage.EventEmitter.emit (domain.js:485:12)
...
run.sh[43238]: [2020-05-14 17:45:18.692] [ERROR] console - Error **[ERR_STREAM_DESTROYED]**: Cannot call write after a stream was destroyed
May 14 17:45:18 EtherpadL run.sh[43238]: at WriteStream._write (internal/fs/streams.js:417:33)
May 14 17:45:18 EtherpadL run.sh[43238]: at WriteStream.<anonymous> (internal/fs/streams.js:413:12)
@JohnMcLear
Copy link
Member Author

JohnMcLear commented May 15, 2020

Proposed fix here: node-formidable/formidable#469

Source:

  const form = new IncomingForm();
  form.onPart = part => {
    form.handlePart(part);
    if (part.filename !== undefined) {
      form.openedFiles[form.openedFiles.length - 1]._writeStream.on('error', err => {
        form.emit('error', err);
      });
    }
  };

@JohnMcLear
Copy link
Member Author

Okay so it looks like it "could" be a thing, to test.. Start uploading a large file (I have 600mb internet here so it has to be fucking huge). After 500ms, abort it, in theory this error should throw..

~Tomorrow I will write some test coverage/scripts then apply some patches to fix.

@JohnMcLear
Copy link
Member Author

curl -vs -F'thefile=@test.txt' -H'Content-Length: 300' -m 2 http://httpbin.org/anything

Props to @tomnomnom https://twitter.com/TomNomNom/status/1261441448387411968

Will try this 2mrw and see if I can get it to fail

@JohnMcLear
Copy link
Member Author

#4018 ready for test/merge

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

No branches or pull requests

2 participants