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
Unhandled Exception: FileSystemException: An async operation is currently pending #56
Comments
We are also facing this issue. Downgraded to |
this usually means that you have unawaited call. Make sure you don't have
any unawaited calls to the methods which are async (return futures)
…On Tue, Dec 22, 2020, 5:27 PM Shobi ***@***.***> wrote:
We are also facing this issue. Downgraded to 3.0.1+4 to fix it for now
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#56 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABPYUNVISEIQOLPZBAGK4WDSWCUGPANCNFSM4VFWOZYA>
.
|
Thanks @lesnitsky I missed some await statements |
I have this problem too. Downgraded to 3.0.1+4 solved my problem. |
@acamenhas downgrading is bad idea :) |
This issue is happening to me as well after upgrading to 3.0.6+9. |
We have the same issue with 3.0.6+9 - with 3.0.3+6 everything is good. What changed between the releases? @lesnitsky |
The problem will occur If two operation write at the same time to the file stored in local storage, while the first operation has not finished to write. (The write operation is still locked) |
i don't think that await is enough to guarantee that this does not happen. If you run some code and this code causes a write to local storage and awaits it, the rest of the app keeps running. If there is any other code scheduled to run it will run, and this code can access local storage again - causing this error. |
This package works well to provide mutually exclusive access to a resource.
|
@lesnitsky would i be possible to get a solution similar to the one given by @tmorone-rezi in the library, so that this error fundamentally cannot happen any longer? A very common use case for this library is to store state. State changes on user input, so even with the trivial increment flutter example, where you press the increment button and a value gets incremented, you can get this error. Assuming that you press it fast enough and you use setItem to save the state on any modification. I checked the exact same code that was causing issues with this code and simply replaced it with sembast and the issues where gone. |
Hello, I have the same problem ! This is my function :
But even if the storage is ready, I have the error on setItem : My version : 4.0.0+1 Any idea where the problem might come from? Thank you! |
quite frankly i would suggest to move to sembast - its a bit more complicated to use - but has no problems such as this. It is also much more future proof if you ever need more advanced features. |
I keep running into this problem and unfortunately will be moving away from LocalStorage |
If it's any use to anyone, but i was having the same trouble, and thought i had added all the necessary awaits, but i was using a forEach loop which will not wait until each async function is executed before moving on, so that was the problem, changed it to not use forEach and then it waits correctly, and i dont get this exception, see |
I updated the localstorage version to ^3.0.6+9 but I get the following exception
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: FileSystemException: An async operation is currently pending, path = '/Users/username/Library/Developer/CoreSimulator/Devices/5C337305-95CC-4BB3-926F-B607E154A1A9/data/Containers/Data/Application/CD793806-AF33-4755-B7E2-D110B346032A/Documents/filename.json'
This is the output of Flutter doctor :
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, v1.17.5, on macOS 11.1 20C69, locale en-KW)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.52.1)
[✓] Connected device (1 available)
• No issues found!
If this exception is not caused by this library, Kindly let me know.
The text was updated successfully, but these errors were encountered: