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

Unhandled "error" event. (Error: Callback called multiple times) #1730

Open
1 of 2 tasks
Akuukis opened this issue Nov 11, 2019 · 7 comments
Open
1 of 2 tasks

Unhandled "error" event. (Error: Callback called multiple times) #1730

Akuukis opened this issue Nov 11, 2019 · 7 comments

Comments

@Akuukis
Copy link

Akuukis commented Nov 11, 2019

Please tell us about your environment:

  • winston version?
    • winston@2
    • winston@3
  • node -v outputs: 8.16.1
  • Operating System? Linux
  • Language? TypeScript 3.6.3

What is the problem?

Sometimes, consistently, some of the calls to log results in the following error:

Unhandled "error" event. (Error: Callback called multiple times)
      at DerivedLogger.afterTransform (./node_modules/winston/node_modules/readable-stream/lib/_stream_transform.js:82:17)
      at DerivedLogger._transform (./node_modules/winston/lib/winston/logger.js:310:7)
      at DerivedLogger.Object.<anonymous>.Transform._read (./node_modules/winston/node_modules/readable-stream/lib/_stream_transform.js:177:10)
      at DerivedLogger.Object.<anonymous>.Transform._write (./node_modules/winston/node_modules/readable-stream/lib/_stream_transform.js:164:83)
      at doWrite (./node_modules/winston/node_modules/readable-stream/lib/_stream_writable.js:405:139)
      at writeOrBuffer (./node_modules/winston/node_modules/readable-stream/lib/_stream_writable.js:394:5)
      at DerivedLogger.Object.<anonymous>.Writable.write (./node_modules/winston/node_modules/readable-stream/lib/_stream_writable.js:303:11)
      at DerivedLogger.log (./node_modules/winston/lib/winston/logger.js:244:14)
      at DerivedLogger.(anonymous function) [as verbose] (./node_modules/winston/lib/winston/create-logger.js:95:19)

I've not figured out the pattern of why it fails yet.

What do you expect to happen instead?

I expect it to throw a more useful error that would help me to identify what I'm doing wrong.

Other information

It felt related to ExceptionHandler problems at #1355 #1289 #1261 #511, but after few experiments doesn't so:

  1. I have both file and console transports, but commenting out either of two doesn't change the behaviour.
  2. commenting out all my custom formatting didn't change the behaviour (except that succeeding logs looked very different now)
  3. From hacky-debug console logs I see that message and meta are very "casual" and similar to other succeeding cases.
@Akuukis
Copy link
Author

Akuukis commented Nov 25, 2019

The error is back again. Went through winston code but didn't get smarter why it arises - can anyone point in the right direction please?

@barinbritva
Copy link

I have the same issue.

@Akuukis, did you find any solutions or workarounds?

@Akuukis
Copy link
Author

Akuukis commented Mar 6, 2020

@barinbritva No, I still have no clue.

@barinbritva
Copy link

@Akuukis, that's strange only we have this issue.

I thought maybe it's something not related with Winston and I did clean install of all project dependencies, but to no avail.

@NFS002
Copy link

NFS002 commented May 11, 2020

I have the same issue...

@calvinjaramillo
Copy link

calvinjaramillo commented Aug 10, 2020

This error occurred for me after I had accidentally deep cloned the logger object. Hopefully that will help somebody.

@barinbritva
Copy link

@calvinjaramillo, thanks for your idea. I think, it's possible my situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants