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

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)
LVL 1
butterhookAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
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
butterhookAuthor Commented:
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
RobOwner (Aidellio)Commented:
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
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

butterhookAuthor Commented:
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
RobOwner (Aidellio)Commented:
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
butterhookAuthor Commented:
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
butterhookAuthor Commented:
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
RobOwner (Aidellio)Commented:
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
butterhookAuthor Commented:
Still looking into this - will post updates when we have some, in the hope that we will help someone else!
0
RobOwner (Aidellio)Commented:
I'd also suggest Requesting Attention to get a moderator to send out alerts to other experts.
0
butterhookAuthor Commented:
Thanks for keeping an eye on this Rob - did you ask the other expert you were considering?

Many thanks!
0
RobOwner (Aidellio)Commented:
Sorry things got a bit crazy around new year but I've since sent the message.
0
butterhookAuthor Commented:
(y)
0
mccarlIT Business Systems Analyst / Software DeveloperCommented:
@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
RobOwner (Aidellio)Commented:
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
butterhookAuthor Commented:
Thanks all - I believe we have found the source of the issue and will update the thread in due course.
0
RobOwner (Aidellio)Commented:
Great news. As an avid knockout developer I'd be keen to hear what's fixed it.
0
butterhookAuthor Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
butterhookAuthor Commented:
We managed to manage the bug by working round it.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.