Description
- Version: 4.4.1 (currently upgrading to 4.4.2 to see what's good)
- Platform: Linux ip-10-90-38-23 3.10.0-123.8.1.el7.x86_64 deps: update openssl to 1.0.1j #1 SMP Mon Sep 22 19:06:58 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem: _stream_writable.js
I have some production services that are throwing a pretty crazy error:
TypeError: Cannot set property 'entry' of null
at clearBuffer (_stream_writable.js:379:18)
at Socket.Writable.uncork (_stream_writable.js:238:7)
at RedisClient.uncork (/cn/runtime/epi-services/nodejs/releases/current/node_modules/@condenast/tsugu-service/node_modules/redis/index.js:361:25)
at Multi.exec_transaction (/cn/runtime/epi-services/nodejs/releases/current/node_modules/@condenast/tsugu-service/node_modules/redis/index.js:1171:18)
For some background: We're using redis as a caching layer, and this code is getting triggered while writing to redis with its 'multi' helper. We're using v2.4.2 of the redis module but I'm gonna upgrade to 2.5.3 just in case it helps.
As far as I can tell, what's happening here is that the redis client creates a net stream and at various points in time might call uncork on it, including inside the multi exec handler. For some reason, only sometimes, when this happens, trying to clear the buffer throws because state.corkedRequestsFree is null.
I did look at net and Duplex code paths, as well as the redis code, and didn't see anything touching internal stream state, but maybe I missed something?
Unfortunately, I don't have a reproducing case beyond the production code. I tried triggering this with a naive fuzzer on a writable stream, no dice.
@mcollina tagging you because we talked about this on irc a little bit, and because you have the git blame for CorkedRequest.
Thanks!
EDIT: Also created an issue on the redis project just in case