flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

πŸ› [cloud_firestore] Can't run two instances of the same app on Windows: the second one crashes immediately

Open aemelyanovff opened this issue 1 year ago β€’ 8 comments

Bug report

Describe the bug

I can't run two instances of the same app using cloud_firestore on Windows - the first window runs fine, but the second crashes immediately.

I can run multiple instances of Flutter apps that don't use cloud_firestore on Windows no problem.

Steps to reproduce

Steps to reproduce the behavior:

  1. Clone the Firestore example app: https://github.com/firebase/flutterfire/tree/master/packages/cloud_firestore/cloud_firestore/example
  2. Set shouldUseFirestoreEmulator to false (perhaps unnecessary, but I was unable to run the app with the emulator).
  3. Run flutter build windows.
  4. Run build\windows\x86\runner\Release\cloud_firestore_example.exe. Observe that it runs fine.
  5. Without closing the first app, try running another instance of cloud_firestore_example.exe. Observe that it fails to start.

Expected behavior

I should be able to run any number of instances of a Flutter app at the same time.

Sample project

Firestore example app: https://github.com/firebase/flutterfire/tree/master/packages/cloud_firestore/cloud_firestore/example

Additional context

This is what I get when I attach VisualStudio Debugger:

Unhandled exception at 0x00007FFD63275B0C in cloud_firestore_example.exe: Microsoft C++ exception: firebase::firestore::FirestoreInternalError at memory location 0x000000E3070FEF10.

>	KernelBase.dll!00007ffd63275b0c()	Unknown
 	vcruntime140d.dll!00007ffd5632bbf1()	Unknown
 	cloud_firestore_example.exe!firebase::firestore::util::Throw(enum firebase::firestore::util::ExceptionType,char const *,char const *,int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)	Unknown
 	000000e3070fef10()	Unknown
 	cloud_firestore_example.exe!00007ff6d569e208()	Unknown
 	000000e30000000d()	Unknown
 	000000e3070fee08()	Unknown
 	000000e3070fedd8()	Unknown
 	000000e3070feda8()	Unknown
 	cloud_firestore_example.exe!00007ff6d4ace60c()	Unknown

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel [user-branch], 3.19.1, on Microsoft Windows [Version 10.0.22621.3155], locale en-US)
    ! Flutter version 3.19.1 on channel [user-branch] at C:\Users\Anton\opt\flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
[βœ“] Windows Version (Installed version of Windows is version 10 or higher)
[βœ—] Android toolchain - develop for Android devices
    βœ— Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[βœ“] Chrome - develop for the web
[βœ“] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.3)
[!] Android Studio (not installed)
[βœ“] VS Code (version 1.85.2)
[βœ“] Connected device (3 available)
[βœ“] Network resources

! Doctor found issues in 3 categories.

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand
Dart SDK 3.3.0
Flutter SDK 3.19.1
cloud_firestore_example 0.0.0

dependencies:
- cloud_firestore 4.15.7 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 2.26.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- http 1.2.0 [async http_parser meta web]

dev dependencies:
- flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math leak_tracker_flutter_testing async boolean_selector characters collection leak_tracker leak_tracker_testing material_color_utilities meta source_span stream_channel string_scanner term_glyph vm_service]
- integration_test 0.0.0 [flutter flutter_driver flutter_test path vm_service async boolean_selector characters clock collection fake_async file leak_tracker leak_tracker_flutter_testing leak_tracker_testing matcher material_color_utilities meta source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api vector_math webdriver]

transitive dependencies:
- _flutterfire_internals 1.3.24 [collection firebase_core firebase_core_platform_interface flutter meta]
- async 2.11.0 [collection meta]
- boolean_selector 2.1.1 [source_span string_scanner]
- characters 1.3.0
- clock 1.1.1
- cloud_firestore_platform_interface 6.1.8 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- cloud_firestore_web 3.10.7 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js]
- collection 1.18.0
- fake_async 1.3.1 [clock collection]
- file 7.0.0 [meta path]
- firebase_core_platform_interface 5.0.0 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 2.11.5 [firebase_core_platform_interface flutter flutter_web_plugins js meta web]
- flutter_driver 0.0.0 [file flutter flutter_test fuchsia_remote_debug_protocol path meta vm_service webdriver async boolean_selector characters clock collection leak_tracker leak_tracker_flutter_testing leak_tracker_testing matcher material_color_utilities platform process source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api vector_math]
- flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math]
- fuchsia_remote_debug_protocol 0.0.0 [process vm_service file meta path platform]
- http_parser 4.0.2 [collection source_span string_scanner typed_data]
- js 0.6.7 [meta]
- leak_tracker 10.0.0 [clock collection meta path vm_service]
- leak_tracker_flutter_testing 2.0.1 [flutter leak_tracker leak_tracker_testing matcher meta]
- leak_tracker_testing 2.0.1 [leak_tracker matcher meta]
- matcher 0.12.16+1 [async meta stack_trace term_glyph test_api]
- material_color_utilities 0.8.0 [collection]
- meta 1.11.0
- path 1.9.0
- platform 3.1.4
- plugin_platform_interface 2.1.8 [meta]
- process 5.0.2 [file path platform]
- sky_engine 0.0.99
- source_span 1.10.0 [collection path term_glyph]
- stack_trace 1.11.1 [path]
- stream_channel 2.1.2 [async]
- string_scanner 1.2.0 [source_span]
- sync_http 0.3.1
- term_glyph 1.2.1
- test_api 0.6.1 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph]
- typed_data 1.3.2 [collection]
- vector_math 2.1.4
- vm_service 13.0.0
- web 0.4.2
- webdriver 3.0.3 [matcher path stack_trace sync_http]

aemelyanovff avatar Mar 05 '24 15:03 aemelyanovff

Hello @aemelyanovff, thanks for the report. We'll have a look.

Lyokone avatar Mar 13 '24 09:03 Lyokone

@Lyokone - any update on this issue?

leighajarett avatar Apr 01 '24 13:04 leighajarett

I get the same Error. I have two Flutter desktop apps, each one of them will connect to firebase. The first one which loads up will be running without a problem, but the second app will crash silently without and error everytime it tires to set / get or communicate using the firebase firestore instance.

"Device has lost connection"

Shuusan avatar Apr 04 '24 01:04 Shuusan

Any update ?

Shuusan avatar May 10 '24 00:05 Shuusan

The same error here. I can run more than one instances on web browers, but only one on Windows. The applicatoin crashes on get() command.

gustavosanabio27 avatar Jun 19 '24 17:06 gustavosanabio27

Any update?

gustavosanabio27 avatar Aug 06 '24 13:08 gustavosanabio27

Hoping for an update here haha

Shuusan avatar Aug 26 '24 00:08 Shuusan

It crashes randomly on the same machine, same function on Windows.

tranhuudang avatar Sep 02 '24 02:09 tranhuudang

Here the first application being executed works normally, the second application being executed aborts when doing a get.

Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 3.27.3, on Microsoft Windows [versΓ†o 10.0.19045.5371], locale pt-BR) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.12.3) [√] Android Studio (version 2024.2) [√] VS Code (version 1.96.4) [√] Connected device (3 available) [√] Network resources

β€’ No issues found!

ilmarfreitas avatar Feb 05 '25 18:02 ilmarfreitas