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

bad file descriptor errors #27

Open
michaeljpeake opened this issue Feb 28, 2019 · 6 comments
Open

bad file descriptor errors #27

michaeljpeake opened this issue Feb 28, 2019 · 6 comments

Comments

@michaeljpeake
Copy link

I keep getting errors, Uncaught Error: EBADF: bad file descriptor, close, that point back to the setState function in PersistedState.

I wonder if this happens when multiple mutations happen in quick succession. Is there a known limitation in this sense? Is so, might it be possible to implement some kind of debounce to prevent file issues?

@NoelDavies
Copy link

No way! I've just rewritten my app because I thought it was my fault. 😢 Nice to see it being fixed though 👍

@michaeljpeake
Copy link
Author

Actually, I've found the issue may actually be that both the main and renderer functions are trying to set the state on disk.

I've managed to fix it by adding an if statement that checks that the process is the main one, before trying to commit the json to disk. Seems to have fixed everything for me.

I'll create a new fork and see if this one can be merged in.

@NoelDavies
Copy link

I've been testing the new build of my app - and sometimes I get 10+ state updates within a second, so I think these be better off being queued and written every configurable-timeframe (eg 500ms) as I assume the debounce PR addresses.

It would definitely increase performance once the process check fix is implemented. Yes, it may cut my writes by half, but I still think I may have the same issue without the debounce PR too

What are your thoughts?

@rtf-const
Copy link

I think that the error is caused by bug in write-file-atomic
npm/write-file-atomic#39

Easiest solution is to upgrade electron-store module to 3.3.0, which requires newer version of conf module, which requires version write-file-atomic where the bug was fixed

@Just2
Copy link

Just2 commented Jul 21, 2019

I have tried upgrading electron/vuex-electron/write-file-atomic and tried the method by michaeljpeake, but useless. Finally I change to use ipMain = =

@akodkod
Copy link
Contributor

akodkod commented Aug 29, 2019

#44

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

Successfully merging a pull request may close this issue.

5 participants