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: Spellchecker casts new processes, that are not cleared always #83

Open
beljand opened this issue Aug 2, 2017 · 4 comments
Open

Comments

@beljand
Copy link

beljand commented Aug 2, 2017

We're using the default implementation of electron-spellcheker (by the book - docs) and saw that every time a word gets processed a new system process is created and it is not cleared. Those processes stay alive until the app gets shut down.

image

@UndefinedOffset
Copy link

UndefinedOffset commented Jan 12, 2018

Seeing this as well in an app I've been working on, got up to 37 processes with the app running over the course of the week, when they are running they look like the below when using electron-process-manager. They seem to be instances of cld2.js via electron-remote/renderer-require-preload.html that are not stopping or getting hung up.

electron-spellchecker-83

@UndefinedOffset
Copy link

After some more experimenting it seems to happen if the calling renderer closes before the process completes it gets stuck.

@UndefinedOffset
Copy link

I'm not proud of it (kind of a dirty hack and may cause issues on slow machines)... but I do have a work around for this issue that seems to work. Basically it watches in the main process for windows to be created, then waits for them to load. If when they load the url is the preloader and loading cld2.js a timer is started at double the default idle timeout (5s). If the window is still open when the timeout expires it closes it.

app.on('browser-window-created', function(e, window) {
    var timeout;
    window.webContents.once('did-finish-load', function() {
        var url=decodeURIComponent(window.webContents.getURL());
        if(url.indexOf('electron-remote/lib/renderer-require-preload.html')>0 && url.indexOf('electron-spellchecker'+path.sep+'lib'+path.sep+'cld2.js')>0) {
            timeout=setTimeout(function() {
                if(window && !window.isDestroyed()) {
                    window.close();
                }
            }, 10000)
        }
    });

    window.once('closed', function() {
        clearTimeout(timeout);
    });
});

@PanderMusubi
Copy link

You can add this line at the top of the issue description, it will update itself

![badge](https://api.bountysource.com/badge/issue?issue_id=47889325)

and it looks like

badge

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

No branches or pull requests

3 participants