Question: Due to BrowserWindow.loadURL, may it remain CLOSE_WAIT?


#1

I tried to view index.html which on localhost, it succeeded, but I noticed that
the socket state of client becomes CLOSE_WAIT and of server becomes FIN_WAIT_2.

  • OS: Windows7 (64bit)
  • nginx: 1.10.3
  • node: 6.10.2
  • electron-prebuilt: 1.4.13

The file named “index.js” is as follows, and “testindex.html” is very simple.

var electron = require('electron');
var path = require('path');
var url = require('url');
var window = null;
electron.app.once('ready', function() {
  window = new electron.BrowserWindow({width: 500, width: 400});
  window.loadURL('http://localhost/testindex.html');
  window.once('ready-to-show', function() {window.show();});
});

I used TCPView to watch states of sockets.
Once socket’s state becomes ESTABLISHED, then it becomes CLOSE_WAIT or FIN_WAIT_2.

With RawCap and WireShark, it seems

  1. nginx to electron: [FIN, ACK] (maybe, server becomes FIN_WAIT_1)
  2. electron to nginx: [ACK] (maybe, client becomes CLOSE_WAIT, server becomes FIN_WAIT_2)

But electron doesn’t send [FIN, ACK]. So this state keeps for a while, and nginx sends [RST, ACK] and both sockets disappear.

Is this correct behavior? Or my environments fault? Or is the description in index.js insufficient?

(I’m not good at English, it may be hard to understand sentences.)