Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows loading icon stays visible after launching app #4685

Closed
ghost opened this issue Apr 6, 2016 · 11 comments
Closed

Windows loading icon stays visible after launching app #4685

ghost opened this issue Apr 6, 2016 · 11 comments
Assignees
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Apr 6, 2016

Hey, I'm not sure if this is a bug, but I think it's a little abnormal.

But basically, when you click on nw.exe, the loading icon next to your mouse cursor appears for 3-5 seconds. Example:
https://i.gyazo.com/b8c93f501b77d6a811a7750dc8f805d0.gif

I thought this had to do with what was inside my index.html, but you can have a blank index.html and it still does it.

My operating system is:
Windows 7, 64-bit Professional
Samsung EVO 250GB SSD

Build Tested Under
nwjs-sdk-v0.13.3-win-x64

So, I don't think performance here is an issue. But, as you can see from the gif the app is already loaded, but the loading icon next to the cursor stays there for an excessive period of time.

If you need any other OS spec's please let me know. I am not sure if this classifies as a 'bug', and maybe it's just how nw.js runs, so I apologize. I just think it's a bit strange the loading icon stays there even after the app is loaded. 🎱

Edit: Maybe it's just happening on Windows 7? Can anyone else confirm for 7, or if it's not happening on 8 or 10?

@ghost ghost changed the title Windows loading icon stays visible for excessive amount of time after launching app Windows loading icon stays visible after launching app Apr 6, 2016
@rogerwang rogerwang self-assigned this Apr 6, 2016
@rogerwang rogerwang added this to the 0.14.0 milestone Apr 6, 2016
@rogerwang
Copy link
Member

I can reproduce this in a win7 system, but not in a win10 system.

The reason should be:

a) NW inherits the Chromiuim's multi-process architecture, so it launches multiple processes; and windows changes the cursor to IDC_APPSTARTING (feedback cursor) for 2 seconds when CreateProcess is called. "If during those two seconds the process makes the first GUI call, the system gives five more seconds to the process. If during those five seconds the process shows a window, the system gives five more seconds to the process to finish drawing the window.
The system turns the feedback cursor off after the first call to GetMessage, regardless of whether the process is drawing." -- https://msdn.microsoft.com/en-us/library/windows/desktop/ms686331(v=vs.85).aspx

b) In that win7 system, if you watch the number of nw processes when it starts, at first it's 4 processes, then after a while it goes down to 3. That's the GPU process quits for some reason. So the feedback cursor should be waiting for the GPU process's first call to GetMessage, and timeouts when it quits.

Why the GPU process quits in that system is not known yet, but Chrome browser in the same system shares the same behavior.

@rogerwang rogerwang added the nw13 label Apr 8, 2016
@rogerwang rogerwang removed this from the 0.14.0 milestone Apr 8, 2016
@rdtsc
Copy link

rdtsc commented Apr 14, 2016

@rogerwang: In addition to Windows 7, I can reproduce this in a Windows 10 x64 environment without fail with the latest NW.js release. This same behavior is present in Chromium on both Windows 7 and 10.

nwjs-cursor-behavior

@MehmetKursat
Copy link

I can reproduce this on Win 10 x64 with nwjs version v0.14.0

@rogerwang rogerwang added this to the 0.14.x milestone Apr 15, 2016
@rogerwang
Copy link
Member

@rdtsc @FiatPax could you please keep watching the number of nw.exe processes during startup? Does it change from 4 to 3 as I described?

@MehmetKursat
Copy link

For me it is always 4 processes, using the SDK version.
nwjsprocesses

@rdtsc
Copy link

rdtsc commented Apr 15, 2016

@rogerwang: On Windows 10, my results are identical to @FiatPax's. Four processes are spawned and keep running:
nwjs-cursor-behavior-2

On Windows 7, however, four processes are spawned and one of them quits ~2.2 seconds later:
nwjs-cursor-behavior-3

As you can see from the GIFs, both cases result in the system cursor being changed to OCR_APPSTARTING.

For reference, here's the test DLL I had Windows inject to log this:

#include <fstream>
#include <iomanip>
#include <string>

#undef UNICODE
#include <windows.h>

BOOL APIENTRY DllMain(HMODULE, const DWORD reason, LPVOID)
{
  const auto imageName = []
  {
    char buffer[MAX_PATH] = {};

    ::GetModuleFileName(nullptr, buffer, sizeof buffer);

    std::string result(buffer);

    const auto marker = result.find_last_of('\\');

    if(marker != std::string::npos) result = result.substr(marker + 1);

    return result;
  }();

  if(imageName != "nw.exe") return TRUE;

  std::ofstream outputStream("c:/nwjs-process.log", std::ios::app);

  const auto log = [&]() -> std::ostream&
  {
    outputStream << '@' << ::GetTickCount();
    outputStream << " [" << std::setw(4) << ::GetCurrentProcessId() << "] ";

    return outputStream << imageName << " - ";
  };

  switch(reason)
  {
    case DLL_PROCESS_ATTACH: log() << "started.\n"; break;
    case DLL_PROCESS_DETACH: log() << "ended.\n";   break;
  }

  return TRUE;
}

@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

@rogerwang
Copy link
Member

@rdtsc
Copy link

rdtsc commented Apr 20, 2016

@rogerwang: Confirming desired cursor behavior on Windows 7/10 x64 with the build from the 20th. Thanks a lot for the prompt fix.

@ghost
Copy link
Author

ghost commented Apr 20, 2016

Can confirm cursor issue is fixed as well on the 0.14.2 4/20 build.

In fact, the app actually boots up quite a bit faster too.. Which is great! Thank you @rogerwang for your hard work

@MehmetKursat
Copy link

@rogerwang App boots up faster as @Dillybob92 said. That's great thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants