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

Missing error handler on socket. #1751

Closed
binarykitchen opened this issue Dec 7, 2015 · 35 comments
Closed

Missing error handler on socket. #1751

binarykitchen opened this issue Dec 7, 2015 · 35 comments

Comments

@binarykitchen
Copy link

I am seeing this in the current test set up and would like to catch this kind of error from the karma server instance. Is that possible?

@csmalin
Copy link

csmalin commented Dec 18, 2015

I'm only seeing this problem when using karma-jenkins-reporter or karma-junit-reporter, are you using any of these plugins?

@binarykitchen
Copy link
Author

no

@priley86
Copy link

+1 seeing this with karma-junit-reporter in my tests with Node 4.23 LTS...any ideas?

    "karma": "~0.13.15",
    "karma-chrome-launcher": "~0.2.0",
    "karma-coverage": "~0.4.2",
    "karma-firefox-launcher": "~0.1.6",
    "karma-jasmine": "~0.3.6",
    "karma-junit-reporter": "^0.2.2",
    "karma-ng-html2js-preprocessor": "^0.1.2",
    "karma-phantomjs-launcher": "~0.2.0",
    "socket.io": "^1.3.7",

PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 48 of 277 (26 FAILED) ERROR (0.732 secs / 0.769 secs)
Missing error handler on socket.
TypeError: Cannot read property '68890579' of null
at specSuccess.specSkipped.specFailure (/Users/patrick/Projects/community/node_modules/karma-junit-reporter/index.js:89:22)
at onSpecComplete (/Users/patrick/Projects/community/node_modules/karma/lib/reporters/base.js:78:12)
at null. (/Users/patrick/Projects/community/node_modules/karma/lib/events.js:13:22)
at emitTwo (events.js:92:20)
at emit (events.js:172:7)
at onResult (/Users/patrick/Projects/community/node_modules/karma/lib/browser.js:216:13)
at Socket. (/Users/patrick/Projects/community/node_modules/karma/lib/events.js:13:22)
at emitOne (events.js:82:20)
at Socket.emit (events.js:169:7)
at Socket.onevent (/Users/patrick/Projects/community/node_modules/socket.io/lib/socket.js:330:8)
at Socket.onpacket (/Users/patrick/Projects/community/node_modules/socket.io/lib/socket.js:290:12)
at Client.ondecoded (/Users/patrick/Projects/community/node_modules/socket.io/lib/client.js:193:14)
at Decoder.Emitter.emit (/Users/patrick/Projects/community/node_modules/socket.io/node_modules/socket.io-parser/node_modules/component-emitter/index.js:134:20)
at Decoder.add (/Users/patrick/Projects/community/node_modules/socket.io/node_modules/socket.io-parser/index.js:247:12)
at Client.ondata (/Users/patrick/Projects/community/node_modules/socket.io/lib/client.js:175:18)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Socket.onPacket (/Users/patrick/Projects/community/node_modules/socket.io/node_modules/engine.io/lib/socket.js:99:14)
at emitOne (events.js:82:20)
at WebSocket.emit (events.js:169:7)
at WebSocket.Transport.onPacket (/Users/patrick/Projects/community/node_modules/socket.io/node_modules/engine.io/lib/transport.js:91:8)
at WebSocket.Transport.onData (/Users/patrick/Projects/community/node_modules/socket.io/node_modules/engine.io/lib/transport.js:102:8)

@wentaohong
Copy link

Same error here: any suggestions?
PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 32 of 141 ERROR (0.428 secs / 0.427 secs)
Missing error handler on socket.
TypeError: Cannot read property '12945726' of null

@levithomason
Copy link
Contributor

Getting with PhantomJS and the spec reporter. Trying to figure out why it is only on CircleCI and not locally:

Missing error handler on `socket`.
TypeError: sockets.forEach is not a function
    at disconnectBrowsers (/home/ubuntu/[app]/node_modules/karma/lib/server.js:314:13)
    at [object Object].<anonymous> (/home/ubuntu/[app]/node_modules/karma/lib/server.js:291:7)
    at emitTwo (events.js:92:20)
    at [object Object].emit (events.js:172:7)
    at emitRunCompleteIfAllBrowsersDone (/home/ubuntu/[app]/node_modules/karma/lib/server.js:256:12)
    at [object Object].<anonymous> (/home/ubuntu/[app]/node_modules/karma/lib/server.js:278:9)
    at emitTwo (events.js:92:20)
    at [object Object].emit (events.js:172:7)
    at [object Object].onComplete (/home/ubuntu/[app]/node_modules/karma/lib/browser.js:142:13)
    at Socket.<anonymous> (/home/ubuntu/[app]/node_modules/karma/lib/events.js:13:22)
    at emitTwo (events.js:92:20)
    at Socket.emit (events.js:172:7)
    at Socket.onevent (/home/ubuntu/[app]/node_modules/socket.io/lib/socket.js:335:8)
    at Socket.onpacket (/home/ubuntu/[app]/node_modules/socket.io/lib/socket.js:295:12)
    at Client.ondecoded (/home/ubuntu/[app]/node_modules/socket.io/lib/client.js:193:14)
    at Decoder.Emitter.emit (/home/ubuntu/[app]/node_modules/component-emitter/index.js:134:20)
    at Decoder.add (/home/ubuntu/[app]/node_modules/socket.io-parser/index.js:247:12)
    at Client.ondata (/home/ubuntu/[app]/node_modules/socket.io/lib/client.js:175:18)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at Socket.onPacket (/home/ubuntu/[app]/node_modules/engine.io/lib/socket.js:101:14)
    at emitOne (events.js:77:13)

@levithomason
Copy link
Contributor

Our issue was just fixed in 3ab78d6 and shipped in 0.13.19. Thanks!

@damassi
Copy link

damassi commented Jan 6, 2016

Confirmed fixed.

@adam-beck
Copy link

I'm still seeing this in 0.13.22

@dignifiedquire
Copy link
Member

@adam-beck please provide a reproducible example.

@sharikovvladislav
Copy link

@dignifiedquire what example do you want? I have same issue using karma: 0.13.22 and karma-teamcity-reporter: 0.2.2.

[10:09:26]  Missing error handler on `socket`.
[10:09:26]  Error: EAGAIN: resource temporarily unavailable, write
[10:09:26]      at Error (native)
[10:09:26]      at Function.fs.writeSync (fs.js:669:18)
[10:09:26]      at /export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/karma/lib/reporters/base.js:51:7
[10:09:26]      at Array.forEach (native)
[10:09:26]      at write (/export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/karma/lib/reporters/base.js:50:19)
[10:09:26]      at onBrowserLog (/export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/karma/lib/reporters/base.js:70:12)
[10:09:26]      at null.<anonymous> (/export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/karma/lib/events.js:13:22)
[10:09:26]      at emitThree (events.js:102:20)
[10:09:26]      at emit (events.js:175:7)
[10:09:26]      at onInfo (/export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/karma/lib/browser.js:111:15)
[10:09:26]      at Socket.<anonymous> (/export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/karma/lib/events.js:13:22)
[10:09:26]      at emitOne (events.js:82:20)
[10:09:26]      at Socket.emit (events.js:169:7)
[10:09:26]      at Socket.onevent (/export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/socket.io/lib/socket.js:335:8)
[10:09:26]      at Socket.onpacket (/export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/socket.io/lib/socket.js:295:12)
[10:09:26]      at Client.ondecoded (/export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/socket.io/lib/client.js:193:14)

Note, that I am getting this issue only in TeamCity environment. Karma runner works on Redhat 6. I can provide more info, if you need.

Same run on Windows 7 with same teamcity reporter works perfectly.

One of the differences: on teamcity all node packages in node_modules were installed in linux environment.

Looks like I got this error only on tests which are using httpBackend service. So I got this issue when some async factor influence test run.

Example of test:

it("livescrolling test", function () {
  // mock
  scope.a.b.c = {
    foo: noopFn
  };
  $httpBackend.expectGET(/(.*?)a\/b\/c(.*?)/).respond({
    a: [{a: 5, b: "someDate"}],
    m: {
      x: 10,
      y: 20,
      z: 0
    }
  });
  // prepare
  spyOn(scope.d.e.f, 'foo');
  scope.m.n.o = [{a: 5, b: "someDate"}];
  expect(scope.a.b.c).toEqual(1);
  expect(scope.m.n.o).toEqual(10);
  ctrl.someFoo(123, 456, true);
  $httpBackend.flush();
  expect(scope.a.b.c).toHaveBeenCalledWith({a: false});
});

fs throws error. Looks like some messages were pushed to somewhere (stdout) and fs thrown error about it is not available. May be it is because I don't use httpBackend correctly?

@fwielstra
Copy link

