vuex-electron
vuex-electron copied to clipboard
bad file descriptor errors
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?
No way! I've just rewritten my app because I thought it was my fault. 😢 Nice to see it being fixed though 👍
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.
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?
I think that the error is caused by bug in write-file-atomic https://github.com/npm/write-file-atomic/issues/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
I have tried upgrading electron/vuex-electron/write-file-atomic and tried the method by michaeljpeake, but useless. Finally I change to use ipMain = =
https://github.com/vue-electron/vuex-electron/issues/44