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

Add null check #23895

Closed
wants to merge 2 commits into from
Closed

Add null check #23895

wants to merge 2 commits into from

Conversation

okkez
Copy link

@okkez okkez commented Oct 26, 2018

Sometimes this cb is null.

Sometimes this `cb` is null.
@nodejs-github-bot nodejs-github-bot added the stream Issues and PRs related to the stream subsystem. label Oct 26, 2018
okkez added a commit to fluent/fluent-logger-node that referenced this pull request Oct 26, 2018
This change will reconnect to fluentd, but following error occurs
while reconnecting:

> logger-node/node_modules/fluent-logger/node_modules/readable-stream/lib/_stream_writable.js:491
>   cb();
>   ^
>
> TypeError: cb is not a function
>     at afterWrite (/logger-node/node_modules/fluent-logger/node_modules/readable-stream/lib/_stream_writable.js:491:3)
>     at onwrite (/logger-node/node_modules/fluent-logger/node_modules/readable-stream/lib/_stream_writable.js:483:7)
>     at WritableState.onwrite (/logger-node/node_modules/fluent-logger/node_modules/readable-stream/lib/_stream_writable.js:180:5)
>     at sender.emit (/logger-node/node_modules/fluent-logger/lib/winston.js:46:21)
>     at callbacks.forEach (/logger-node/node_modules/fluent-logger/lib/sender.js:431:23)
>     at Array.forEach (<anonymous>)
>     at _socket.write (/logger-node/node_modules/fluent-logger/lib/sender.js:430:19)
>     at afterWrite (_stream_writable.js:480:3)
>     at process._tickCallback (internal/process/next_tick.js:63:19)

See also nodejs/node#23895

Signed-off-by: Kenji Okimoto <[email protected]>
@cjihrig
Copy link
Contributor

cjihrig commented Oct 26, 2018

Sometimes this cb is null.

Is it? afterWrite() is only called from onwrite(), which throws if cb is not a function.

@okkez
Copy link
Author

okkez commented Oct 29, 2018

Could you see fluent/fluent-logger-node#116 and fluent/fluent-logger-node#115 ?
If something wrong, would you help me?

lib/_stream_writable.js Outdated Show resolved Hide resolved
@BridgeAR
Copy link
Member

BridgeAR commented May 1, 2019

@okkez thanks a lot for your contribution but this does not seem to be correct as outlined above. You seem to use an older version of the userland module readable-stream. In newer versions this would have logged an error that the callback is necessary. For those reasons I'm closing this.

@BridgeAR BridgeAR closed this May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants