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

CreateListFromArrayLike called on non-object #3139

Closed
1 of 2 tasks
kaansoral opened this issue Dec 18, 2017 · 6 comments
Closed
1 of 2 tasks

CreateListFromArrayLike called on non-object #3139

kaansoral opened this issue Dec 18, 2017 · 6 comments
Milestone

Comments

@kaansoral
Copy link

You want to:

  • report a bug
  • request a feature

Current behaviour

Server dies instantly, cause unknown

Steps to reproduce (if the current behaviour is a bug)

This happened passively, I found this in my error log

/home/ubuntu/node_modules/socket.io/lib/socket.js:503
      emit.apply(self, event);
           ^

TypeError: CreateListFromArrayLike called on non-object
    at /home/ubuntu/node_modules/socket.io/lib/socket.js:503:12
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)

Expected behaviour

Handle the issue, provide more information

Setup

  • OS: Ubuntu
  • browser: Node 7.7.1
  • socket.io version: 1.7.3

Other information (e.g. stacktraces, related issues, suggestions how to fix)

@hengwoon
Copy link

I have been seeing a bunch of these errors as well

@Chopinsky
Copy link

apply expects event to be a type of array, if event is of any other data type, apply will throw the TypeError. My guess is that event is somewhat null or undefined in this case, probably because decoding data failed and the packet.data is in ill form. Anyway, we should probably check if event is an array before calling apply with it as 2nd argument.

I will submit a PR to put a safeguard in place.

@jamesbachini
Copy link

I had this issue on a fairly high load server. Was getting a lot of uncaught exceptions. The way I fixed it was to add this line to /node_modules/socket.io/lib/socket.js

if (typeof event !== 'object') return false;

Above line 513, emit.apply(self, event);

This seems to have fixed the issue for now but not sure if it's a good permanent solution.

@JohnRSim
Copy link

I'm also experiencing the same issue..

@zalemmm
Copy link

zalemmm commented Feb 5, 2018

Same issue here, after a migration of my projets to a new workstation, and trying to launch my gulp tasks over a fresh node.js & npm packages installation. I tried other solutions, downgrading node.js to my last machine version, erasing & reinstall of node modules, but only jamesbachini solution works for me

@darrachequesne
Copy link
Member

Fixed by socketio/socket.io-parser@f0a7df1, included in socket.io-parser@3.1.3 & socket.io@2.0.4.

@darrachequesne darrachequesne added this to the 2.0.4 milestone Feb 22, 2021
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

8 participants
@kaansoral @JohnRSim @hengwoon @Chopinsky @zalemmm @darrachequesne @jamesbachini and others