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

Deleting files under directory watching on Windows can cause VM crash #40348

Closed
aam opened this issue Jan 28, 2020 · 24 comments
Closed

Deleting files under directory watching on Windows can cause VM crash #40348

aam opened this issue Jan 28, 2020 · 24 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. library-io os-windows P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@aam
Copy link
Contributor

aam commented Jan 28, 2020

From flutter/flutter#46616 several races were fixed and flutter concerns seem to be addressed, but repro that @DanTup referenced there sill causes crashes in Danny's set up.

Crashdump is available here https://drive.google.com/a/google.com/file/d/186LwO1g9p-eCW9jFmX7sqfhPSmM1hUlI/view?usp=sharing

@aam aam added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-io os-windows labels Jan 28, 2020
@sortie sortie added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. labels Mar 2, 2020
@DanTup
Copy link
Collaborator

DanTup commented Mar 10, 2020

Although my repro was quite contrived, I think Dart-Code/Dart-Code#2287 (comment) may be a user still hitting this when working on Flutter (using the master branch it's happening less, but still happening).

@sortie
Copy link
Contributor

sortie commented Apr 20, 2020

@zichangg Have you tried if this crash can be reproduced?

@DanTup
Copy link
Collaborator

DanTup commented Aug 11, 2020

This has come up a few times again in Dart-Code/Dart-Code#2704 where running a Flutter app crashes the analysis server. Although I can't reproduce it when running the Flutter app, I have reproduced it a few times running flutter clean.

  • (On Windows)
  • Run the flutter_gallery app on Android emulator
  • Run flutter clean
  • Try to hover over anything in editor - pops up Dart Analyzer has terminated

If it doesn't repro, I just re-run the app, stop it, then clean.

Here is a crash dump:

https://drive.google.com/file/d/119wljBikMtmlE2iQsEKaMUEa9NtMQL7x/view?usp=sharing

The version of Flutter I used was

Flutter 1.21.0-8.0.pre.140 • channel master • https://github.com/DanTup/flutter.git
Framework • revision c8d051295a (7 hours ago) • 2020-08-11 00:26:02 -0400
Engine • revision a62703778b
Tools • Dart 2.10.0 (build 2.10.0-5.0.dev e2a67723ca)

Last things in the analyzer instrumentation log are:

1597143277987:Req:{"id"::"68","method"::"edit.getAssists","params"::{"file"::"M::\\Dev\\Google\\flutter_gallery\\lib\\main.dart","length"::0,"offset"::1041},"clientRequestTime"::1597143277987}
1597143277987:Req:{"id"::"69","method"::"edit.getAvailableRefactorings","params"::{"file"::"M::\\Dev\\Google\\flutter_gallery\\lib\\main.dart","length"::0,"offset"::1041},"clientRequestTime"::1597143277987}
1597143277988:Res:{"id"::"69","result"::{"kinds"::[]}}
1597143277992:Res:{"id"::"68","result"::{"assists"::[]}}
1597143280839:Watch:M::\Dev\Google\flutter_gallery:M::\Dev\Google\flutter_gallery\build\71910eb539bb7711546ff654f08685af\gen_localizations.stamp:remove
1597143280840:Watch:M::\Dev\Google\flutter_gallery:M::\Dev\Google\flutter_gallery\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\androidx\activity\R.java:remove
1597143280841:Watch:M::\Dev\Google\flutter_gallery:M::\Dev\Google\flutter_gallery\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\androidx\arch\core\R.java:remove
1597143280841:Watch:M::\Dev\Google\flutter_gallery:M::\Dev\Google\flutter_gallery\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\androidx\core\R.java:remove
1597143280843:Watch:M::\Dev\Google\flutter_gallery:M::\Dev\Google\flutter_gallery\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\androidx\customview\R.java:remove
1597143280844:Watch:M::\Dev\Google\flutter_gallery:M::\Dev\Google\flutter_gallery\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\androidx\fragment\R.java:remove
1597143280844:Watch:M::\Dev\Google\flutter_gallery:M::\Dev\Google\flutter_gallery\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\androidx\lifecycle\livedata\core\R.java:remove
1597143280844:Watch:M::\Dev\Google\flutter_gallery:M::\Dev\Google\flutter_gallery\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\androidx\lifecycle\livedata\R.java:remove
1597143280844:Watch:M::\Dev\Google\flutter_gallery:M::\Dev\Google\flutter_gallery\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\androidx\lifecycle\R.java:remove
1597143280845:Watch:M::\Dev\Google\flutter_gallery:M::\Dev\Google\flutter_gallery\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\androidx\lifecycle\viewmodel\R.java:remove
1597143280845:Watch:M::\Dev\Google\flutter_gallery:M::\Dev\Google\flutter_gallery\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\androidx\loader\R.java:remove
1597143280845:Watch:M::\Dev\Google\flutter_gallery:M::\Dev\Google\flutter_gallery\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\androidx\savedstate\R.java:remove
1597143280845:Watch:M::\Dev\Google\flutter_gallery:M::\Dev\Google\flutter_gallery\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\androidx\versionedparcelable\R.java:remove
1597143280845:Watch:M::\Dev\Google\flutter_gallery:M::\Dev\Google\flutter_gallery\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\androidx\viewpager\R.java:remove

