Error: Uncaught, unspecified error... when abusing/stress testing LiveQuery
- [x] You've met the prerequisites.
- [X] You're running the latest version of Parse Server.
- [X] You've searched through existing issues. Chances are that your issue has been reported or resolved before.
Steps to reproduce
iOS Simulator 1: Save 5000 PFObjects (50 concurrently) from one iOS simulator to Parse Server. The PFObject has an NSNumber field that is assigned a value between 1~10 randomly.
iOS Simulator 2: Initialize 10 Clients, connected to the WS/LQ Server. Have them subscribe such that they are live-querying objects where a key has a value between 1~10 (client #1 and above PFObj whereKey "whatever" equalTo 1, etc). This means that no "client" will get an object that "belongs" to another client.
Logs/Trace
/app/node_modules/parse-server/lib/ParseServer.js:334
throw err;
^
Error: Uncaught, unspecified "error" event. (control frames cannot have more than 125 bytes of data)
at WebSocket.emit (events.js:157:17)
at Receiver.onerror (/app/node_modules/ws/lib/WebSocket.js:851:10)
at Receiver.error (/app/node_modules/ws/lib/Receiver.js:321:8)
at Receiver.opcodes.10.start (/app/node_modules/ws/lib/Receiver.js:671:14)
at Receiver.processPacket (/app/node_modules/ws/lib/Receiver.js:236:19)
at Receiver.add (/app/node_modules/ws/lib/Receiver.js:95:24)
at Socket.realHandler (/app/node_modules/ws/lib/WebSocket.js:800:20)
at emitOne (events.js:90:13)
at Socket.emit (events.js:182:7)
at readableAddChunk (_stream_readable.js:153:18)
Worker xyz died.. Restarting
The WS server crashes very randomly between 10 seconds to 65 seconds.
cc @wangmengyan95
Hi @skimgosu, have you checked the CPU and memory usage of your server when the error happen?
I spoke too soon. It's happening after 6 or 7 clean finishes with the same 5000n50c/10 clients test. Something I forgot to report was this log that filled the LQ/WS server's console 40+ times:
Can not find subscriptions under this class Order
The iOS Simulator didn't trigger any errors and received 4941 objects out of the 5000, but this was the log:
LQ Client #5 has connected.
LQ Client #7 has connected.
LQ Client #10 has connected.
LQ Client #1 has connected.
LQ Client #9 has connected.
LQ Client #6 has connected.
LQ Client #8 has connected.
LQ Client #4 has connected.
LQ Client #2 has connected.
LQ Client #3 has connected.
code: 1002 reason: nil
code: 1001 reason: Stream end encountered
code: 1001 reason: Stream end encountered
code: 1001 reason: Stream end encountered
code: 1001 reason: Stream end encountered
code: 1001 reason: Stream end encountered
code: 1001 reason: Stream end encountered
code: 1001 reason: Stream end encountered
code: 1001 reason: Stream end encountered
code: 1001 reason: Stream end encountered
LQ Client #8 has connected.
LQ Client #2 has connected.
LQ Client #3 has connected.
LQ Client #4 has connected.
LQ Client #1 has connected.
LQ Client #7 has connected.
LQ Client #5 has connected.
LQ Client #9 has connected.
LQ Client #6 has connected.
LQ Client #10 has connected.
The LQ/WS server logs look like this:
2016-03-25T13:47:51.451793+00:00 app[web.1]: /app/node_modules/parse-server/lib/ParseServer.js:334
2016-03-25T13:47:51.451804+00:00 app[web.1]: throw err;
2016-03-25T13:47:51.451806+00:00 app[web.1]: ^
2016-03-25T13:47:51.451807+00:00 app[web.1]:
2016-03-25T13:47:51.451808+00:00 app[web.1]: Error: Uncaught, unspecified "error" event. (control frames cannot have more than 125 bytes of data)
2016-03-25T13:47:51.451810+00:00 app[web.1]: at WebSocket.emit (events.js:157:17)
2016-03-25T13:47:51.451811+00:00 app[web.1]: at Receiver.onerror (/app/node_modules/ws/lib/WebSocket.js:851:10)
2016-03-25T13:47:51.451812+00:00 app[web.1]: at Receiver.error (/app/node_modules/ws/lib/Receiver.js:321:8)
2016-03-25T13:47:51.451813+00:00 app[web.1]: at Receiver.opcodes.10.start (/app/node_modules/ws/lib/Receiver.js:671:14)
2016-03-25T13:47:51.451814+00:00 app[web.1]: at Receiver.processPacket (/app/node_modules/ws/lib/Receiver.js:236:19)
2016-03-25T13:47:51.451815+00:00 app[web.1]: at Receiver.add (/app/node_modules/ws/lib/Receiver.js:95:24)
2016-03-25T13:47:51.451816+00:00 app[web.1]: at Socket.realHandler (/app/node_modules/ws/lib/WebSocket.js:800:20)
2016-03-25T13:47:51.451816+00:00 app[web.1]: at emitOne (events.js:90:13)
2016-03-25T13:47:51.451817+00:00 app[web.1]: at Socket.emit (events.js:182:7)
2016-03-25T13:47:51.451818+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:153:18)
2016-03-25T13:47:51.462129+00:00 app[web.1]: Worker 2 died.. Restarting
2016-03-25T13:47:51.767221+00:00 app[web.1]: {newrelic-scrubbed}
2016-03-25T13:47:53.245345+00:00 app[web.1]: Worker 3 running on port 17181.
2016-03-25T13:47:53.245869+00:00 app[web.1]: Parse LiveQuery Server starts running
2016-03-25T13:47:53.263678+00:00 app[web.1]: Can not find subscriptions under this class Order
2016-03-25T13:47:54.143126+00:00 app[web.1]: Create new client: 0
2016-03-25T13:47:54.145892+00:00 app[web.1]: Create new client: 1
2016-03-25T13:47:54.146846+00:00 app[web.1]: Can not find subscriptions under this class Order
2016-03-25T13:47:54.157123+00:00 app[web.1]: Create new client: 2
2016-03-25T13:47:53.728210+00:00 app[web.1]: Can not find subscriptions under this class Order
2016-03-25T13:47:53.728660+00:00 app[web.1]: Can not find subscriptions under this class Order
2016-03-25T13:47:53.729091+00:00 app[web.1]: Can not find subscriptions under this class Order
2016-03-25T13:47:53.729580+00:00 app[web.1]: Can not find subscriptions under this class Order
2016-03-25T13:47:53.730022+00:00 app[web.1]: Can not find subscriptions under this class Order
2016-03-25T13:47:53.730431+00:00 app[web.1]: Can not find subscriptions under this class Order
2016-03-25T13:47:53.938102+00:00 app[web.1]: Can not find subscriptions under this class Order
2016-03-25T13:47:53.938402+00:00 app[web.1]: Can not find subscriptions under this class Order
2016-03-25T13:47:53.958970+00:00 app[web.1]: Can not find subscriptions under this class Order
2016-03-25T13:47:53.964416+00:00 app[web.1]: Can not find subscriptions under this class Order
2016-03-25T13:47:55.334923+00:00 app[web.1]: Create new client: 3
2016-03-25T13:47:55.335558+00:00 app[web.1]: Create new client: 4
2016-03-25T13:47:55.336111+00:00 app[web.1]: Create new client: 5
2016-03-25T13:47:55.336735+00:00 app[web.1]: Create new client: 6
2016-03-25T13:47:55.337388+00:00 app[web.1]: Create new client: 7
2016-03-25T13:47:55.338013+00:00 app[web.1]: Create new client: 8
2016-03-25T13:47:56.139676+00:00 app[web.1]: Create new client: 9
2016-03-25T13:47:56.165315+00:00 app[web.1]: {newrelic-scrubbed}
2016-03-25T13:47:56.165856+00:00 app[web.1]: {newrelic-scrubbed}
Memory usage: ~150mb CPU load: 0% (?)
Finished two of the 5000n/50c/10client runs and only 9696 objects made it through. I wonder if there's an easy way to make that 10000
Bump
Not sure if closing the issue turns off notifications. Has anyone been able to reproduce the issue, or is it a special case so far?
@skimgosu seems that this is breaking in the lib, maybe you could report that on the ws package repository. Closing the issue won't turn off notifications, so if you feel you can close it, do it :)
Closing since the "test" was very artificial and probably produces weird errors I wouldn't face when doing proper tests with many devices instead of many clients within 1... especially an ios simulator :warning:
And thanks for pointing the ws lib out.. I was assuming it was a problem related to concurrency because of that error log: Error: Uncaught, unspecified "error" event. (control frames cannot have more than 125 bytes of data)