You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to understand a recent Formidable issue that crashed my server. What happens is that first the server receive a request that is aborted:
server_1 | 2023-10-29 10:08:51: [error] App: 174.194.132.166 FormidableError: Could not parse form: Request aborted
server_1 | at IncomingMessage.<anonymous> (/home/joplin/packages/server/node_modules/formidable/dist/index.cjs:1223:21)
server_1 | at IncomingMessage.emit (node:events:517:28)
server_1 | at IncomingMessage._destroy (node:_http_incoming:224:10)
server_1 | at _destroy (node:internal/streams/destroy:109:10)
server_1 | at IncomingMessage.destroy (node:internal/streams/destroy:71:5)
server_1 | at abortIncoming (node:_http_server:766:9)
server_1 | at socketOnClose (node:_http_server:760:3)
server_1 | at Socket.emit (node:events:529:35)
server_1 | at TCP.<anonymous> (node:net:350:12) {
server_1 | code: 1002,
server_1 | httpCode: 500
server_1 | }
Which I guess is fine - the error is somehow handled and the client can retry the request later on.
The problem is that immediately after, my server crashes:
server_1 | Error: Cannot call write after a stream was destroyed
server_1 | at new NodeError (node:internal/errors:405:5)
server_1 | at node:internal/fs/streams:406:23
server_1 | at FSReqCallback.wrapper [as oncomplete] (node:fs:829:5)
ubuntu_server_1 exited with code 1
I'm not entirely sure what it means but it seems that Formidable doesn't fully clean up the streams after parsing fails. Then something still tries to write to it and we end up with this crash. Any idea how I could handle this? Is there any method that I should explicitely call to ensure everything is cleaned up when a request is aborted?
Note that the server gets millions of request and these two error messages, one after the other, always go together so it's definitely something related to Formidable.
The code to parse the form content is relatively straightforward:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Using Formidable 3.5.1
I'm trying to understand a recent Formidable issue that crashed my server. What happens is that first the server receive a request that is aborted:
Which I guess is fine - the error is somehow handled and the client can retry the request later on.
The problem is that immediately after, my server crashes:
I'm not entirely sure what it means but it seems that Formidable doesn't fully clean up the streams after parsing fails. Then something still tries to write to it and we end up with this crash. Any idea how I could handle this? Is there any method that I should explicitely call to ensure everything is cleaned up when a request is aborted?
Note that the server gets millions of request and these two error messages, one after the other, always go together so it's definitely something related to Formidable.
The code to parse the form content is relatively straightforward:
https://github.com/laurent22/joplin/blob/49c1c9aa652aff50560ab5f46c9bcdfccbac6409/packages/server/src/utils/requestUtils.ts#L73
Beta Was this translation helpful? Give feedback.
All reactions