From 40ee2503cce50b8259c1124d7dbe0e7f7ee689c1 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Wed, 3 May 2017 23:32:48 -0700 Subject: [PATCH] v2.0.0 (beta); ensure 2.x releases are published as 'beta' for now --- CHANGES.md | 7 ++- Makefile | 4 +- README.md | 7 ++- TODO.md | 131 -------------------------------------------------- bin/bunyan | 2 +- lib/bunyan.js | 2 +- package.json | 2 +- 7 files changed, 16 insertions(+), 139 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 7bb3f59..8542285 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,7 +5,12 @@ Known issues: - [issue #58] Can't install to a dir with spaces. This is [this node-gyp bug](https://github.com/TooTallNate/node-gyp/issues/65). -## not yet released (2.x) +## not yet released + +(nothing yet) + + +## 2.0.0 (beta) - [issue #499] Fix some `bunyan` CLI exit handling problems. diff --git a/Makefile b/Makefile index 2eb3fd1..4c93eb6 100644 --- a/Makefile +++ b/Makefile @@ -56,9 +56,9 @@ cutarelease: check read ver=$(shell cat package.json | json version) && \ date=$(shell date -u "+%Y-%m-%d") && \ - git tag -a "$$ver" -m "version $$ver ($$date)" && \ + git tag -a "$$ver" -m "version $$ver ($$date) beta" && \ git push --tags origin && \ - npm publish + npm publish --tag beta .PHONY: docs docs: toc diff --git a/README.md b/README.md index 4f3396b..ecaac87 100644 --- a/README.md +++ b/README.md @@ -75,8 +75,11 @@ also [as a forum in the browser](https://groups.google.com/forum/?fromgroups#!forum/bunyan-logging). Active branches: -- "master" is currently for coming Bunyan 2.x work. -- "1.x" is for 1.x maintenance work, if any. +- "1.x" is for 1.x maintenance work, if any. 1.x releases are still "latest" in + npm. +- "master" is currently for coming Bunyan 2.x work. For now, 2.x releases are + published to npm with the "beta" tag, meaning that `npm install bunyan` is + still 1.x for now. # Installation diff --git a/TODO.md b/TODO.md index 9215525..587d479 100644 --- a/TODO.md +++ b/TODO.md @@ -1,10 +1,5 @@ # v2 -- Exit handling: - - - make a ticket with notes from "bunyan CLI exit handling" section below - - resolve it with the uncommited changes here - - figure out how to 'make cutarelease' for 2.x but tag as beta - comment/grokking of bunyan.js flushing issues at https://github.com/trentm/node-bunyan/issues/37 would be nice. Even if just a @@ -32,132 +27,6 @@ - if doing ~/.bunyanrc, then consider color schemes -# bunyan CLI exit handling - -It has some problems currently. - -One basic problem is that our stdout.on('error') handler can call into -drainStdoutAndExit multiple times, leading to the multiple Event Emitters -leak warning, and with a pager we are waiting for the pager to exit. -Why doesn't the pager exit on ^C? Is that a less thing? Perhaps due to our -LESS opts? - - - -Setting up a file to work with: - -```javascript -$ cat lots.js -var bunyan = require('./') -var log = bunyan.createLogger({ - name: 'lots', - streams: [ - { - type: 'file', - path: './lots.log' - } - ] -}); - -N = Math.pow(2, 16); -for (var i = N; i >= 0; i--) { - log.info({i: i}, 'another record'); -} - -$ node lots.js -``` - -## Issue 1: EventEmitter mem leak - -``` -$ node --version -v4.8.0 -$ ./bin/bunyan lots.log | cat -[2017-04-05T01:47:15.899Z] INFO: lots/53218 on danger0.local: another record (i=65536) -[2017-04-05T01:47:15.901Z] INFO: lots/53218 on danger0.local: another record (i=65535) -... -^C # ^C quickly before it is done writing rendered logs -... -[2017-04-05T01:47:16.023Z] INFO: lots/53218 on danger0.local: another record (i=57351) -[2017-04-05T01:47:16.023Z] INFO: lots/53218 -^C(node) warning: possible EventEmitter memory leak detected. 11 drain listeners added. Use emitter.setMaxListeners() to increase limit. -Trace - at Socket.addListener (events.js:239:17) - at Socket.Readable.on (_stream_readable.js:680:33) - at drainStdoutAndExit (/Users/trentm/tm/node-bunyan/bin/bunyan:1116:12) - at Socket. (/Users/trentm/tm/node-bunyan/bin/bunyan:1597:13) - at emitOne (events.js:77:13) - at Socket.emit (events.js:169:7) - at onwriteError (_stream_writable.js:313:10) - at onwrite (_stream_writable.js:331:5) - at WritableState.onwrite (_stream_writable.js:90:5) - at fireErrorCallbacks (net.js:457:13) -``` - -## Issue 2: "write after end" infinite loop with ^C in pager - -Mac. Node v4.8.0. Happens with node 0.10 as well. - -``` -$ ./bin/bunyan lots.log -[2017-04-05T01:47:15.899Z] INFO: lots/53218 on danger0.local: another record (i=65536) -[2017-04-05T01:47:15.901Z] INFO: lots/53218 on danger0.local: another record (i=65535) -[2017-04-05T01:47:15.901Z] INFO: lots/53218 on danger0.local: another record (i=65534) -... -^C -... -[2017-04-05T01:47:15.909Z] INFO: lots/53218 on danger0.local: another record (i=65490) -:[Error: write after end] -[Error: write after end] -[Error: write after end] -[Error: write after end] -[Error: write after end] -(node) warning: possible EventEmitter memory leak detected. 11 drain listeners added. Use emitter.setMaxListeners() to increase limit. -Trace - at Socket.addListener (events.js:239:17) - at Socket.Readable.on (_stream_readable.js:680:33) - at drainStdoutAndExit (/Users/trentm/tm/node-bunyan/bin/bunyan:1116:12) - at Socket. (/Users/trentm/tm/node-bunyan/bin/bunyan:1600:13) - at emitOne (events.js:77:13) - at Socket.emit (events.js:169:7) - at writeAfterEnd (_stream_writable.js:169:10) - at Socket.Writable.write (_stream_writable.js:212:5) - at Socket.write (net.js:645:40) - at emit (/Users/trentm/tm/node-bunyan/bin/bunyan:1097:32) -[Error: write after end] -[Error: write after end] -[Error: write after end] -[Error: write after end] -... # this goes forever until 'q' to quit pager -``` - -With bunyan's internal `_DEBUG`: - -``` -... -[2017-04-05T01:47:15.909Z] INFO: lots/53218 on danger0.local: another record (i=65491) -[2017-04-05T01:47:15.909Z] INFO: lots/53218 on danger0.local: another record (i=65490) -:(bunyan: cleanupAndExit) -(stdout error event: Error: write after end) -[Error: write after end] -(drainStdoutAndExit(1)) -(stdout error event: Error: write after end) -[Error: write after end] -(drainStdoutAndExit(1)) -(stdout error event: Error: write after end) -[Error: write after end] -(drainStdoutAndExit(1)) -(stdout error event: Error: write after end) -[Error: write after end] -... -(drainStdoutAndExit(1)) -(stdout error event: Error: write EPIPE) -(drainStdoutAndExit(0)) -(bunyan: pager exit) -(bunyan: pager exit -> process.exit(1)) -``` - - # changes to ctor and log.child to separate fields from config diff --git a/bin/bunyan b/bin/bunyan index fa92807..1793386 100755 --- a/bin/bunyan +++ b/bin/bunyan @@ -11,7 +11,7 @@ * vim: expandtab:ts=4:sw=4 */ -var VERSION = '1.8.10'; +var VERSION = '2.0.0'; var p = console.log; var util = require('util'); diff --git a/lib/bunyan.js b/lib/bunyan.js index 8c8a974..fc02a2a 100644 --- a/lib/bunyan.js +++ b/lib/bunyan.js @@ -8,7 +8,7 @@ * vim: expandtab:ts=4:sw=4 */ -var VERSION = '1.8.10'; +var VERSION = '2.0.0'; /* * Bunyan log format version. This becomes the 'v' field on all log records. diff --git a/package.json b/package.json index b08e2b7..4efead4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bunyan", - "version": "1.8.10", + "version": "2.0.0", "description": "a JSON logging library for node.js services", "author": "Trent Mick (http://trentm.com)", "main": "./lib/bunyan.js",