guy icon indicating copy to clipboard operation
guy copied to clipboard

Chrome - net::ERR_CONNECTION_REFUSED - memory full

Open inillaug opened this issue 4 years ago • 2 comments

Hello manatlan,

I i run for example testEmit.py in server mode instead of app mode.

if name == "main": #Emit( ).run() Emit( ).serve(open=False, port=8000 ,log=False, autoreload=False)

If i close the server the Chrome console give me the following error:

Emit_2a1a630-js:9 WebSocket connection to 'ws://127.0.0.1:8000/Emit_2a1a630-ws' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

After 5 minutes Chrome become unusable, the memory consumption encrease and the console give me the following error:

Emit_2a1a630-js:9 WebSocket connection to 'ws://127.0.0.1:8000/Emit_2a1a630-ws' failed: Unknown reason setupWS @ Emit_2a1a630-js:9 (anonymous) @ Emit_2a1a630-js:57

The only way to avoid this modify guy.py at line 896;

ws.onclose = function(evt) {
    guy.log("** WS Disconnected");
    //setTimeout( function() {setupWS(cbCnx)}, 500);
};
ws.onerror = function(evt) {
    guy.log("** WS Disconnected");
    //setTimeout( function() {setupWS(cbCnx)}, 500);

Do you think this is interesting for others? May be an option like app.serve(... , autoreloadws=True/False)?

inillaug avatar Dec 08 '20 05:12 inillaug

really interesting ... in fact, the guy/js on client/side(when your tab is always opened) will try to reconnect indefinitely ... and I think it can increase the memory consumption ...

The only solution, to avoid this : guy should stop its attempts after a number of tries, or after a delay

manatlan avatar Mar 16 '21 07:03 manatlan

Maybe, with every try is creating new elements all the time and there the memory consuption, or, with every try lookup a way to clean the memory

latot avatar Apr 04 '21 20:04 latot