Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constructor being called twice - only when the code is tested dartium. The generated javascript code behaves correctly #15844

Closed
DartBot opened this issue Dec 31, 2013 · 11 comments
Assignees
Labels
closed-cannot-reproduce Closed as we were unable to reproduce the reported issue
Milestone

Comments

@DartBot
Copy link

DartBot commented Dec 31, 2013

This issue was originally filed by gvpint...@gmail.com


What steps will reproduce the problem?

  1. Used the Searchable list project
  2. added the console log in SearchableList
      SearchableList.created() : super.created() {
        window.console.debug('SearchableList.created()');
      }
  3. added console log in DemoApp
      DemoApp.created() : super.created() {
        window.console.debug('DemoApp.created()');
      }

What is the expected output? What do you see instead?
I see the SearchableList.created called twice
SearchableList.created()
SearchableList.created()
DemoApp.created()

instead of
SearchableList.created()
DemoApp.created()

What version of the product are you using? On what operating system?
Dart Editor version 1.0.0_r30798 (STABLE)
Dart SDK version 1.0.0.10_r30798

Mac OSX 10.9.1

Please provide any additional information below.

@dgrove
Copy link
Contributor

dgrove commented Jan 2, 2014

Can you please point us to a full repro? (ie, the changed sources for the Searchable List project)


Added NeedsInfo label.

@DartBot
Copy link
Author

DartBot commented Feb 10, 2014

This comment was originally written by garrick.black...@gmail.com


I'm having this happen consistently. It's making a mess because sometimes one of the constructors will fail.
I can't reproduce it in a simple example and I can't send in my broken code because it's commercial.
It seems to only happen when using a polymer element from an external package that is also composed of polymer elements.
If I can make time I will create a full reproduction but I don't know if that will happen because employer.

@fsc8000
Copy link
Contributor

fsc8000 commented Feb 10, 2014

I can reproduce this with the searchable_list sample and Dart Editor 1.2.0.dev_03_02 by just adding the two log-statements to demo_app.dart and searchable_list.dart as described in the original report.

When running in Dartium, the constructor of SearchableList is invoked twice. Running the dart2js version only invokes it once.


Added Area-Dartium, Triaged labels.

@sigmundch
Copy link
Member

This sounds similar to the error we had in issue #14459 which we closed because we couldn't reproduce it after a while. We used to think this was related to the GC problems described in issue #14634.

@fsc8000
Copy link
Contributor

fsc8000 commented Feb 12, 2014

I'm unsure if the belongs to Polymer or Dartium.

Here are the stack traces I get from Dartium: It seems ine time the element is cloned and therefore the constructor is invoked twice. Not sure if that's supposed to happen.

#­0 SearchableList.SearchableList.created (http://127.0.0.1:3030/searchable_list/web/elements/searchable_list.dart:19:7)
#­1 _Utils._register (file:///mnt/data/b/build/slave/dartium-lucid32-full-dev/build/src/dart/tools/dom/src/native_DOMImplementation.dart:450)
#­2 _Utils.register (file:///mnt/data/b/build/slave/dartium-lucid32-full-dev/build/src/dart/tools/dom/src/native_DOMImplementation.dart:446)
#­3 HtmlDocument.register (file:///mnt/data/b/build/slave/dartium-lucid32-full-dev/build/src/out/Release/gen/blink/bindings/dart/dart/html/HtmlDocument.dart:266)
#­4 PolymerDeclaration.registerType (package:polymer/src/declaration.dart:241:22)
#­5 PolymerDeclaration.register (package:polymer/src/declaration.dart:164:17)
#­6 PolymerDeclaration._register (package:polymer/src/declaration.dart:114:13)
#­7 PolymerDeclaration.registerWhenReady (package:polymer/src/declaration.dart:109:14)
#­8 _notifyType (package:polymer/src/declaration.dart:476:49)
#­9 Polymer.register (package:polymer/src/instance.dart:65:16)
#­10 _loadLibrary (package:polymer/src/loader.dart:196:25)
#­11 _loadLibraries (package:polymer/src/loader.dart:89:19)
#­12 _initPolymerOptimized (package:polymer/src/loader.dart:54:17)
#­13 _rootRun (dart:async/zone.dart:710)
#­14 _ZoneDelegate.run (dart:async/zone.dart:440)
#­15 _CustomizedZone.run (dart:async/zone.dart:650)
#­16 initPolymer (package:polymer/src/loader.dart:37:33)
#­17 main (package:polymer/init.dart:23:22)

