Open jmagman opened 3 years ago
A few users reporting this in https://github.com/flutter/flutter/issues/70940 on Big Sur.
@haamaanaa @MoustafaMesbah @thisdarktao @sgorbyo @remonh87
Do you see any suspicious logs in Console when you reproduce that could give a hint as to what's interrupting the call? Maybe from syspolicyd
or kernel
?
@jmagman Running a test battery (running tests from a parent directory) the resulting log contains some additional info on shell stack. Really don't expect them to be useful. I've never seen anything more than that.
Testing started at 11:58 AM ... /Users/danilo/DevEnvironments/flutter/bin/flutter --no-color test --machine test dart:core Uri.base package:path/path.dart 73:15 current package:path/src/context.dart 62:39 Context.current package:path/src/context.dart 471:27 Context.relative package:path/src/context.dart 1062:17 Context.prettyUri package:path/path.dart 461:34 prettyUri ===== asynchronous gap =========================== package:test_api RemoteListener.start /var/folders/8w/l56h825n7rj73d6nyts8712w0000gn/T/flutter_tools.OTjbwB/flutter_test_listener.x0HEsd/listener.dart 16:25 serializeSuite /var/folders/8w/l56h825n7rj73d6nyts8712w0000gn/T/flutter_tools.OTjbwB/flutter_test_listener.x0HEsd/listener.dart 41:36 main
Failed to load "/Users/danilo/AndroidStudioProjects/flutter_genogram/test/geometric_tools_test.dart": Getting current working directory failed, path = '' (OS Error: Interrupted system call, errno = 4)
Shell: [ERROR:flutter/shell/testing/tester_main.cc(302)] Unhandled exception
Shell: Exception: FileSystemException: Getting current working directory failed, path = '' (OS Error: Interrupted system call, errno = 4)
Shell: Stack trace: #0 _uriBaseClosure (dart:io-patch/directory_patch.dart:64:5)
Shell: #1 Uri.base (dart:core-patch/uri_patch.dart:21:41)
Shell: #2 Style._getPlatformStyle (package:path/src/style.dart:41:13)
Shell: #3 Style.platform (package:path/src/style.dart:33:33)
Shell: #4 Style.platform (package:path/src/style.dart)
Shell: #5 new Context._internal (package:path/src/context.dart:49:23)
Shell: #6 createInternal (package:path/src/context.dart:14:37)
Shell: #7 context (package:path/path.dart:56:25)
Shell: #8 context (package:path/path.dart)
Shell: #9 prettyUri (package:path/path.dart:461:26)
Shell: #10 Frame.library (package:stack_trace/src/frame.dart:105:12)
Shell: #11 Frame.location (package:stack_trace/src/frame.dart:119:14)
Shell: #12 Chain.toString.
Failed to load "/Users/danilo/AndroidStudioProjects/flutter_genogram/test/features/access_management/domain/entities/crypto_key_setup_data_test.dart": Shell subprocess cleanly reported an error before connecting to test harness. Check the logs above for an error message. Test: /Users/danilo/AndroidStudioProjects/flutter_genogram/test/features/access_management/domain/entities/crypto_key_setup_data_test.dart Shell: /Users/danilo/DevEnvironments/flutter/bin/cache/artifacts/engine/darwin-x64/flutter_tester
Shell: [ERROR:flutter/shell/testing/tester_main.cc(302)] Unhandled exception
Shell: Exception: FileSystemException: Getting current working directory failed, path = '' (OS Error: Interrupted system call, errno = 4)
Shell: Stack trace: #0 _uriBaseClosure (dart:io-patch/directory_patch.dart:64:5)
Shell: #1 Uri.base (dart:core-patch/uri_patch.dart:21:41)
Shell: #2 current (package:path/path.dart:73:15)
Shell: #3 Context.current (package:path/src/context.dart:62:39)
Shell: #4 Context.relative (package:path/src/context.dart:471:27)
Shell: #5 Context.prettyUri (package:path/src/context.dart:1062:17)
Shell: #6 prettyUri (package:path/path.dart:461:34)
Shell: #7 Frame.library (package:stack_trace/src/frame.dart:105:12)
Shell: #8 Frame.location (package:stack_trace/src/frame.dart:119:14)
Shell: #9 Chain.toString.
Failed to load "/Users/danilo/AndroidStudioProjects/flutter_genogram/test/features/access_management/domain/usecases/register_user_test.dart": Shell subprocess cleanly reported an error after tests finished. Check the logs above for an error message. Test: /Users/danilo/AndroidStudioProjects/flutter_genogram/test/features/access_management/domain/usecases/register_user_test.dart Shell: /Users/danilo/DevEnvironments/flutter/bin/cache/artifacts/engine/darwin-x64/flutter_tester
Shell: [ERROR:flutter/shell/testing/tester_main.cc(302)] Unhandled exception
Shell: Exception: FileSystemException: Getting current working directory failed, path = '' (OS Error: Interrupted system call, errno = 4)
Shell: Stack trace: #0 _uriBaseClosure (dart:io-patch/directory_patch.dart:64:5)
Shell: #1 Uri.base (dart:core-patch/uri_patch.dart:21:41)
Shell: #2 current (package:path/path.dart:73:15)
Shell: #3 Context.current (package:path/src/context.dart:62:39)
Shell: #4 Context.relative (package:path/src/context.dart:471:27)
Shell: #5 Context.prettyUri (package:path/src/context.dart:1062:17)
Shell: #6 prettyUri (package:path/path.dart:461:34)
Shell: #7 Frame.library (package:stack_trace/src/frame.dart:105:12)
Shell: #8 Frame.location (package:stack_trace/src/frame.dart:119:14)
Shell: #9 Chain.toString.
Failed to load "/Users/danilo/AndroidStudioProjects/flutter_genogram/test/features/access_management/domain/entities/crypto_key_test.dart": Shell subprocess cleanly reported an error before connecting to test harness. Check the logs above for an error message. Test: /Users/danilo/AndroidStudioProjects/flutter_genogram/test/features/access_management/domain/entities/crypto_key_test.dart Shell: /Users/danilo/DevEnvironments/flutter/bin/cache/artifacts/engine/darwin-x64/flutter_tester
dart:io-patch/directory_patch.dart 64:5 _uriBaseClosure
dart:core-patch/uri_patch.dart 21:41 Uri.base
package:path/src/style.dart 41:13 Style._getPlatformStyle
package:path/src/style.dart 33:33 Style.platform
package:path/src/style.dart Style.platform
package:flutter_test/src/_goldens_io.dart 70:52 LocalFileComparator._getPath
package:flutter_test/src/_goldens_io.dart 74:34 LocalFileComparator._getBasedir
package:flutter_test/src/_goldens_io.dart 66:17 new LocalFileComparator
/var/folders/8w/l56h825n7rj73d6nyts8712w0000gn/T/flutter_tools.OTjbwB/flutter_test_listener.C7BD69/listener.dart 43:32 main.
Failed to load "/Users/danilo/AndroidStudioProjects/flutter_genogram/test/features/access_management/domain/entities/email_address_test.dart": Getting current working directory failed, path = '' (OS Error: Interrupted system call, errno = 4)
Same issue here... Upgraded to MacOS Big Sur and then started to have two issue types :
1) with antivirus: had to stop the shields like here (see this Switch off these Core Shields if using Avast Security)
2) then some of the unit tests are failing with :
00:19 +37 -11: loading /Volumes/data/project/test/widgets/timeline/timeline_tabs_test.dart [E]
Failed to load "/Volumes/data/project/test/widgets/timeline/timeline_tabs_test.dart":
Shell subprocess cleanly reported an error before connecting to test harness. Check the logs above for an error message.
Test: /Volumes/data/project/test/widgets/timeline/timeline_tabs_test.dart
Shell: /Volumes/data/app/flutter/bin/cache/artifacts/engine/darwin-x64/flutter_tester
or
00:17 +32 -9: loading /Volumes/data/project/test/widgets/main_dashboard/card_carousel_test.dart [E]
Failed to load "/Volumes/data/project/test/widgets/main_dashboard/card_carousel_test.dart": Getting current working directory failed, path = '' (OS Error: Interrupted system call, errno = 4)
dart:io-patch/directory_patch.dart 64:5 _uriBaseClosure
dart:core-patch/uri_patch.dart 21:41 Uri.base
package:path/src/style.dart 41:13 Style._getPlatformStyle
package:path/src/style.dart 33:33 Style.platform
package:path/src/style.dart Style.platform
package:flutter_test/src/_goldens_io.dart 70:52 LocalFileComparator._getPath
package:flutter_test/src/_goldens_io.dart 74:34 LocalFileComparator._getBasedir
package:flutter_test/src/_goldens_io.dart 66:17 new LocalFileComparator
/var/folders/6j/m454ngwn5qd9zypgmsdj5bwr0000gn/T/flutter_tools.gyPUJQ/flutter_test_listener.F097dP/listener.dart 43:32 main.<fn>
package:test_api/src/remote_listener.dart 69:27 RemoteListener.start.<fn>.<fn>.<fn>
dart:async/zone.dart 1190:13 _rootRun
dart:async/zone.dart 1093:19 _CustomZone.run
dart:async/zone.dart 1630:10 _runZoned
dart:async/zone.dart 1618:12 runZonedGuarded
package:test_api/src/remote_listener.dart 66:9 RemoteListener.start.<fn>.<fn>
dart:async/zone.dart 1190:13 _rootRun
dart:async/zone.dart 1093:19 _CustomZone.run
dart:async/zone.dart 1630:10 _runZoned
dart:async/zone.dart 1550:10 runZoned
package:test_api/src/backend/stack_trace_formatter.dart 42:7 StackTraceFormatter.asCurrent
package:test_api/src/remote_listener.dart 65:29 RemoteListener.start.<fn>
dart:async/zone.dart 1190:13 _rootRun
dart:async/zone.dart 1093:19 _CustomZone.run
dart:async/zone.dart 1630:10 _runZoned
dart:async/zone.dart 1550:10 runZoned
package:test_api/src/suite_channel_manager.dart 35:7 SuiteChannelManager.asCurrent
package:test_api/src/remote_listener.dart 64:27 RemoteListener.start
/var/folders/6j/m454ngwn5qd9zypgmsdj5bwr0000gn/T/flutter_tools.gyPUJQ/flutter_test_listener.F097dP/listener.dart 16:25 serializeSuite
/var/folders/6j/m454ngwn5qd9zypgmsdj5bwr0000gn/T/flutter_tools.gyPUJQ/flutter_test_listener.F097dP/listener.dart 41:36 main
dart:ui/hooks.dart 231:25 _runMainZoned.<fn>.<fn>
dart:async/zone.dart 1190:13 _rootRun
dart:async/zone.dart 1093:19 _CustomZone.run
dart:async/zone.dart 1630:10 _runZoned
dart:async/zone.dart 1618:12 runZonedGuarded
dart:ui/hooks.dart 223:5 _runMainZoned.<fn>
dart:isolate-patch/isolate_patch.dart 301:19 _startIsolate.<fn>
dart:isolate-patch/isolate_patch.dart 168:12 _RawReceivePortImpl._handleMessage
@gspanoae @sgorbyo
Do you see any suspicious logs in Console when you reproduce that could give a hint as to what's interrupting the call? Maybe from
syspolicyd
orkernel
?
@jmagman good tip, thanks.. after looking better I could spot my avast premium security
antivirus having something to do with this
i did try several ways to configure it (e.g. including stoping all shields and any scanning!?) but in the end, i had to uninstall avast and now the tests are working - not too happy about it but at least I can continue for now
@jmagman I already had to downgrade back to Catalina to be able to work, so cannot check errors anymore
I can confirm that, also in my case, removing Avira solved the issue.
I just upgraded my Macbook Air back to Big Sur and problem still persists, flutter unit tests fail the same way.
I had a Macbook Pro installed also with Big Sur MacOS and it did not face the same issue with flutter tests.
only difference between these machines is that Macbook pro does not have company mandated MS ATP software installed.
Now.... I cannot uninstall the MS ATP software as that is against company policy, so would be really good that some help could be found from here as well....
We also verified that removing Microsoft ATP "solves" the issue of running flutter tests....
but that cannot be the solution in real world, can it?
Duplicated from #70940
I faced the same issue, when I migrated to Big Sur. Now I have Big Sur 11.2, but the issue with tests running is still reproducible.
I managed to find temporary workaround for it: to run command with concurrency
parameter set to 1 (by default it is 10):
flutter test --concurrency 1
In 95% of runs, error does not appear, but in rest 5% - it does. I suppose, error is somehow related to filesystem access or some access race condition. And I do not rely on my temporary solution, because it decrease running time (because only 1 job is used).
I believe the issue will be investigated and fixed asap.
@ihorvitruk do you also have MS ATP security app installed? or some other security scanner app?
to test with MacOS BigSur + [insert AV scanner here]
import 'package:test/test.dart';
void main() {
test('Test BigSur vs Flutter', () {
expect(1, 1);
});
}
fails after some random amount of tries, at least with MS ATP scanner enabled
base % flutter test test/data/test.dart
00:02 +1: All tests passed!
base % flutter test test/data/test.dart
00:02 +0: loading /Users/mua/dev/projects/some/packages/base/test/data/test.dart
Shell: [ERROR:flutter/shell/testing/tester_main.cc(302)] Unhandled exception
Shell: Exception: FileSystemException: Getting current working directory failed, path = '' (OS Error: Interrupted system call, errno = 4)
Shell: Stack trace: #0 _uriBaseClosure (dart:io-patch/directory_patch.dart:64:5)
Shell: #1 Uri.base (dart:core-patch/uri_patch.dart:21:41)
@haamaanaa no, I don't have MS ATP installed, but I have Jamf (appeared in Big Sur) and SentinelOne (was also in Catalina, when tests ran ok)
I faced the same issue, running: MacOs Big Sur with Avast Antivirus.
In the test case I was just reading file.
Noticed that if I disable "File shield" feature from Avast it will not reproduce.
Workaround is to use that flutter test --concurrency 1
Upgraded to BigSur 11.2.3 today and it solved issue for about 98,6%, even with having antivirus program installed & running. we are also using flutter 2 now.
11.2.3 release notes say: Processing maliciously crafted web content may lead to arbitrary code execution
Running tests in test suite (like with command-line command flutter test) still fails a one random class about 10% of tries. same test succeeds in isolation about 98,6 success rate. earlier when running test suite, more than half test classes would fail, now only singular class fails, sometimes
So something was made better, but still not 100% "there"
I updated my Mac to BigSure 11.2.3 and actually faced the same issue: always and multiple times, running the unit tests, getting the same error Getting current working directory failed, path = '' (OS Error: Interrupted system call, errno = 4)
:
I have same as @haamaanaa Microsoft Defender ATP.
After update to latest version of Microsoft Defender ATP then failure happen anyway and randomly time to time in the same way as above loading the test.
Good news from my side: I found a new workaround. It can be used until the issue is fixed (no matter by whom).
Workaround is to use Retry
annotation (https://api.flutter.dev/flutter/test_api/Retry-class.html)
Annotation should be added to the top of the file with tests. Documentation from the above link says: A test with retries enabled will be re-run if it fails for a reason other than TestFailure
. It means, current issue situation is the exact case, when this annotation should be used. If error Interrupted system call, errno = 4
occurs, test is just run again until it succeed or TestFailure
happened or maximum retries count is reached.
I added @Retry(10)
to test files in my project, but in practice, 4 - is the maximum retries count that I saw. All of the retries are done at the same second of time, it means, that even if you have hundreds or even thousands of tests, tests running time will not be increased a lot.
If your Anti virus software supports exclusions for real-time scan, you can try excluding your workspace/project folder and maybe the temp folder or /private/var/folders
on BigSur.
Seems to work for now.
The latest Big Sur update has been pushed out. Upgrading macOS should solve the issue with Microsoft Defender ATP and Interrupted system call
.
I can confirm that this no longer fails after the MacOS 11.3 update. @viatsko Do you have any background information on why this is?
It might also be that Microsoft have pushed an update to MS ATP itself with automated updates
Have to check if was fixed for us as well....
EDIT: indeed, error seems to have gone the way of Moas
Reported by @haamaanaa at https://github.com/flutter/flutter/issues/70940
Steps to Reproduce
did try to clean flutter pub cache with flutter pub cache repair, and also by deleting said cache folder from laptop and then running flutter pub get again on project and running tests.... still failed
Expected results:
unit test to run successfully at all times (In Catalina OS version, same test(s) run without fail)
Actual results:
at random runs the test fails
Verbose Log
no issues
[✓] Flutter (Channel stable, 1.22.4, on macOS 11.0.1 20B29 darwin-x64, locale en-FI) • Flutter version 1.22.4 at /Users/me/dev-env/flutter • Framework revision 1aafb3a8b9 (7 days ago), 2020-11-13 09:59:28 -0800 • Engine revision 2c956a31c0 • Dart version 2.10.4
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/me/Library/Android/sdk • Platform android-30, build-tools 29.0.2 • ANDROID_HOME = /Users/me/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.2, Build version 12B45b • CocoaPods version 1.8.4
[✓] Android Studio (version 3.5) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 43.0.1 • Dart plugin version 191.8593 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.51.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.16.0
[!] Connected device
! No devices available
! Doctor found issues in 1 category.