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

Closing a BrowserWindow with set affinity and electron.remote usage from a preload script will freeze similar BrowserWindows. #19753

Closed
markleutloff opened this issue Aug 14, 2019 · 1 comment

Comments

@markleutloff
Copy link

  • Electron Version: >= 6.0.0-beta.13, 6.0.0, 6.0.1, 6.0.2, 7.0.0-beta.1, 7.0.0-beta.2
  • Operating System (Platform and Version): Windows 10
  • Last known working Electron version: 5.0.9, <= 6.0.0-beta.12

Expected Behavior
Closing the BrowserWindow should not freeze other BrowserWindows.

Actual behavior
Similar BrowserWindows will freeze.

To Reproduce
Create a two BrowserWindows with identical webPreferences set to:
preload: some preload script
affinity: some affinity

index.js:

const {app, BrowserWindow} = require('electron')

function createWindow () {
    const browserWindow = new BrowserWindow({
        width: 800,
        height: 600,
        webPreferences: {
            preload: "PATH_TO_PRELOAD.js",
            affinity: "Test"
        }
    })

    browserWindow.loadFile('index.html')
}

app.on('ready', () => {
    createWindow();
    createWindow();
})

app.on('window-all-closed', function () {
    app.quit()
})

preload.js:

// Thats all what is needed to make it break
const { remote } = require("electron");

Additional Information
Just by using electron.remote this issue occours. To test the freeze effect, just try to select some text in the remaining window.

@sofianguy sofianguy added this to Unsorted Issues in 7.2.x Aug 14, 2019
@sofianguy sofianguy moved this from Unsorted Issues to Blocks Stable in 7.2.x Aug 14, 2019
@MarshallOfSound
Copy link
Member

This is why the affinity API is flagged as experimental, what you are seeing here is a deadlock between two renderers with synchronous IPC.

The end game is for affinity to be removed along with all of our other patches to the Chromium process model to avoid scenarios like this. See #18397

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

No branches or pull requests

4 participants