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

failed to create store: 10199 Could not open database environment #217

Closed
Brazol opened this issue Apr 11, 2021 · 6 comments
Closed

failed to create store: 10199 Could not open database environment #217

Brazol opened this issue Apr 11, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@Brazol
Copy link

Brazol commented Apr 11, 2021

  • ObjectBox version: 0.14.0
  • Flutter/Dart SDK: 2.0.4
  • Null-safety enabled: yes
  • Reproducibility: always

I'm trying to setup objectbox for my app but on iOS (when run from the Flutter project) it crashes all the time when creating a store. Strangely it works when run from XCode.

My code:

Future main() async {
   WidgetsFlutterBinding.ensureInitialized();

   final applicationDirectory = await getApplicationDocumentsDirectory();
   final store = Store(getObjectBoxModel(), directory: '${applicationDirectory.path}/objectbox');

   runApp(MyApp());
}

Error:
flutter: ObjectBoxException: failed to create a store: 10199 Could not open database environment; please check options and file system (4: Interrupted system call)

I get it every time when running Flutter project from VS code or Android studio both on Simulator and on the device. When running from XCode it works.

@Brazol Brazol added the bug Something isn't working label Apr 11, 2021
@greenrobot
Copy link
Member

@Brazol Can you please check the log for additional information just before the crash?

@vaind
Copy link
Contributor

vaind commented Apr 12, 2021

I've tried reproducing by replacing main() in objectbox/example/flutter/objectbox_demo/lib/main.dart with the function you've provided but didn't have an issue launching the application using flutter run. Is flutter run the command you're using or are you launching from some IDE (VS Code, Android studio, ...). Does the error also happen if you move store opening to another method? Is the app an existing project or something just created from a template?

@Brazol
Copy link
Author

Brazol commented Apr 12, 2021

@vaind @greenrobot Thanks for the replies. I tried launching from Android Studio and VS Code and using flutter run command - all with the same crash. Initially, I opened a store using Riverpod provider in one of the Widgets. I moved it to main to create a simpler repro case. It's a new app just created from the template using the newest stable Flutter version.

What I tried:

  • First strange thing is that it works when I open iOS workspace in Xcode and run it from there.
  • I thought that it might be something with flutter permissions to that directory but when I do this just before opening the store the file is created with no issues:
    final file = File('${applicationDirectory.path}/objectbox/file.txt');
    final fileResult = await file.create();
  • I created brand new project with only objectbox and path_provider - same error (and also works from Xcode).
  • I also tried erasing Simulator, running new Simulator on iOS 12.0 instead of 14.4 and running it on device - same result

@greenrobot what log? :) There is little more on the console after the crash:

[VERBOSE-2:ui_dart_state.cc(186)] Unhandled Exception: ObjectBoxException: failed to create store: 10199 Could not open database environment; please check options and file system (4: Interrupted system call)
#0      checkObxPtr (package:objectbox/src/native/bindings/helpers.dart:31:5)
#1      new Store (package:objectbox/src/native/store.dart:94:7)
#2      main (package:test_objectbox/main.dart:25:17)

@greenrobot-team
Copy link
Member

@Brazol Possibly related to dart-lang/sdk#44509?

@Brazol
Copy link
Author

Brazol commented Apr 13, 2021

@Brazol Possibly related to dart-lang/sdk#44509?

Yes! I turned off Intego VirusBarrier and it worked... Thank you

@vaind
Copy link
Contributor

vaind commented Apr 13, 2021

Yes! I turned off Intego VirusBarrier and it worked... Thank you

Wonderful, gotta love those antivirus systems :D
I'm closing this as there's no actionable task we can do in ObjectBox-dart. If you feel otherwise, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants