2

I have opened asked this question on the Sails project, but it might not be related to Sails at all -- maybe related to Node.js, Express.js or my own code, so I wonder if anyone has ever experienced this:

I have noticed that the browser requests are "replayed" on the server. In order to test it, I did this:

Created a simple controller action that prints "this is a request" on the server -- but does nothing else: it doesn't even send a response to the browser.

When I hit that route, the server console prints "this is a request", as expected. Keep waiting. The browser keeps looping. After 2.5 minutes, "this is a request" is printed again on the server. Is this an expected behavior?

Worst:

Reload the server. Hit the route. "this is a request" is printed on the console. Now ctrl+c the server to shut it down and right away sails lift it again while the browser is still looping. The browser will stop, and right after the server is lifted.... "this is a request" is printed on the console.

More info: I am using sails sockets-io and my code has a "reconnect" function:

        io.socket.on('disconnect', function(){
        socketCleanup();
        io.socket.on('connect', function(){
            socketConnect();
        });
    });

This is used to re-subscribe the user socket to special rooms ( io.socket.post(socketRooms... ) but I don't think it would be responsible for these "replays".

If anything of the above is not the expected behavior, could it be possible that, after an upload is cancelled, there is something trying to replay the upload, causing the server to crash?

I am running Sails on Windows 7.

Something I never knew:

node.js page refresh calling resources twice?

Could this all be caused by favicon???

It seems there is a known bug for Chrome regarding favicons causing duplicate requests: https://bugs.chromium.org/p/chromium/issues/detail?id=64810

However, this doesn't seem related, since the second request here is happening 2.5 minutes later. I have tested with Firefox and IE 9 and the issue is valid there.

Community
  • 1
  • 1
noderman
  • 1,934
  • 1
  • 20
  • 36

0 Answers0