Description
- Version: v6.11.3
- Platform: Linux bono 4.12.0-2-amd64 deps: update openssl to 1.0.1jΒ #1 SMP Debian 4.12.13-1 (2017-09-19) x86_64 GNU/Linux
- Subsystem: zlib
When calling .close()
on a zlib.createGunzip()
stream while the engine is still working on decompressing some stuff, sometimes this exception is thrown:
zlib.js:633
ββββββvar newReq = self._handle.write(flushFlag,
ββββββββββββββββββββββββββββββ ^
TypeError: Cannot read property 'write' of null
ββββat Zlib.callback (zlib.js:633:32)
Looking at the code, it seems that when _processChunk
sets a callback, it does not sufficiently check that this._handle
has not been unset in the meantime. The earlier code has assert(this._handle, 'zlib binding closed');
check, but the callback code does not.
But even the assert is wrong, as calling .close()
on a stream, even when there's unprocessed data, should not throw any exceptions. I guess the function should check for this._closed
similarily as it checks for this._hadError
currently.
Unfortunately this bug is triggered very rarely on a production system, so I haven't been able to write short code to reproduce the issue.