SearchableList.created()
#­0 SearchableList.SearchableList.created (http://127.0.0.1:3030/searchable_list/web/elements/searchable_list.dart:19:7)
#­1 Document._importNode_1 (file:///mnt/data/b/build/slave/dartium-lucid32-full-dev/build/src/out/Release/gen/blink/bindings/dart/dart/html/Document.dart:331)
#­2 Document.importNode (file:///mnt/data/b/build/slave/dartium-lucid32-full-dev/build/src/out/Release/gen/blink/bindings/dart/dart/html/Document.dart:326)
#­3 TemplateBindExtension._deepCloneIgnoreTemplateContent (package:template_binding/src/template.dart:143:43)
#­4 TemplateBindExtension._deepCloneIgnoreTemplateContent (package:template_binding/src/template.dart:147:51)
#­5 TemplateBindExtension.createInstance (package:template_binding/src/template.dart:124:51)
#­6 HtmlElement&Polymer.instanceTemplate (package:polymer/src/instance.dart:422:44)
#­7 HtmlElement&Polymer.shadowFromTemplate (package:polymer/src/instance.dart:271:31)
#­8 HtmlElement&Polymer.parseDeclaration (package:polymer/src/instance.dart:204:34)
#­9 HtmlElement&Polymer.parseDeclarations (package:polymer/src/instance.dart:189:23)
#­10 HtmlElement&Polymer.prepareElement (package:polymer/src/instance.dart:164:22)
#­11 HtmlElement&Polymer.polymerCreated (package:polymer/src/instance.dart:139:21)
#­12 PolymerElement.PolymerElement.created (package:polymer/src/instance.dart:1088:19)
#­13 DemoApp.DemoApp.created (http://127.0.0.1:3030/searchable_list/web/elements/demo_app.dart:24:23)
#­14 _Utils._register (file:///mnt/data/b/build/slave/dartium-lucid32-full-dev/build/src/dart/tools/dom/src/native_DOMImplementation.dart:450)
#­15 _Utils.register (file:///mnt/data/b/build/slave/dartium-lucid32-full-dev/build/src/dart/tools/dom/src/native_DOMImplementation.dart:446)
#­16 HtmlDocument.register (file:///mnt/data/b/build/slave/dartium-lucid32-full-dev/build/src/out/Release/gen/blink/bindings/dart/dart/html/HtmlDocument.dart:266)
#­17 PolymerDeclaration.registerType (package:polymer/src/declaration.dart:241:22)
#­18 PolymerDeclaration.register (package:polymer/src/declaration.dart:164:17)
#­19 PolymerDeclaration._register (package:polymer/src/declaration.dart:114:13)
#­20 PolymerDeclaration.registerWhenReady (package:polymer/src/declaration.dart:109:14)
#­21 _notifyType (package:polymer/src/declaration.dart:476:49)
#­22 Polymer.register (package:polymer/src/instance.dart:65:16)
#­23 _loadLibrary (package:polymer/src/loader.dart:196:25)
#­24 _loadLibraries (package:polymer/src/loader.dart:89:19)
#­25 _initPolymerOptimized (package:polymer/src/loader.dart:54:17)
#­26 _rootRun (dart:async/zone.dart:710)
#­27 _ZoneDelegate.run (dart:async/zone.dart:440)
#­28 _CustomizedZone.run (dart:async/zone.dart:650)
#­29 initPolymer (package:polymer/src/loader.dart:37:33)
#­30 main (package:polymer/init.dart:23:22)

Here is the stack trace I get from the dart2js unminified code:

Error
    at dart.wrapException (http://127.0.0.1:8000/build/web/index.html_bootstrap.dart.js:2291:15)
    at SearchableList.SearchableList$created$0 (http://127.0.0.1:8000/build/web/index.html_bootstrap.dart.js:21611:17)
    at _callConstructor_closure.SearchableList.static.SearchableList$created as constructor_0
    at _callConstructor_closure.call$1 (http://127.0.0.1:8000/build/web/index.html_bootstrap.dart.js:14609:19)
    at invokeClosure_closure0.call$0 (http://127.0.0.1:8000/build/web/index.html_bootstrap.dart.js:3551:29)
    at _IsolateContext.eval$1 (http://127.0.0.1:8000/build/web/index.html_bootstrap.dart.js:1312:23)
    at dart._callInIsolate (http://127.0.0.1:8000/build/web/index.html_bootstrap.dart.js:1057:26)
    at invokeClosure (http://127.0.0.1:8000/build/web/index.html_bootstrap.dart.js:2432:16)
    at http://127.0.0.1:8000/build/web/index.html_bootstrap.dart.js:2449:108
    at null.<anonymous> (http://127.0.0.1:8000/build/web/index.html_bootstrap.dart.js:12956:23)

The way the element's constructor is invoked is different: As a call-back from the event loop. In Dartium it is invoked via main().

@sigmundch
Copy link
Member

Issue #20197 has been merged into this issue.

@sigmundch
Copy link
Member

Issue #20197 also has a simple example reproducing this problem.

@vsmenon
Copy link
Member

vsmenon commented Jul 29, 2014

cc @blois.
Set owner to @vsmenon.
Added this to the 1.6 milestone.
Removed Priority-Unassigned label.
Added Priority-Medium label.

@blois
Copy link
Contributor

blois commented Jul 29, 2014

I cannot repro this, but can repro issue #20197. Resolving this as cannot repro.


Added CannotReproduce label.

@DartBot
Copy link
Author

DartBot commented Jan 23, 2015

This comment was originally written by alois.p...@student.uclouvain.be


Hi,

I also encounter this problem in dartium (the constructor and ready function are actually called three times) but not in firefox when using the dart2js version.

@DartBot
Copy link
Author

DartBot commented Jan 23, 2015

This comment was originally written by @zoechi


Can you provide a complete example that allows to reproduce the problem?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-cannot-reproduce Closed as we were unable to reproduce the reported issue
Projects
None yet
Development

No branches or pull requests

6 participants