I've just run into this issue (via karma-junit-reporter); in our case the problem seemed to be a dependency that was mangled by a (company wifi) proxy / firewall / filter. Running npm install via a tethered smartphone resolved the issue. NPM needs signature verification.

@scaljeri
Copy link

+1 I'm getting the same error. To reproduce you can checkout my project here.

$> npm install
$> gulp test

Maybe you have to run gulp twice before you see this error.

@vlki
Copy link

vlki commented May 7, 2016

Seeing same error as @sharikovvladislav when using karma and karma-teamcity-reporter together.

Missing error handler on `socket`.
Error: EAGAIN: resource temporarily unavailable, write
  • Tried other reporters like progress and dots, no error there
  • Error started showing after update from node 5.11.0 to 6.1.0; checked 5.11.0, 6.0.0, 6.1.0, and error is on 6.0.0 and 6.1.0 (Mac OS X 10.11.4), no error on 5.11.0

Minimal setup with which I am able to reproduce the error here

@shaikhspear16
Copy link

I get this error when i add 'browserify' to preprocessors.


 preprocessors: {
            'unit-test/linkers/**/!(*spec).js': ['coverage','browserify']
        }

I was getting require not found when running karma, that made me add browserify, now i get this error

@neilkyoung
Copy link

neilkyoung commented May 20, 2016

Confirm that I also get this error running MacOSX 10.11.1 (15B42):

Missing error handler onsocket. TypeError: (msg || "").replace is not a function

Karma version is 0.13.22.

@shoesel
Copy link

shoesel commented Jun 29, 2016

Seems this is back in Karma 1.1.0 (it was not occuring in 0.13.22)
I'm running tests with --single-run false in PhantomJS 2.1.1 on MacOSX 10.11.4
Output is:

PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 3281 of 3302 (skipped 21) SUCCESS (25.1 secs / 23.617 secs)
Missing error handler on 'socket'.
TypeError: Cannot read property '93062136' of null
  at onBrowserComplete (/PATH-TO/node_modules/karma-junit-reporter/index.js:120:23)
  at .<anonymous> (/PATH-TO/node_modules/karma/lib/events.js:13:22)
  at emitTwo (events.js:111:20)
  at emit (events.js:191:7)
  at onComplete (/PATH-TO/node_modules/karma/lib/browser.js:143:13)
  at Socket.<anonymous> (/PATH-TO/node_modules/karma/lib/events.js:13:22)
  at emitTwo (events.js:111:20)
  at Socket.emit (events.js:191:7)
  at Socket.onevent (/PATH-TO/node_modules/socket.io/lib/socket.js:335:8)
  at Socket.onpacket (/PATH-TO/node_modules/socket.io/lib/socket.js:295:12)
  at Client.ondecoded (/PATH-TO/node_modules/socket.io/lib/client.js:193:14)
  at Decoder.Emitter.emit (/PATH-TO/node_modules/component-emitter/index.js:134:20)
  at Decoder.add (/PATH-TO/node_modules/socket.io-parser/index.js:247:12)
  at Client.ondata (/PATH-TO/node_modules/socket.io/lib/client.js:175:18)
  at emitOne (events.js:96:13)
  at Socket.emit (events.js:188:7)
  at Socket.onPacket (/PATH-TO/node_modules/engine.io/lib/socket.js:101:14)
  at emitOne (events.js:96:13)
  at WebSocket.emit (events.js:188:7)
  at WebSocket.Transport.onPacket (/PATH-TO/node_modules/engine.io/lib/transport.js:104:8)
  at WebSocket.Transport.onData (/PATH-TO/node_modules/engine.io/lib/transport.js:115:8)
  at WebSocket.onData (/PATH-TO/node_modules/engine.io/lib/transports/websocket.js:76:30)
  at emitTwo (events.js:106:13)
  at WebSocket.emit (events.js:191:7)
  at Receiver.ontext (/PATH-TO/node_modules/ws/lib/WebSocket.js:816:10)
  at /PATH-TO/node_modules/ws/lib/Receiver.js:477:18
  at Receiver.applyExtensions (/PATH-TO/node_modules/ws/lib/Receiver.js:364:5)
  at /PATH-TO/node_modules/ws/lib/Receiver.js:466:14
  at Receiver.flush (/PATH-TO/node_modules/ws/lib/Receiver.js:340:3)
  at Receiver.opcodes.1.finish (/PATH-TO/node_modules/ws/lib/Receiver.js:482:12)
  at Receiver.expectHandler (/PATH-TO/node_modules/ws/lib/Receiver.js:451:33)
  at Receiver.add (/PATH-TO/node_modules/ws/lib/Receiver.js:95:24)
  at Socket.realHandler (/PATH-TO/node_modules/ws/lib/WebSocket.js:800:20)
  at emitOne (events.js:96:13)
  at Socket.emit (events.js:188:7)
  at readableAddChunk (_stream_readable.js:172:18)
  at Socket.Readable.push (_stream_readable.js:130:10)
  at TCP.onread (net.js:542:20)

PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
  Disconnectedundefined

@richburdon
Copy link

+1

@murrayju
Copy link

+1, I see the same behavior as @shoesel

@stramel
Copy link

stramel commented Jul 21, 2016

+1, Having the issue as well

@HipsterZipster
Copy link

HipsterZipster commented Jul 22, 2016

+1 having issue on karma 1.1.1 without karma-junit-reporter

@dignifiedquire
Copy link
Member

I haven't been able to reproduce this issue, so I need a repo that I can clone and run that shows this issue.

dam-ien added a commit to dam-ien/karma that referenced this issue Aug 3, 2016
…ML URL encoded characters. Karma fails on Jenkins when it checks out branches containing '/' as it converts it to '%2F'. Fixes errors seen on karma-runner#1751, karma-runner#61.
dam-ien added a commit to dam-ien/karma that referenced this issue Aug 3, 2016
…ML URL encoded characters. Karma fails on Jenkins when it checks out branches containing '/' as it converts it to '%2F'. Fixes errors seen on karma-runner#1751, karma-runner#61.
@narainsagar
Copy link

narainsagar commented Aug 30, 2016

I am also getting the same error with angular-cli project, I am using these versions:

"angular-cli": "^1.0.0-beta.10",
"karma": "0.13.22",
"karma-phantomjs-launcher": "^1.0.0",
"karma-jasmine": "0.3.8",

If anyone want to check - may clone this repo. Thanks.

@MadaraUchiha
Copy link

Can this please be reopened? I'm getting the same error here.

@Svjard
Copy link

Svjard commented Sep 7, 2016

Getting this same issue. Very basic configuration with angular cli.

@santiagoGuti
Copy link

santiagoGuti commented Sep 12, 2016

getting the same issue

    "karma": "0.13.22",
    "karma-chrome-launcher": "0.2.3",
    "karma-cli": "0.1.2",
    "karma-jasmine": "0.3.8",
    "karma-junit-reporter": "0.4.1",
    "karma-notify-reporter": "0.1.1"

@colllin
Copy link

colllin commented Sep 14, 2016

The problem for me was using Node v6 with karma-jenkins-reporter, which is apparently deprecated. The solution was to switch to karma-junit-reporter.

@marinho
Copy link

marinho commented Sep 16, 2016

It happens for me with [email protected] and [email protected], but only when I have this plugin on my webpack config:

new WebpackShellPlugin({
  onBuildStart: [ 'npm run generate-spec-with-all' ]
}),

The mentioned script just globs a folder, parses some file and generate a dumb spec file with only require calls. It runs fast and works if I call it as npm run generate-spec-with-all && before the test runner.

Update: and it happens only when calling with --auto-watch and --no-single-run.

@fbobbio
Copy link

fbobbio commented Sep 28, 2016

+1 with karma 1.3.0 and karma-junit-reporter 1.1.0 on Ubuntu 16_04

@orestes
Copy link

orestes commented Oct 2, 2016

Same problem here karma-junit-reporter 1.1.0, karma 1.3.0. Any leads?

@stramel
Copy link

stramel commented Oct 3, 2016

I am only running into issues with Windows 8 now.

@noherczeg
Copy link

noherczeg commented Oct 13, 2016

Upgrading PhantomJS and leaving grunt-karma out of the game fixed this for me. It seems to me that grunt-karma is causing the issue.

@ibbatta
Copy link

ibbatta commented Nov 23, 2016

+1 for me

karma 1.3.0

@randakar
Copy link

randakar commented Dec 2, 2016

+1

@nadhir-falta
Copy link

Same problem here karma-junit-reporter 1.1.0, karma 1.3.0, any news about this?

@randakar
Copy link

karma-junit-reporter 1.2.0 should make this error message go away. Though it's quite likely other reporter suffer from the same (or at least something very similar) issue. I'm pretty sure the Jenkins one does.

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