-
Notifications
You must be signed in to change notification settings - Fork 248
pub serve hangs forever after code change on 0.13.0 #1276
Comments
I'm seeing the same behavior on Ubuntu 14.04 64bit and Dart SDK version 1.5.3. |
One workaround for me was to turn off the angular transformer and set DI to use dynamic type factories:
I guess this generates huge output but at least the turn-around time is fast while developing. Hopefully there is a way to have the transformers off while running from editor and turn them on while running from cli, but I don't know how. |
I can confirm setting |
Things you can try:
|
@vicb I just tried that and it hangs with no apparent error. The trigger seems to be changing and saving a dart-file. I assume it should say Reloading the browser page shows a few requests and then just sits there waiting for "main.dart". pub serve output hitting reload in browser window:
|
And if you terminate |
Browser says I also noticed that |
I can reproduce the behavior (save + reload = hang). But when I terminate |
I cannot reproduce this when I downgrade angular to 0.12.0. Could you be more specific as to why this is a pub problem because I'm sure they'll throw it right back here given this information. |
It is not an angular issue because:
Then there is not issue with angular. |
It might still be a problem with the angular transformer. Removing it from pubspec fixes the problem. However, I don't know if it is a general problem with transformers in pub or if it is the angular transformer specifically that triggers the issue. |
I completely agree that that would point towards pub. I'm just focusing on the changes in Angular's transformer since disabling this seems to "fix" the problem and changes were made here between 0.12.0 and 0.13.0 - while pub itself didn't change. I just know a bug report towards pub would be rejected if I don't provide a near smoking gun. My last bug report against pub throwing an out-of-memory exception while upgrading was rejected "as designed". 😄 Poking around in the angular transformer it would seem like the InjectorGenerator change in lib/transformer.dart is correlated with the deadlock. I'm not experienced enough to completely understand the implementation but removing it seems to prevent the deadlock from happening - I can keep curl-getting the main.dart and I see "build completed successfully" messages when I change dart-files. I'll poke around some more before bothering the Dart team. |
@taisph Maybe you can start by creating this dartbug with your findings and say that you're investigating. They can put the ticket on hold waiting for info if necessary. |
I've used for too much time on this already. Reported the bug at dartbug.com. |
This is probably actually an issue in Angular and/or code_transformers. Some simple logging indicates that the If you can reproduce this with transformers that don't use shared instance state or isolate a simple case where barback is misbehaving, go ahead and file a bug against barback. Until then, though, I think the evidence is on the side of this being an issue with the transformers. |
@nex3 Thanks for the info. As indicated above, there is no problem when the transformers run for the first time (i.e. you terminate pub serve before editing and re-launch it right after). How would that relate to your comments ? Could the Given our implementation should we be concerned about transformers running in // ?
Any guidelines / tip on how to do that ? Thanks for your comments. |
The first run of a transformer is often more straightforward than future runs, since everything's a clean slate; no incremental updates need to be done, either by barback or by code_transformers.
Detecting deadlocks in general is halting-complete. A common workaround is to report an error after some timeout, but this is necessarily imprecise.
I don't understand what you mean by "in //".
I often iteratively remove functionality while adding logging to isolate the core of the problem, then see if I can construct that core from simpler components. |
by "//" I mean parallel. I'll try to investigate it. Thanks again for the tips. |
+1 This is preventing me from upgrading to 0.13. Would be really nice to see this fixed in 0.14. |
Any help solving is highly appreciated, thanks. |
So far I've narrowed it down to one task in the "visiting" FutureGroup in _performResolve(), resolver_impl.dart in code_transformers that never completes. I haven't figured out which specific task it is yet. |
When a dart-file is changed after the initial run, |
That suggests that whatever's generating |
It may be a kind of race condition. It seems di |
How deep does the rabbithole go? Below is the blocking call. It is ForeignTransform:getInput() in the dart sdk. deserializeAsset() is never called. _port.toString() is "SendPort".
|
Ok, I think I've nailed the bug now. I need to clean up all my added debug output and test some more then I'll make a PR. |
@taisph thanks for your work on this issue! Any ETA for the PR, it would be nice to have it as part of 0.14 |
I've cleaned up my angular and dart-sdk changes I added in an attempt to follow the callflow. Then I reduced the changes I made to fix the problem to a minimum. When I think of all the logs I've gone through attempting to grasp the inner workings of Angular, Dart, transformers, isolates and what not, the now one-line fix just seems so... ridiculous. Anyway, I can no longer reproduce the deadlock in any of my angular projects with the fix. I've run scripts/run-test.sh as well and there were no failures as far as I could tell. Maybe the deadlock situation could be added to some of these tests? |
@taisph Very nice! What a subtle bug... Can you create a pull request so that the angular team can get it into v0.14? It looks like they're trying to release soon! |
@bgourlie Done. My forked master had changes I didn't want in the PR so I just had to clean that up as well. |
@taisph Awesome and much appreciated! I used to have similar issues when I'd clone a repo and work directly on master. Nowadays I keep master synced with upstream and created branches to work on specific issues, keeps things much cleaner. |
… as this will cause a deadlock Fixes dart-archive#1276 Closes dart-archive#1382 Conflicts: lib/transformer.dart
Pub serve (both from cli and from editor) works on first access. But after changing a dart file and reloading the app the browser hangs forever on loading the .dart or .dart.js file depending on if using Dartium or Chrome.
To reproduce:
This behaviour started after upgrading from 0.12 and adding the angular transformer to pubspec.yaml.
I'm running on Ubuntu 14.04 64bit and Dart SDK version 1.6.0-dev.4.0.
The text was updated successfully, but these errors were encountered: