-
-
Save groundwater/e791f503e21e7c44f2f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
process._rawDebug('--> MAIN'); | |
var assert = require('assert'); | |
var net = require('net') | |
, createNamespace = require('./context').createNamespace | |
; | |
var namespace = createNamespace('net'); | |
var server; | |
namespace.run(function A() { | |
process._rawDebug(' * SET STATE'); | |
namespace.set('test', 0x1337); | |
server = net.createServer(function ON_SOCKET(socket) { | |
process._rawDebug(' * ASSERT STATE PRESERVED'); | |
assert.equal(namespace.get('test'), 0x1337, "state has been mutated"); | |
socket.on("data", function ON_DATA(chunk) { | |
// THIS PART FAILS | |
process._rawDebug(' * ASSERT STATE PRESERVED'); | |
assert.equal(namespace.get('test'), 0x1337, "state is still preserved"); | |
}); | |
}); | |
server.listen(8080, function ON_LISTEN() { | |
var client = net.connect(8080, function ON_DONE() { | |
client.write("Hello"); | |
client.end(); | |
}); | |
}); | |
}); | |
process._rawDebug('<-- MAIN'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--> MAIN | |
* SET STATE | |
+ CREATE 1 | |
at process.runAsyncQueue (tracing.js:272:23) | |
at createTCP (net.js:45:10) | |
at exports._createServerHandle (net.js:1082:14) | |
at Server._listen2 (net.js:1124:16) | |
+ CREATE 2 | |
at runAsyncQueue (tracing.js:272:23) | |
at process.nextTick (node.js:406:9) | |
at Server._listen2 (net.js:1158:11) | |
at listen (net.js:1168:10) | |
<-- MAIN | |
--> BEFORE 2 | |
+ CREATE 3 | |
at process.runAsyncQueue (tracing.js:272:23) | |
at createTCP (net.js:45:10) | |
at Socket.connect (net.js:888:42) | |
at Object.exports.connect.exports.createConnection (net.js:86:35) | |
+ CREATE 4 | |
at process.runAsyncQueue (tracing.js:272:23) | |
at connect (net.js:848:26) | |
at Socket.connect (net.js:907:5) | |
at Object.exports.connect.exports.createConnection (net.js:86:35) | |
<-- AFTER 2 | |
+ CREATE 5 | |
at process.runAsyncQueue (tracing.js:272:23) | |
--> BEFORE 1 | |
* ASSERT STATE PRESERVED | |
+ CREATE 6 | |
at runAsyncQueue (tracing.js:272:23) | |
at process.nextTick (node.js:406:9) | |
at resume (_stream_readable.js:713:13) | |
at Socket.Readable.resume (_stream_readable.js:705:5) | |
<-- AFTER 1 | |
--> BEFORE 6 | |
<-- AFTER 6 | |
--> BEFORE 4 | |
+ CREATE 7 | |
at runAsyncQueue (tracing.js:272:23) | |
at process.nextTick (node.js:406:9) | |
at onwrite (_stream_writable.js:309:15) | |
at WritableState.onwrite (_stream_writable.js:100:5) | |
<-- AFTER 4 | |
--> BEFORE 7 | |
+ CREATE 8 | |
at process.runAsyncQueue (tracing.js:272:23) | |
at Socket.onSocketFinish (net.js:214:26) | |
at Socket.EventEmitter.emit (events.js:101:17) | |
at finishMaybe (_stream_writable.js:443:14) | |
<-- AFTER 7 | |
--> BEFORE 8 | |
<-- AFTER 8 | |
--> BEFORE 5 | |
* ASSERT STATE PRESERVED | |
assert.js:98 | |
throw new assert.AssertionError({ | |
^ | |
AssertionError: context not currently entered; can't exit | |
at Namespace.exit (/Users/jacob/Projects/continuation-local-storage/context.js:95:10) | |
at AsyncListener.namespace.id.tracing.addAsyncListener.error (/Users/jacob/Projects/continuation-local-storage/context.js:173:68) | |
at errorHandler (tracing.js:375:27) | |
at process._fatalException (node.js:231:20) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment