Closed keval-devani closed 1 week ago
This looks like it got stuck in an infinite loop inside the drift_dev
builder - it didn't make any progress after 2 minutes. cc @simolus3
It could be something else, but that would be the first place I would look.
Yes, that's a pretty large database and it's possible that drift is unable to properly analyze all the tables. That would be a drift issue, but I'll probably have a hard time reproducing it (is it possible for you to share more details about the tables in a drift issue to help me reproduce this?).
It's not unlikely that drift is generating >100k LOC for this input, which can severely slow down other Dart tools like the analyzer. You could look into modular code generation and split tables across multiple files to possibly improve things.
@simolus3 Thanks for replay. Yes I already have tables in categories like configs, masters, reports, tags
in different dart files.
And I did change to modular generator. But still getting error
drift_dev config in build.yaml
targets:
$default:
builders:
drift_dev:
enabled: false
# Instead, enable drift_dev:analyzer and drift_dev:modular manually:
drift_dev:analyzer:
enabled: true
options: &options
# Drift build options, as per https://drift.simonbinder.eu/docs/advanced-features/builder_options/
write_from_json_string_constructor: true
data_class_to_companions: true
mutable_classes: true
sql:
dialect: sqlite
options:
version: "3.39"
modules: [fts5]
drift_dev:modular:
enabled: true
# We use yaml anchors to give the two builders the same options
options: *options
I'm using intel macOS with 32 GB RAM if that's help.
Logs after failing to generate using this command dart run build_runner build -d -v
...
...
...
Exhausted heap space, trying to allocate 160 bytes.
[INFO] Heartbeat:22m 43s elapsed, 1251/1258 actions completed.
[WARNING] Heartbeat:
No actions completed for 3m 51s, waiting on:
- drift_dev:analyzer on lib/data/local/tables/tags.dart
- drift_dev:analyzer on lib/data/local/tables/masters.dart
- drift_dev:analyzer on lib/data/local/tables/reports.dart
- drift_dev:analyzer on lib/data/local/daos/master_dao.dart
- drift_dev:analyzer on lib/data/local/database.dart
.. and 2 more
[INFO] Heartbeat:25m 6s elapsed, 1251/1258 actions completed.
[WARNING] Heartbeat:
No actions completed for 2m 22s, waiting on:
- drift_dev:analyzer on lib/data/local/tables/tags.dart
- drift_dev:analyzer on lib/data/local/tables/masters.dart
- drift_dev:analyzer on lib/data/local/tables/reports.dart
- drift_dev:analyzer on lib/data/local/daos/master_dao.dart
- drift_dev:analyzer on lib/data/local/database.dart
.. and 2 more
Exhausted heap space, trying to allocate 1088 bytes.
Exhausted heap space, trying to allocate 64 bytes.
Exhausted heap space, trying to allocate 64 bytes.
You have hit a bug in build_runner
Please file an issue with reproduction steps at https://github.com/dart-lang/build/issues
Bad state: Cannot fire new event. Controller is already firing an event
dart:async _BroadcastStreamController.add
package:logging/src/logger.dart 314:51 Logger._publish
package:logging/src/logger.dart 238:14 Logger.log
package:logging/src/logger.dart 296:7 Logger.severe
package:build_runner_core/src/generate/build_impl.dart 323:17 _SingleBuild._safeBuild.<fn>
Should this issue be closed in favor of https://github.com/simolus3/drift/issues/3306?
I think so, if it turns out to be a build runner or analyzer issue in the end I can always open a more specific one later.
Team, thanks for nice and powerful Dart language. I'm having issue with build _runner to generate files.
I'm using Drift package to handle my local database. and that package is using
drift_dev
with help of build_runner to generate table definition and boilerplate code.I have 315 tables in my database đŹ. Yes in single database
It's taking infinite time 𼾠to build but not able to generate database.g.dart and dao.g.dart files.
Even it's print Out of Memory and Exhausted heap space, trying to allocate 1088 bytes.
Please anyone help me here how to deal with it. Is there any other way to deal with that kind of database?
Output of
flutter doctor -v
This below logs from build_runner command
dart run build_runner build -v