RangeError: Maximum call stack size exceeded
See original GitHub issueI am just calling `ìo.sockets.emit(‘hey’, data);and it will crash with
RangeError: Maximum call stack size exceeded. I use it in other places in my app and it works fine. I am not repeating this (checked with console). The logs say the error is in
socket.io/node_modules/has-binary-data/index.js:46``.
I dont know where the problem is. I tried logging io.sockets
right before using it and it outputs this:
{ name: '/',
17:39:37 web.1 | server:
17:39:37 web.1 | { nsps: { '/': [Circular] },
17:39:37 web.1 | _path: '/socket.io',
17:39:37 web.1 | _serveClient: true,
17:39:37 web.1 | _adapter: [Function: Adapter],
17:39:37 web.1 | _origins: '*:*',
17:39:37 web.1 | sockets: [Circular],
17:39:37 web.1 | eio:
17:39:37 web.1 | { clients: [Object],
17:39:37 web.1 | clientsCount: 2,
17:39:37 web.1 | pingTimeout: 60000,
17:39:37 web.1 | pingInterval: 25000,
17:39:37 web.1 | upgradeTimeout: 10000,
17:39:37 web.1 | maxHttpBufferSize: 100000000,
17:39:37 web.1 | transports: [Object],
17:39:37 web.1 | allowUpgrades: true,
17:39:37 web.1 | allowRequest: [Function],
17:39:37 web.1 | cookie: 'io',
17:39:37 web.1 | ws: [Object],
17:39:37 web.1 | _events: [Object] },
17:39:37 web.1 | engine:
17:39:37 web.1 | { clients: [Object],
17:39:37 web.1 | clientsCount: 2,
17:39:37 web.1 | pingTimeout: 60000,
17:39:37 web.1 | pingInterval: 25000,
17:39:37 web.1 | upgradeTimeout: 10000,
17:39:37 web.1 | maxHttpBufferSize: 100000000,
17:39:37 web.1 | transports: [Object],
17:39:37 web.1 | allowUpgrades: true,
17:39:37 web.1 | allowRequest: [Function],
17:39:37 web.1 | cookie: 'io',
17:39:37 web.1 | ws: [Object],
17:39:37 web.1 | _events: [Object] } },
17:39:37 web.1 | sockets:
17:39:37 web.1 | [ { nsp: [Circular],
17:39:37 web.1 | server: [Object],
17:39:37 web.1 | adapter: [Object],
17:39:37 web.1 | id: 'RfgXeMgHeP_9SQC5AAAC',
17:39:37 web.1 | client: [Object],
17:39:37 web.1 | conn: [Object],
17:39:37 web.1 | rooms: [Object],
17:39:37 web.1 | acks: {},
17:39:37 web.1 | connected: true,
17:39:37 web.1 | disconnected: false,
17:39:37 web.1 | handshake: [Object],
17:39:37 web.1 | _events: [Object] },
17:39:37 web.1 | { nsp: [Circular],
17:39:37 web.1 | server: [Object],
17:39:37 web.1 | adapter: [Object],
17:39:37 web.1 | id: '7TEjGJjWzxObulClAAAD',
17:39:37 web.1 | client: [Object],
17:39:37 web.1 | conn: [Object],
17:39:37 web.1 | rooms: [Object],
17:39:37 web.1 | acks: {},
17:39:37 web.1 | connected: true,
17:39:37 web.1 | disconnected: false,
17:39:37 web.1 | handshake: [Object],
17:39:37 web.1 | _events: [Object] } ],
17:39:37 web.1 | connected:
17:39:37 web.1 | { RfgXeMgHeP_9SQC5AAAC:
17:39:37 web.1 | { nsp: [Circular],
17:39:37 web.1 | server: [Object],
17:39:37 web.1 | adapter: [Object],
17:39:37 web.1 | id: 'RfgXeMgHeP_9SQC5AAAC',
17:39:37 web.1 | client: [Object],
17:39:37 web.1 | conn: [Object],
17:39:37 web.1 | rooms: [Object],
17:39:37 web.1 | acks: {},
17:39:37 web.1 | connected: true,
17:39:37 web.1 | disconnected: false,
17:39:37 web.1 | handshake: [Object],
17:39:37 web.1 | _events: [Object] },
17:39:37 web.1 | '7TEjGJjWzxObulClAAAD':
17:39:37 web.1 | { nsp: [Circular],
17:39:37 web.1 | server: [Object],
17:39:37 web.1 | adapter: [Object],
17:39:37 web.1 | id: '7TEjGJjWzxObulClAAAD',
17:39:37 web.1 | client: [Object],
17:39:37 web.1 | conn: [Object],
17:39:37 web.1 | rooms: [Object],
17:39:37 web.1 | acks: {},
17:39:37 web.1 | connected: true,
17:39:37 web.1 | disconnected: false,
17:39:37 web.1 | handshake: [Object],
17:39:37 web.1 | _events: [Object] } },
17:39:37 web.1 | fns: [],
17:39:37 web.1 | ids: 0,
17:39:37 web.1 | acks: {},
17:39:37 web.1 | adapter:
17:39:37 web.1 | { nsp: [Circular],
17:39:37 web.1 | rooms:
17:39:37 web.1 | { '5MGPNOdO4th_dOuZAAAA': [],
17:39:37 web.1 | '64rUhxxp--4Qk1MqAAAB': [],
17:39:37 web.1 | RfgXeMgHeP_9SQC5AAAC: [Object],
17:39:37 web.1 | '7TEjGJjWzxObulClAAAD': [Object] },
17:39:37 web.1 | sids:
17:39:37 web.1 | { RfgXeMgHeP_9SQC5AAAC: [Object],
17:39:37 web.1 | '7TEjGJjWzxObulClAAAD': [Object] },
17:39:37 web.1 | encoder: {} },
17:39:37 web.1 | _events: { connection: [Function] } }
My code is:
if (game.scoreTeamTwo > game.scoreTeamOne && game.scoreTeamTwo > game.scoreTeamThree && game.scoreTeamTwo > game.scoreTeamFour) {
game.winner = 2;
io.sockets.emit('CTFEnd', game);
}
//It´s just looking if team 1 won the game and when it does is emits ````CTFEnd```` and all the other game data
Issue Analytics
- State:
- Created 9 years ago
- Reactions:6
- Comments:37 (3 by maintainers)
Top Results From Across the Web
javascript - Maximum call stack size exceeded error
It means that somewhere in your code, you are calling a function which in turn calls another function and so forth, until you...
Read more >Uncaught RangeError: Maximum call ... - Net-Informations.Com
This error is almost always means you have a problem with recursion in JavaScript code, as there isn't any other way in JavaScript...
Read more >JavaScript Error: Maximum Call Stack Size Exceeded
If you see the “Maximum Call Stack Size Exceeded” error, there's likely a problem with a recursive function within your JavaScript code.
Read more >RangeError: Maximum call stack size exceeded - Educative.io
The most common source for this error is infinite recursion. You must have a recursive function in your code whose base case is...
Read more >RangeError: Maximum call stack size exceeded in JavaScript
The "RangeError: Maximum call stack size exceeded" error occurs when a function is called so many times that the invocations exceed the call...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This probably happened because you were trying to send an object with circular references resulting in recursive calls that exceeded the stack size.
해결책을 찾습니다…