Full analyzer instrumentation log: analyzer.instrum.txt

@devoncarew
Copy link
Member

devoncarew commented Aug 13, 2020

@zichangg @a-siva - Danny's been seeing user reports of this more often. It may or may not be the same as the issue reported in January. Danny does have a consistent repro for this (as well as a crash dump), and is happy to test out possible fixes.

@a-siva
Copy link
Contributor

a-siva commented Aug 14, 2020

@DanTup if you have consistent repro instructions could you post them here.

@DanTup
Copy link
Collaborator

DanTup commented Aug 14, 2020

@a-siva I posted some notes above with a crash dump: #40348 (comment)

It doesn't repro 100% of the time, but if I build/clean a few times, it happens maybe 1-2 times in 5 on my PC.

@szerner
Copy link

szerner commented Aug 26, 2020

I am able to repro this issue with the following steps:

  1. create a new default flutter project: flutter create dart_issue_40348
  2. run a debug session in the emulator and meanwhile do a flutter clean
  3. hover over the editor, the 'Dart Analyzer has terminated' messages immediately start to pop up.

flutter doctor -v:

[√] Flutter (Channel stable, 1.20.2, on Microsoft Windows [Version 10.0.19041.450], locale de-DE)
    • Flutter version 1.20.2 at C:\src\flutter
    • Framework revision bbfbf1770c (13 days ago), 2020-08-13 08:33:09 -0700
    • Engine revision 9d5b21729f
    • Dart version 2.9.1

 
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\android-sdk
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = C:\android-sdk
    • ANDROID_SDK_ROOT = C:\android-sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 48.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.48.2)
    • VS Code at C:\Users\Stephan\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.13.2

[√] Connected device (1 available)
    • AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

• No issues found!

In my real project I'm working on I don't have to emit a flutter clean during the debugging sessions to get the "Dart Analyzer.." messages popping up. I just starts to happen while or after debugging and editing code.

I already struggled with issue flutter/flutter#46616 some times ago, which was resolved for me by the fixes mentioned there.

BTW my Windows development machine is rather old, maybe it's some timing issue?

@a-siva a-siva added this to the October Release 2020 milestone Aug 26, 2020
@a-siva a-siva added the P2 A bug or feature request we're likely to work on label Aug 26, 2020
dart-bot pushed a commit that referenced this issue Aug 28, 2020
The original cl is landed: https://dart-review.googlesource.com/c/sdk/+/133180
But it didn't apply the change in nnbd version and therefore got dropped
during nnbd migration.

Bug: #40348
Change-Id: I648a0ba76122995e5264afce103711dee8c104a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160381
Reviewed-by: Alexander Aprelev <[email protected]>
Commit-Queue: Zichang Guo <[email protected]>
@elricym
Copy link

elricym commented Sep 9, 2020

I'm still encountering the same issue with the latest dart-code and Flutter SDK. If there is any cleanup procedures needs to be done, please let us know. Thank you.
Dart-Code-Log-.txt

@DanTup
Copy link
Collaborator

DanTup commented Sep 9, 2020

@elricym I believe the issue has been fairly recently re-fixed in 04879fa. I don't think that fix has made a stable Flutter release yet.

If you can still repro on a version of Flutter that includes that fix (which right now is probably only master/dev branches) then it might be worth getting a crash dump.

@elricym
Copy link

elricym commented Sep 9, 2020

@DanTup Oh sorry, I thought the latest1.20.3 version is related to this issue.

@DanTup
Copy link
Collaborator

DanTup commented Sep 9, 2020

@elricym unfortunately not. The easiest way I've found to check if a Dart SDK change is in the Flutter SDK you have is to run flutter --version and check the Tools/Dart version. For example here it's 2.10, though for your Flutter version it's likely v2.9.x:

Screenshot 2020-09-09 at 12 28 16

Then if you find the changeset you're interested in in the Dart SDK repo and click the "..." to expand the tags list, you can see which SDK versions include that fix:

Screenshot 2020-09-09 at 12 29 26

For this one, it's only been included in the releases since 2.10.0-77.0.dev, so isn't present in v2.9.

Hope this makes sense!

@franklinyow
Copy link
Contributor

@a-siva reopened, but seems like it can be closed, please take a look

@DanTup
Copy link
Collaborator

DanTup commented Sep 23, 2020

I believe there's still an issue here. There was a fix made (that was accidentally lost, then re-applied), but the original comment here referred to a crash I could still repro with the fix.

I tested again using my same scripts using the current nightly and it happened for 2 out of 11 attempts:

Faulting application name: dart.exe, version: 0.0.0.0, time stamp: 0x5f6b6547
Faulting module name: ntdll.dll, version: 10.0.19041.488, time stamp: 0x70e69bad
Exception code: 0xc0000005
Fault offset: 0x0000000000045e16
Faulting process ID: 0x3b0
Faulting application start time: 0x01d691cb5e1b2f0c
Faulting application path: N:\Apps\Dart\nightly-2020-09-23\bin\dart.exe
Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll
Report ID: df6eb070-a200-4dde-b962-7cea3f4701e0
Faulting package full name: 
Faulting package-relative application ID: 

Here's a crash dump:

https://drive.google.com/file/d/1wFVekU_2jn16IEmiaiNN-9nwSgz0xZSe/view?usp=sharing

@a-siva
Copy link
Contributor

a-siva commented Sep 23, 2020

/cc @aam

@aam
Copy link
Contributor Author

aam commented Sep 24, 2020

@DanTup wrote

I tested again using my same scripts using the current nightly and it happened for 2 out of 11 attempts:

What are the scripts Danny?
The ones where first one watches a large directory(several gbs) with large number of files(tens of thousands), second one deletes that whole directory?

@DanTup
Copy link
Collaborator

DanTup commented Sep 24, 2020

@amm yep! If you don't still have them, you can get them at flutter/flutter#46616 (comment) (I copied them from there yesterday, so that's exactly the code I ran).

@DanTup
Copy link
Collaborator

DanTup commented Sep 24, 2020

@aam using the VM you sent me I didn't see the crash in 20 runs. It was fairly intermittent so no guarantees, but it does seem like it may have fixed/improve it :-)

@aam
Copy link
Contributor Author

aam commented Sep 24, 2020

Thanks @DanTup ! I have put together https://dart-review.googlesource.com/c/sdk/+/164340 with the fix.

@DanTup
Copy link
Collaborator

DanTup commented Sep 24, 2020

Great! I had another report of what may be this still occurring on Flutter master (which has the original fix), so I wonder if it could be this (Dart-Code/Dart-Code#2814).

@DanTup
Copy link
Collaborator

DanTup commented Oct 8, 2020

I had another report of this from @szerner on Flutter's dev channel which includes the latest fix made above, so this may still be an issue.

Dart-Code/Dart-Code#2814 (comment)

@szerner if you able to repro this on a clean Flutter project it may be useful to collect a crash dump (https://docs.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps).

@talent-apps
Copy link

The issue still occurs with Flutter Channel stable, 1.22.0

@szerner
Copy link

szerner commented Oct 8, 2020

The issue still occurs with Flutter Channel stable, 1.22.0

See here @DanTup's comment, the current stable version does not yet contain the fix. At the moment you have to switch to the dev or master channel.

@felipecastrosales
Copy link

Hello devs!
I managed to solve this by doing the following steps:

  • Restarting VSCode,
  • Running "flutter clean" on the terminal,
  • and right after I ran the application!

It was a success! I hope I can help them 😀

@szerner
Copy link

szerner commented Oct 28, 2020

Hello devs!
I managed to solve this by doing the following steps ...

Thanks @felipecastrosales , but in my case this procedure didn't help. Nice you've got a solution for your issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. library-io os-windows P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests