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

Process doesn't exit, just by instantiating #54

Open
ciscoheat opened this issue May 19, 2016 · 3 comments
Open

Process doesn't exit, just by instantiating #54

ciscoheat opened this issue May 19, 2016 · 3 comments

Comments

@ciscoheat
Copy link

When I instantiate a papertrail transport, the process doesn't exit anymore. I don't even have to add it to the transports. And if I add it to transports and call close on the winston object, this happens:

node_modules\winston\lib\winston\config.js:30
  else if (allColors[level].match(/\s/)) {
                           ^

TypeError: Cannot read property 'match' of undefined
    at Object.config.colorize (node_modules\winston\lib\winston\config.js:30:28)
    at Papertrail.sendMessage (node_modules\winston-papertrail\lib\winston-papertrail.js:349:68)
    at Papertrail.log (node_modules\winston-papertrail\lib\winston-papertrail.js:301:10)
    at Transport.logException (node_modules\winston\lib\winston\transports\transport.js:134:8)
    at logAndWait (node_modules\winston\lib\winston\logger.js:643:15)
    at node_modules\async\lib\async.js:157:13
    at _each (node_modules\async\lib\async.js:57:9)
    at Object.async.each (node_modules\async\lib\async.js:156:9)
    at Logger._uncaughtException (node_modules\winston\lib\winston\logger.js:666:9)
    at emitOne (events.js:96:13)```

which seems to be related to Transport.logException, and when I set handleExceptions to false, I get

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: write after end
    at writeAfterEnd (_stream_writable.js:166:12)
    at TLSSocket.Writable.write (_stream_writable.js:217:5)
    at TLSSocket.Socket.write (net.js:643:40)
    at TLSSocket.onConnected (node_modules\winston-papertrail\lib\winston-papertrail.js:228:25)
    at TLSSocket.g (events.js:286:16)
    at emitNone (events.js:86:13)
    at TLSSocket.emit (events.js:185:7)
    at TLSSocket.<anonymous> (_tls_wrap.js:1076:14)
    at emitNone (events.js:86:13)
    at TLSSocket.emit (events.js:185:7)

And finally, similar to #52, if I introduce a one second delay before calling close, it seems to work, but an explicit call to close is required. Do you always have to close the connection as soon as a Papertrail object exists? Something definitely remains in the event loop, since I cannot use exit or beforeExit to close it automatically.

@watt watt mentioned this issue Mar 26, 2017
@typedefstructer
Copy link

when is this going to be fixed?

@troy
Copy link
Contributor

troy commented Apr 22, 2017

@typedefstructer roughly 2 weeks after you or anyone else submits a pull request fixing it. If you'd like to, please feel free.

@typedefstructer
Copy link

sorry for being arrogant for asking "when is this going to be fixed??",
but then in another issue, the suggested calling tr.close() on 'connect' event. i dont understand how that will help, when i want realtime logs. and this issue is causing gulp build to freeze. we have to run a build step for doing es6 to es5

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

3 participants