question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

window `close` event gets ignored if nw2 is disabled / `process` signals get ignored and NW.js crashes

See original GitHub issue

Issue Type

  • Bug Report
  • Successfully reproduced against the latest version of NW.js?

Issue

I’m reporting two issues that are somewhat related to each other when trying to intercept the termination of NW.js apps. I noticed the second issue while trying to debug the first one.

  1. Starting with NW.js 0.68, when --disable-features=nw2 is set, attaching a close event listener to a NW.js window does not have any effect and the callback gets ignored. https://docs.nwjs.io/en/latest/References/Window/#event-close
  2. When calling process.removeAllListeners() at the beginning of the application code (e.g. for being able to reset global application state in-between application window reloads) and then attaching an event listener on the process for a SIGTERM signal for example, sending the signal to the running process will cause NW.js to crash if --disable-features=nw2 is set. If --disable-features=nw2 is not set, then the event listener gets ignored, which is bad. https://nodejs.org/api/process.html#signal-events

My application had to set --disable-features=nw2 twice in the past because of various issues with the new nw2 implementation (1, 2), and so far I haven’t reverted this (again). I will need to test the latest releases and see if those issues still occur, but the issues are fixed, I will upgrade to nw2, so the issue shouldn’t affect my application. However, I felt like this issue is still worth reporting, as it’s a regression that has been introduced in 0.68.

The process event listener issue on the other hand looks like a NodeJS related issue (decided to test this after proof-reading my post). NW.js shouldn’t crash though if --disable-features=nw2 is set.

Reproduction

Please see my reproduction repo here with a simple NW.js app and a simple GitHub actions workflow: https://github.com/bastimeyer/nwjs-window-close

The resulting log output with NW.js ranging from 0.64 to 0.70 while running several tests can be found here: https://github.com/bastimeyer/nwjs-window-close/actions/runs/3384916071

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
pd-l2orkcommented, Nov 8, 2022

Second this issue. Just realized that my #8000 (that I now closed) is a duplicate of this. Given that nw2 is about 10x or more slower in processing scripted events than nw1, we really need nw1 to continue to be supported until nw2 reaches the same level of efficiency as nw1. See #7979 for more info.

1reaction
bastimeyercommented, Nov 4, 2022

Yes, I am aware, but NW2 has had lots of bugs over the past years (#7230), and most recently this one #7982, which prevents me from switching (back) to NW2. It’s a “pick your poison” situation for me and either one of those bugs needs to be fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Window - NW.js Documentation
You can prevent the closing by listening to the close event. If force is specified and equals true , then the close event...
Read more >
Untitled
Ffos las racing, Close browser window function, Speed drawing knight? ... Mac miller iphone 5 case, Love being ignored status, Regamaster evo center...
Read more >
frequent-classes - CodaLab Worksheets
4249 21 4245 22 4244 space 4231 check 4218 layer 4214 clone 4196 of 4151 inside 4145 pos 4130 star 4125 previous 4109...
Read more >
Disability and Equality in Employment: - ePrints Soton
The effectiveness of Disability Equality Training in improving employment ... tackle institutionalised discrimination are rejected as being, ...
Read more >
Window - NW.js Documentation - Read the Docs
Close current window. And you can prevent the closing by listening to the close event. If force is specified and equals to true...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found