-
Notifications
You must be signed in to change notification settings - Fork 212
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
piped request end and close events seem not to be fired #295
Comments
You're not reading the file data from the busboy instance. If you don't do that then the busboy stream will never end/close. At the very minimum you need something like: const bb = busboy({headers: req.headers});
bb.on('file', (fieldName, file) => {
file.resume(); // discards the file data
});
// ...
req.pipe(bb); |
I think that it resumes by default. But still even when explicitly resuming the test don't pass |
AFAIK there is no leak happening here. Once you respond to the request from the |
I'll remove it anyway, it just means that useless (or potentially useful depending on your use case) data can possibly pass through |
Perhaps I'm using async-busboy patched for busboy version 1.5 (see, e.g., @revoinc/async-busboy). |
@slewsys Does it work if you add |
Good exercise :) I'll try to provide a solution. In the mean time, I'm able to successfully use @revoinc/async-busboy with busboy v1.6 in another package, the Koa Joi router. So it would appear that it is indeed the async-busboy testsuite that is at fault. |
Yes, adding In particular, the async-busboy test suite defines a request as: import Stream from "stream"
function request () {
const stream = new Stream.PassThrough()
stream.headers = {
'content-type': 'multipart/form-data; boundary=---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
}
stream.write([
'-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
'Content-Disposition: form-data; name="file_name_0"',
'',
'super alpha file',
'-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
...
].join('\r\n'))
return stream
}
Inserting |
Hi,
Piping request stream to busboy seems to prevent request end and close event from firing
Could this indicate some leak issues ?
Test code
I also noticed that when the busboy stream forced end is commented out the test passes
System
Node v16.14.0
Busboy 1.5.0
PS: this also keeps from using the promisified stream.pipeline with busboy since the resulting promise wouldn't resolve
The text was updated successfully, but these errors were encountered: