Solved

Knockout .js applying bindings to large model - timeout and uncatchable exception

Posted on 2014-12-16
20
50 Views
Last Modified: 2015-08-11
Technology stack:

* JDK 1.8u25
* KnockoutJS v3.1.0
* JQuery 1.9.1
* WebView and WebEngine

We have an object in our Java environment representing a structured document. Using Java 1.8 u25.

We wish to render it in a JavaFX WebView using custom Knockout.js bindings.

When we call ko.applyBindings() on the model, we get results as follows:

When the number of ‘rows’ in the data structure is < 400, the document renders successfully.

When the number increases beyond this point, we never get past the ko.applyBindings() line in our initialising function.

We don’t appear to get meaningful, if any catchable exceptions with Knockout.js - the document fails to render and gives us some very unexpected output e.g. the output for a context which isn’t in the model.

We don't have this problem when we run the same function in the browser (Chrome)
0
Comment
Question by:butterhook
20 Comments
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Posting JavaScript questions in the Java TA is not appropriate, and might make your question less likely to be answered. http://technojeeves.com/joomla/index.php/free/127-javascript-is-not-java
0
 
LVL 1

Author Comment

by:butterhook
Comment Utility
Thanks CEHJ for the suggestion - however as you can see we are using Knockout.js inside a WebView component of a JavaFX project so it is actually relevant, as the problem we are facing is inside that environment rather than a browser.

Also we are well aware that Javascript isn't Java.
0
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
Comment Utility
Apologies in advance if I ask too many questions regarding the java side of things as my background is javascript and knockout.

What version of javaFX are you running?  It seems that 2.2+ is required for HTML5

When the number of ‘rows’ in the data structure is < 400, the document renders successfully.
Is the 'rows' an observableArray?  It would help to see the model (if only the relevant parts).

Is it possible there a memory restriction for any javascript objects within the WebView/JavaFX?
0
 
LVL 1

Author Comment

by:butterhook
Comment Utility
Hi Rob, Thanks for getting back to us.

Yes, the 'rows' are part of a model. Will see if I can get you the relevant parts as soon as I can as well as the info regarding JavaFX version.

Yes, all our evidence points to the memory restriction for Javascript objects within WebView/JavaFX.

Would you expect a memory restriction in the browser environments you work in?
0
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
Comment Utility
Thanks that info will be good to know.

Yes there are memory limitations but they are not so much of an issue as they are only limited by the operating system and hardware of the client machine. Both of which outstrip anything we would need to do in the browser.
That's not to say they wouldn't crash.

I have a fairly complex model that I use daily,  with upwards of 200 items in an observable at a time. At times it runs slow but more so on my phone and tablet rather than my laptop.
0
 
LVL 1

Author Comment

by:butterhook
Comment Utility
Hi Rob,

The JavaFX version is bundled with JDK 1.8u25.

Will get back to you with parts of the model when possible.

Charlie
0
 
LVL 1

Author Comment

by:butterhook
Comment Utility
Hi Rob,

Are you familiar with Java development, as we have a test case project created? Or is your expertise mainly web and browser?

Charlie
0
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
Comment Utility
Hi Charlie

Unfortunately, it's web based development. It's been 10+ years since I used java (basic structures, applets, forms etc)

Happy to help but understand if you want to get other java specific programmers involved.  In fact, there's another expert I'll ask if they can take a look too.

Rob
0
 
LVL 1

Author Comment

by:butterhook
Comment Utility
Still looking into this - will post updates when we have some, in the hope that we will help someone else!
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
Comment Utility
I'd also suggest Requesting Attention to get a moderator to send out alerts to other experts.
0
 
LVL 1

Author Comment

by:butterhook
Comment Utility
Thanks for keeping an eye on this Rob - did you ask the other expert you were considering?

Many thanks!
0
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
Comment Utility
Sorry things got a bit crazy around new year but I've since sent the message.
0
 
LVL 1

Author Comment

by:butterhook
Comment Utility
(y)
0
 
LVL 35

Expert Comment

by:mccarl
Comment Utility
@butterhook,

I was asked by Rob to look into this from a Java perspective but unfortunately, I don't have any experience with JavaFX and WebView, and so I don't think I can be much help.

we have a test case project created
Just to clarify, are you saying that you have a self-contained example that demonstrates the issue that you are seeing? If so, it still could be worthwhile posting it here for us to look at.
0
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
Comment Utility
Not sure if this helps but it seems that there is an API written specifically to include knockout and its implementation: http://bits.netbeans.org/html+java/dev/overview-summary.html
0
 
LVL 1

Author Comment

by:butterhook
Comment Utility
Thanks all - I believe we have found the source of the issue and will update the thread in due course.
0
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
Comment Utility
Great news. As an avid knockout developer I'd be keen to hear what's fixed it.
0
 
LVL 1

Accepted Solution

by:
butterhook earned 0 total points
Comment Utility
This issue was a memory leak in the JDK whereby large page sizes caused crashes.

We resolved it by using 'virtual pagination' so the document didn't have to be completely loaded, but still appeared to be a single larger document.

Hoping the bug is dealt with in newer versions of the JDK!!
0
 
LVL 1

Author Closing Comment

by:butterhook
Comment Utility
We managed to manage the bug by working round it.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This article discusses how to create an extensible mechanism for linked drop downs.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This video teaches viewers about errors in exception handling.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now