ahmadsayed / node-red-contrib-web-babylonjs

Apache License 2.0
7 stars 5 forks source link

Crashed Node-red: Error: server.handleUpgrade() was called more than once... #12

Closed juggledad closed 3 years ago

juggledad commented 3 years ago

Platform: macOS 10.14.6 Node-RED version: v1.2.9 Node.js version: v14.16.0

From the Node-RED log:

22 Mar 09:58:43 - Error: server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration
    at WebSocketServer.completeUpgrade (/Users/Paul/.node-red/node_modules/node-red-contrib-web-babylonjs/node_modules/ws/lib/websocket-server.js:268:13)
    at WebSocketServer.handleUpgrade (/Users/Paul/.node-red/node_modules/node-red-contrib-web-babylonjs/node_modules/ws/lib/websocket-server.js:246:10)
    at Server.upgrade (/Users/Paul/.node-red/node_modules/node-red-contrib-web-babylonjs/transformation.js:57:21)
    at Server.emit (events.js:327:22)
    at onParserExecuteCommon (_http_server.js:695:14)
    at onParserExecute (_http_server.js:608:3)
Pauls-mini:.node-red Paul$ 

I was just playing with the node trying to see what I coud do. I was trying to make a 'T' shape with two 'BOX' nodes. and had put them in the same, then different scenes. Restarting NR and playing and it crashed.

If I restart NR, as soon as I try to get to the scene in another window, NR crashes. Here is the flow

[{"id":"43f116af.720dc8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"3a33cd98.71ebd2","type":"scene","name":"basecamp","overlay":false},{"id":"2895c5f8.7d92ea","type":"material","name":"default","diffuse":"#77bb41","specular":"#cce8b5","alpha":"0.5"},{"id":"9a71f978.978028","type":"scene","name":"tunnel1","overlay":true},{"id":"4fc032b0.b4a74c","type":"material","name":"lava","diffuse":"#b51a00","specular":"#a77b00","alpha":"0.5"},{"id":"dc3b8f58.928c08","type":"inject","z":"43f116af.720dc8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":120,"wires":[["ac4813e5.66e7"]]},{"id":"ac4813e5.66e7","type":"box","z":"43f116af.720dc8","scene":"9a71f978.978028","material":"4fc032b0.b4a74c","name_conf_a":"tunel1","size_conf_n":1,"height_conf_n":"4","width_conf_n":"3","depth_conf_n":"40","updatable_conf_b":true,"sideOrientation_conf_a":"1","pos_x":0,"pos_y":0,"pos_z":0,"scale_x":1,"scale_y":1,"scale_z":1,"rot_x":0,"rot_y":0,"rot_z":0,"x":420,"y":240,"wires":[[]]},{"id":"15c69041.e0828","type":"box","z":"43f116af.720dc8","scene":"3a33cd98.71ebd2","material":"2895c5f8.7d92ea","name_conf_a":"basecamp","size_conf_n":1,"height_conf_n":"3","width_conf_n":"3","depth_conf_n":"70","updatable_conf_b":true,"sideOrientation_conf_a":"0","pos_x":"20","pos_y":0,"pos_z":0,"scale_x":1,"scale_y":1,"scale_z":1,"rot_x":0,"rot_y":0,"rot_z":0,"x":450,"y":180,"wires":[[]]}]

ahmadsayed commented 3 years ago

@juggledad Thanks a lot, let me work more on stabilizing the WebSocket, in this flow the issue was I did not support multiple scenes so you need to create only one scene and attach all 3d nodes to it.

This will give a much more stable area to work on, I will give this socket issue more attention,

I updated your flow hope this one will work better.

[{"id":"3ed7a37f.731a5c","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"bb23ce93.5da3c","type":"inject","z":"3ed7a37f.731a5c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":120,"wires":[["733ce9bf.4b8a58"]]},{"id":"733ce9bf.4b8a58","type":"box","z":"3ed7a37f.731a5c","scene":"128d5ed0.9f2751","material":"17401297.8ebe0d","name_conf_a":"tunel1","size_conf_n":1,"height_conf_n":"4","width_conf_n":"3","depth_conf_n":"40","updatable_conf_b":true,"sideOrientation_conf_a":"1","pos_x":0,"pos_y":0,"pos_z":0,"scale_x":1,"scale_y":1,"scale_z":1,"rot_x":0,"rot_y":0,"rot_z":0,"x":420,"y":240,"wires":[[]]},{"id":"22c151d6.99647e","type":"box","z":"3ed7a37f.731a5c","scene":"128d5ed0.9f2751","material":"b9fd052b.95e058","name_conf_a":"basecamp1","size_conf_n":1,"height_conf_n":"3","width_conf_n":"3","depth_conf_n":"70","updatable_conf_b":true,"sideOrientation_conf_a":"0","pos_x":"20","pos_y":0,"pos_z":0,"scale_x":1,"scale_y":1,"scale_z":1,"rot_x":0,"rot_y":0,"rot_z":0,"x":450,"y":180,"wires":[[]]},{"id":"128d5ed0.9f2751","type":"scene","name":"basecamp","overlay":false},{"id":"17401297.8ebe0d","type":"material","name":"lava","diffuse":"#b51a00","specular":"#a77b00","alpha":"0.5"},{"id":"b9fd052b.95e058","type":"material","name":"default","diffuse":"#77bb41","specular":"#cce8b5","alpha":"0.5"}]
ahmadsayed commented 3 years ago

https://github.com/ahmadsayed/node-red-contrib-web-babylonjs/commit/9c45d3a6740a2d820fd47114d10830d10c7ce269