Skip to content

"Null check operator used on a null value" in file watcher #43695

Open
@nex3

Description

@nex3

This is from a user report (sass/dart-sass#1103), so please follow up with @Daijobou if you need more info to reproduce.

It looks like under some filesystem circumstances, possibly related to hibernation, dart:io's file watcher (possibly only on Windows?) can spontaneously produce a "Null check operator used on a null value" error with the following stack trace:

Null check operator used on a null value
#0      _FileSystemWatcher._cancel (dart:io-patch/file_patch.dart:177)
#1      _runGuarded (dart:async/stream_controller.dart:847)
#2      _BroadcastStreamController._callOnCancel (dart:async/broadcast_stream_controller.dart:358)
#3      _BroadcastStreamController._recordCancel (dart:async/broadcast_stream_controller.dart:229)
#4      _ControllerSubscription._onCancel (dart:async/stream_controller.dart:883)
#5      _BufferingStreamSubscription._cancel (dart:async/stream_impl.dart:228)
#6      _BufferingStreamSubscription.cancel (dart:async/stream_impl.dart:210)
#7      _WindowsDirectoryWatcher._startWatch.<anonymous closure> (package:watcher/src/directory_watcher/windows.dart:389)
#8      _rootRunBinary (dart:async/zone.dart:1222)
#9      _RootZone.runBinary (dart:async/zone.dart:1456)
#10     runZonedGuarded.<anonymous closure> (dart:async/zone.dart:1601)
#11     _CustomZone.handleUncaughtError (dart:async/zone.dart:1076)
#12     _nullErrorHandler (dart:async/stream_impl.dart:592)
#13     _rootRunBinary (dart:async/zone.dart:1214)
#14     _CustomZone.runBinary (dart:async/zone.dart:1107)
#15     _CustomZone.runBinaryGuarded (dart:async/zone.dart:1013)
#16     _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:376)
#17     _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:394)
#18     _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:294)#19     _ForwardingStreamSubscription._addError (dart:async/stream_pipe.dart:132)
#20     _addErrorWithReplacement (dart:async/stream_pipe.dart:180)
#21     _ExpandStream._handleData (dart:async/stream_pipe.dart:246)
#22     _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:157)
#23     _rootRunUnary (dart:async/zone.dart:1206)
#24     _CustomZone.runUnary (dart:async/zone.dart:1100)
#25     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005)
#26     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357)#27     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285)
#28     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:808)
#29     _StreamController._add (dart:async/stream_controller.dart:682)
#30     _StreamController.add (dart:async/stream_controller.dart:624)
#31     new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1563)
#32     _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1045)
#33     _microtaskLoop (dart:async/schedule_microtask.dart:41)
#34     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#35     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118)#36     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169)

This user was running Dart 2.9.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.customer-dart-sasslibrary-iotype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions