Building and watching at the same time cause issues #136
Labels
package:build_runner
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
Quite often I'll deploy my app to a test location after making a few changes. The deploy script runs a build. I often forget that I am running a watcher in another shell tab. This causes crashes in both the builder and the watcher.
Would be good to either prevent building whilst the watcher is active (lock files?) or fix the crashes.
Example crash in the build script:
[WARNING] Build: Invalidating asset graph due to build script update [INFO] Build: Checking build script for updates completed, took 137ms [INFO] Build: Finalizing build setup completed, took 526ms [SEVERE] Build: Failed after 10376ms InvalidOutputException: Asset: yacht|web/series.compile.html Cannot overwrite inputs. package:build/src/generate/build_impl.dart 518:11 BuildImpl._runBuilder.<_runBuilder_async_gen_body> dart:async _AsyncStarStreamController.addError package:build/src/generate/build_impl.dart 584:3 BuildImpl._runBuilder.<_runBuilder_async_gen_body> dart:async _AsyncStarStreamController.add package:build/src/generate/build_impl.dart 581:9 BuildImpl._runBuilder.<_runBuilder_async_gen_body> dart:async _AsyncStarStreamController.add package:build/src/generate/build_impl.dart 581:9 BuildImpl._runBuilder.<_runBuilder_async_gen_body> dart:async _SyncCompleter.complete package:build/src/builder/build_step_impl.dart 111:3 BuildStepImpl.complete.<async> dart:async _SyncCompleter.complete package:build/src/asset/file_based.dart 98:3 FileBasedAssetWriter.writeAsString.<async> dart:async _asyncThenWrapperHelper package:build/src/generate/build_impl.dart BuildImpl._runBuilder package:build/src/generate/build_impl.dart 441:16 BuildImpl._runPhases.<async>.<fn>.<async> dart:async Future.wait package:build/src/generate/build_impl.dart 438:20 BuildImpl._runPhases.<async> dart:async Future.Future.microtask package:build/src/generate/build_impl.dart BuildImpl._runPhases package:build/src/logging/logging.dart 19:28 logWithTime.<async> dart:async Future.Future.microtask package:build/src/logging/logging.dart logWithTime package:build/src/generate/build_impl.dart 150:26 BuildImpl.runBuild.<async>.<fn>.<async> dart:async _SyncCompleter.complete package:build/src/logging/logging.dart 23:3 logWithTime.<async> dart:async _SyncCompleter.complete package:build/src/generate/build_impl.dart 147:7 BuildImpl.runBuild.<async>.<fn>.<async>.<fn>.<async> dart:async _SyncCompleter.complete package:build/src/generate/build_impl.dart 332:7 BuildImpl._deletePreviousOutputs.<async> dart:async _SyncCompleter.complete package:build/src/generate/build_impl.dart 331:7 BuildImpl._deletePreviousOutputs.<async>.<fn>.<async> dart:async _SyncCompleter.complete package:build/src/asset/file_based.dart 108:3 FileBasedAssetWriter.delete.<async> package:stack_trace Chain.capture package:build/src/generate/build_impl.dart 82:11 BuildImpl.runBuild.<async>
Example crash in the watcher:
`
[INFO] Watch: Scheduling next build
[INFO] Build: Running build completed, took 5241ms
[INFO] Build: Caching finalized dependency graph completed, took 2ms
[INFO] Build: Succeeded after 5435ms with 22 outputs
[INFO] Build: Checking build script for updates completed, took 96ms
[INFO] Build: Finalizing build setup completed, took 285ms
[INFO] Build: Running build...Unhandled exception:
Bad state: Future already completed
#0 _AsyncCompleter.complete (dart:async/future_impl.dart:40)
#1 BuildImpl.runBuild.<runBuild_async_body>. (package:build/src/generate/build_impl.dart:163:12)
#2 _rootRunBinary (dart:async/zone.dart:1170)
#3 _ZoneDelegate.runBinary (dart:async/zone.dart:714)
#4 StackZoneSpecification.handleUncaughtError (package:stack_trace/src/stack_zone_specification.dart:162:21)
#5 _CustomZone.handleUncaughtError (dart:async/zone.dart:1005)
#6 _Future._propagateToListeners (dart:async/future_impl.dart:552)
#7 _Future._addListener. (dart:async/future_impl.dart:342)
#8 StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:206:15)
#9 StackZoneSpecification.registerCallback. (package:stack_trace/src/stack_zone_specification.dart:125:48)
#10 _rootRun (dart:async/zone.dart:1150)
#11 _CustomZone.run (dart:async/zone.dart:1026)
#12 _CustomZone.runGuarded (dart:async/zone.dart:924)
#13 _CustomZone.bindCallback. (dart:async/zone.dart:951)
#14 _microtaskLoop (dart:async/schedule_microtask.dart:41)
#15 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#16 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#17 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)
`
The text was updated successfully, but these errors were encountered: