Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

0.11 crashes after a few route changes #973

Closed
pcornelissen opened this issue Apr 28, 2014 · 17 comments
Closed

0.11 crashes after a few route changes #973

pcornelissen opened this issue Apr 28, 2014 · 17 comments
Milestone

Comments

@pcornelissen
Copy link

Hi!

My upgrade went to 0.10 went so far that I can start the app in dartium.
When I click on a few menu items, the app crashes and is dead.
It doesn't matter on which page I am, the error occures on all of them after a few clicks.

This is the log output:

listen ignoreClick=false
route /service [Route: null]
listen on win
newHandle for [Route: null]
route /developer [Route: null]
route /developer [Route: null]
route /partner [Route: null]
Next record is null expecting IDENT[null]{15800715}

STACKTRACE:
#0      DirtyCheckingChangeDetector._assertRecordsOk (package:angular/change_detection/dirty_checking_change_detector.dart:268:9)
#1      DirtyCheckingChangeDetectorGroup.remove (package:angular/change_detection/dirty_checking_change_detector.dart:148:33)
#2      WatchGroup.remove (package:angular/change_detection/watch_group.dart:303:27)
#3      Scope.destroy (package:angular/core/scope.dart:313:26)
#4      NgView._cleanUp (package:angular/routing/ng_view.dart:141:19)
#5      NgView._show.<anonymous closure> (package:angular/routing/ng_view.dart:114:15)
#6      _rootRunUnary (dart:async/zone.dart:730)
#7      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#8      _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:96:63)
#9      VmTurnZone._onRunBase (package:angular/core/zone.dart:80:16)
#10     _onRunUnary (package:angular/core/zone.dart:96:17)
#11     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#12     _CustomizedZone.runUnary (dart:async/zone.dart:667)
#13     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
#14     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333)
#15     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263)
#16     _SyncBroadcastStreamController._sendData.<anonymous closure> (dart:async/broadcast_stream_controller.dart:345)
#17     _BroadcastStreamController._forEachListener (dart:async/broadcast_stream_controller.dart:298)
#18     _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:344)
#19     _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:228)
#20     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:654:48)
#21     Router._leaveCurrentRoute (package:route_hierarchical/client.dart:645:41)
#22     Router._leaveOldRoutes (package:route_hierarchical/client.dart:525:30)
#23     Router._processNewRoute (package:route_hierarchical/client.dart:497:27)
#24     Router._route.<anonymous closure> (package:route_hierarchical/client.dart:481:29)
#25     _rootRunUnary (dart:async/zone.dart:730)
#26     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#27     _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:96:63)
#28     VmTurnZone._onRunBase (package:angular/core/zone.dart:80:16)
#29     _onRunUnary (package:angular/core/zone.dart:96:17)
#30     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#31     _CustomizedZone.runUnary (dart:async/zone.dart:667)
#32     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
#33     _Future._propagateToListeners (dart:async/future_impl.dart:571)
#34     _Future._completeWithValue (dart:async/future_impl.dart:331)
#35     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393)
#36     _rootRun (dart:async/zone.dart:719)
#37     _ZoneDelegate.run (dart:async/zone.dart:453)
#38     _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:100:39)
#39     _rootRun (dart:async/zone.dart:723)
#40     _ZoneDelegate.run (dart:async/zone.dart:453)
#41     VmTurnZone._finishTurn (package:angular/core/zone.dart:120:23)
#42     VmTurnZone._onRunBase (package:angular/core/zone.dart:87:43)
#43     _onRunUnary (package:angular/core/zone.dart:96:17)
#44     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#45     _CustomizedZone.runUnary (dart:async/zone.dart:667)
#46     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
#47     _BaseZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:608)
route /partner [Route: null]
'package:angular/core/scope.dart': Failed assertion: line 852 pos 16: 'count >= 0' is not true.

STACKTRACE:
#0      _Streams._addCount (package:angular/core/scope.dart:852:16)
#1      _Streams.destroy.<anonymous closure> (package:angular/core/scope.dart:831:49)
#2      _HashMap&&_LinkedHashMapMixin.forEach (dart:collection-patch/collection_patch.dart:965)
#3      _Streams.destroy (package:angular/core/scope.dart:830:43)
#4      Scope.destroy (package:angular/core/scope.dart:297:21)
#5      NgView._cleanUp (package:angular/routing/ng_view.dart:141:19)
#6      NgView._show.<anonymous closure> (package:angular/routing/ng_view.dart:127:15)
#7      _rootRunUnary (dart:async/zone.dart:730)
#8      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#9      _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:96:63)
#10     VmTurnZone._onRunBase (package:angular/core/zone.dart:80:16)
#11     _onRunUnary (package:angular/core/zone.dart:96:17)
#12     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#13     _CustomizedZone.runUnary (dart:async/zone.dart:667)
#14     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
#15     _Future._propagateToListeners (dart:async/future_impl.dart:571)
#16     _Future._completeWithValue (dart:async/future_impl.dart:331)
#17     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393)
#18     _rootRun (dart:async/zone.dart:719)
#19     _ZoneDelegate.run (dart:async/zone.dart:453)
#20     _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:100:39)
#21     _rootRun (dart:async/zone.dart:723)
#22     _ZoneDelegate.run (dart:async/zone.dart:453)
#23     VmTurnZone._finishTurn (package:angular/core/zone.dart:120:23)
#24     VmTurnZone._onRunBase (package:angular/core/zone.dart:87:43)
#25     _onRunUnary (package:angular/core/zone.dart:96:17)
#26     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#27     _CustomizedZone.runUnary (dart:async/zone.dart:667)
#28     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
#29     _BaseZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:608)

pubspec dependencies: (with most recent versions, if not pinned)

dependencies:
  angular: any
  intl: any
  browser: any
  js: any
  shadow_dom: any
  di: '0.0.40'
transformers:
  - angular:
      html_files:
        - web/index.html
        - web/views/contacts.html
        - web/views/dashboard.html
        - web/views/developer.html
        - web/views/news.html
        - web/views/partner.html
        - web/views/service.html
        - web/views/userAdmin.html

dependency_overrides:
   route_hierarchical: '0.4.19'
@mhevery mhevery self-assigned this Apr 30, 2014
@mhevery mhevery added this to the 0.11.0 milestone Apr 30, 2014
@mhevery
Copy link
Contributor

mhevery commented Apr 30, 2014

You are hitting internal consistency check. This error means that our internal book keeping has gone out of sync and we got confused. This is definitely an error in angular. I would like to get to the bottom of this, but I need to be able to reproduce the error locally. Any way I can get a hold of your source code or could you create a minimal repro case?

@pcornelissen
Copy link
Author

Did you receive my email with the sourcecode?

BTW: I just upgraded my branch to 0.11 and the error is still there. But the filesize of the compiled JS reduced to 900kb which is nice ;-)

@vicb vicb modified the milestones: 0.12.0, 0.11.0 May 8, 2014
@pcornelissen
Copy link
Author

I have worked around the problem by not using scope.watch.

To work around the problem, I forked angular and disabled the cleanup check . See: https://github.com/orchit/angular.dart/commit/09c4226f66855550ecb25092fe8104486786e2ac

In that process I noticed that the scope.watch doesn't work anymore (at least the way I use it).
After I removed the scope.watch and replaced it with my own callback listener code. This works and I can use vanilla angular.dart again.

This is one of the problematic directives:

@NgDirective(selector: '[permissionCheck]')
class PermissionCheckDirective implements AttachAware {
  final Element element;
  final Scope scope;
  PermissionsController ctrl;
  @NgAttr('permissionCheck')
  String idOverride=null;

  PermissionCheckDirective(Element this.element, Scope this.scope, PermissionsController this.ctrl);

  attach() {
    scope.watch("permissionsCtrl.allowedItems", (changeRecord, _) {
      String permissionKey=(idOverride=="")?element.id:idOverride;
      if (permissionKey == null) {
        print("permissionKey is null!");
        return;
      }
      if (changeRecord.contains(permissionKey)) {
        element.classes.remove("ng-hide");
        element.classes.add("permissionChecked");
      } else {
        element.classes.add("ng-hide");
      }
    });
  }
}

@vicb
Copy link
Contributor

vicb commented May 26, 2014

Do you have the code that triggers the issue available somewhere ?

@pcornelissen
Copy link
Author

The code needs the corresponding php code on the same server+DB etc. so that's not really feasable. Or are you only interested in parts of it?
I could send you the permissions.dart file if you like.

As I wrote I could pinpoint the problem to the scope.watch expression. I have a angular dart controller (defined even in the same file) which is exported as permissionsCtrl. It has a list of strings "allowedItems" which should be monitored by the scope.watch.
Without that "watch" the error is gone. Now I just register a callback in the controller to have the same effect.

@vicb
Copy link
Contributor

vicb commented May 26, 2014

The easiest to work with would be small repro that triggers the issue. Do you think it would be possible to mock the server ?

@pcornelissen
Copy link
Author

I tried to create a stripped down version quickly, but looks like I'm missing something important. I'll try later this week. I don't have a lot of time for that right now. I hope to prepare something before Saturday.

@vicb
Copy link
Contributor

vicb commented May 26, 2014

@pcornelissen no pb, take your time (thanks for working on the repro).

@pcornelissen
Copy link
Author

BTW: I only see these crashes when I start dartium in checked mode

@vicb
Copy link
Contributor

vicb commented May 28, 2014

This is because the code is wrapped in an assert assert(root._assertRecordsOk()); hence only executed in checked mode

@pcornelissen pcornelissen changed the title 0.10 crashs after a few route changes 0.11 crashs after a few route changes May 29, 2014
@pcornelissen
Copy link
Author

I have created a stripped down version of the app and replaced all http calls with static data.
https://github.com/orchit/angularDartBugShowcase

to see the bug in action, start chromium in checked mode and just switch views via the menu on the left side.

@pcornelissen pcornelissen changed the title 0.11 crashs after a few route changes 0.11 crashes after a few route changes May 31, 2014
@pcornelissen
Copy link
Author

Sorry, I forgot to push the commit where I strippes the stuff down. Now it's much less code with the same bugs ;)

@chirayuk chirayuk modified the milestones: 0.13.0, 0.12.0 Jun 3, 2014
@vsavkin vsavkin modified the milestones: 0.14.0, 0.13.0 Jul 24, 2014
@rkirov rkirov modified the milestones: 0.14.0, 0.15.0 Aug 22, 2014
@vicb
Copy link
Contributor

vicb commented Aug 29, 2014

Is this bug still in the latest release ? (0.14)

@pcornelissen
Copy link
Author

I can have a look on monday, when I'm back in the office.

2014-08-29 18:12 GMT+02:00 Victor Berchet [email protected]:

Is this bug still in the latest release ? (0.14)


Reply to this email directly or view it on GitHub
#973 (comment)
.

Mit freundlichen Grüßen,
Patrick Cornelißen
http://www.pcornelissen.de
http://www.orchit.de

@vicb
Copy link
Contributor

vicb commented Sep 1, 2014

yes, please let us know

@pcornelissen
Copy link
Author

OK, I can't update right now, as the libs I use, currently especially
angular_ui are not yet updated to work with 0.14 :-(

2014-09-01 9:18 GMT+02:00 Victor Berchet [email protected]:

yes, please let us know


Reply to this email directly or view it on GitHub
#973 (comment)
.

Mit freundlichen Grüßen,
Patrick Cornelißen
http://www.pcornelissen.de
http://www.orchit.de

@vicb
Copy link
Contributor

vicb commented Sep 1, 2014

@pcornelissen Then I'll close this issue for now. Feel free to re-open if it still does not work once you've updated.

@vicb vicb closed this as completed Sep 1, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

6 participants