tchannel 3.6.18 → 3.6.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/channel.js CHANGED
@@ -122,7 +122,8 @@ function TChannel(options) {
122
122
  this.emitConnectionMetrics =
123
123
  typeof this.options.emitConnectionMetrics === 'boolean' ?
124
124
  this.options.emitConnectionMetrics : false;
125
- this.choosePeerWithHeap = this.options.choosePeerWithHeap || false;
125
+ this.choosePeerWithHeap = typeof this.options.choosePeerWithHeap === 'boolean' ?
126
+ this.options.choosePeerWithHeap : true;
126
127
 
127
128
  this.setObservePeerScoreEvents(this.options.observePeerScoreEvents);
128
129
 
package/lazy_relay.js CHANGED
@@ -679,6 +679,11 @@ LazyRelayOutReq.prototype.emitError =
679
679
  function emitError(err) {
680
680
  var self = this;
681
681
 
682
+ // ObjectPool weird free() issue; bail early
683
+ if (!self.channel) {
684
+ return;
685
+ }
686
+
682
687
  var now = self.channel.timers.now();
683
688
  var elapsed = now - self.start;
684
689
 
@@ -718,7 +723,9 @@ function emitError(err) {
718
723
  // handleFrameLazily has completed.
719
724
  process.nextTick(deferInReqOnError);
720
725
  function deferInReqOnError() {
721
- self.inreq.onError(err);
726
+ if (self.inreq) {
727
+ self.inreq.onError(err);
728
+ }
722
729
  }
723
730
  };
724
731
 
@@ -733,6 +740,11 @@ LazyRelayOutReq.prototype.onTimeout =
733
740
  function onTimeout(now) {
734
741
  var self = this;
735
742
 
743
+ // ObjectPool weird free() issue; bail early
744
+ if (!self.conn) {
745
+ return;
746
+ }
747
+
736
748
  self.conn.ops.checkLastTimeoutTime(now);
737
749
  self.conn.ops.popOutReq(self.id, self.extendLogInfo({
738
750
  info: 'lazy out request timed out',
@@ -756,6 +768,11 @@ function handleFrameLazily(frame) {
756
768
  // - v2.Types.ErrorResponse
757
769
  var self = this;
758
770
 
771
+ // ObjectPool weird free() issue; bail early
772
+ if (!self.inreq) {
773
+ return;
774
+ }
775
+
759
776
  frame.setId(self.inreq.id);
760
777
  self.inreq.conn.writeToSocket(frame.buffer);
761
778
  if (frame.bodyRW.lazy.isFrameTerminal(frame)) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "tchannel",
3
3
  "description": "network multiplexing and framing protocol for RPC or parser drag racing",
4
4
  "author": "mranney@uber.com",
5
- "version": "3.6.18",
5
+ "version": "3.6.19",
6
6
  "scripts": {
7
7
  "lint": "eslint $(git ls-files | grep '.js$')",
8
8
  "travis": "npm run test",
@@ -43,7 +43,7 @@
43
43
  "safe-json-parse": "^4.0.0",
44
44
  "sse4_crc32": "4.1.1",
45
45
  "tape-cluster": "2.1.0",
46
- "thriftrw": "^3.3.0",
46
+ "thriftrw": "^3.4.0",
47
47
  "xorshift": "^0.2.0",
48
48
  "xtend": "^4.0.0"
49
49
  },
package/peer.js CHANGED
@@ -431,6 +431,7 @@ function waitForIdentified(conn, callback) {
431
431
  TChannelPeer.prototype._waitForIdentified =
432
432
  function _waitForIdentified(conn, callback) {
433
433
  var self = this;
434
+ var called = false;
434
435
 
435
436
  // Setup an ident descriptor so we can stop waiting for identified later
436
437
  var slot = self.getIdentDescriptorSlot();
@@ -464,6 +465,12 @@ function _waitForIdentified(conn, callback) {
464
465
  }
465
466
 
466
467
  function finish(err) {
468
+ // Multiple events can trigger which causes double callback hilarity.
469
+ if (called) {
470
+ return;
471
+ }
472
+ called = true;
473
+
467
474
  self.stopWaitingForIdentified(slot);
468
475
  callback(err);
469
476
  }