Project

General

Profile

Actions

Bug #5915

open

Generated javascript causes sometimes Wt internal error - Wt internal error; undefined, description: j7406 is null

Added by Stephan Kerker over 6 years ago. Updated over 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
09/14/2017
Due date:
% Done:

0%

Estimated time:

Description

Hi,

when generating a lot of changes with Wt::WServer::instance()->post(...) together with regular ui-updates the javascript-updates may become unordered.

I setup a thread which increases a counter and sets this to a WText and do a triggerUpdate() every 30ms. Also I did some user-actions on the web-application which caused a few more ui-updates.

This occurs more often when running the server on weak hardware like an Intel-Atom-processor.

The attached file is the response which leads to the error (captured with Wireshark).

j7406 is the variable which is null during execution.

There seems to be a few blocks of code with variables, listed how they appear in the file:

Variables j7393 to j7405.

Variables j7451 to j7462. <--- This seems to be misplaces. I guess when this code would be executed after the code for var j7406-j7450 the issue would not occur.

Variables j7406 to j7450.

Variables j7463 to j7503.

Regards,

Stephan


Files

_wtd=8xKz686SP1D7pYVQ(239) (221 KB) _wtd=8xKz686SP1D7pYVQ(239) Stephan Kerker, 09/14/2017 05:36 PM
Actions #1

Updated by Stephan Kerker over 6 years ago

Edit: Wt-Version 3.3.6 and 3.3.8 tested and both have this issue.

Actions #2

Updated by Roel Standaert over 5 years ago

Hello,

I've looked into similar issues in the past, so there's a possibility that this has been fixed in the meantime.

From your description it seems to me that you have some simple test code to reproduce this issue. Could you share that maybe? It's also possible that there's simply an error in the test code. I may be able to spot that.

Regards,

Roel

Actions #3

Updated by Stephan Kerker over 5 years ago

Hello,

this issue is still reproducible with Wt 3.3.11.

Actually I don't have "simple" code examples which reproduces this issue anymore. But I have a bit more informations.

A workaround I found for this is to use "setTwoPhaseRenderingThreshold(0);" in WebApplication::initialize(). The code suggests that it would disable some kind of performance enhancement, but we haven't seen drastically decreased performance, so for now we stick to this solution.

In case its necessary I can try create a sample application which produces the defect.

Another issue we faced: When running the application in a non standard locale, the website stays blank.

E.g. using (Windows example)

std::locale loc;

loc.global(std::locale("German_germany"));

in the constructor of A WebApplication, causes Wt to create invalid numbers for javascript and the webpage stays blank (I think you are using boost-conversion which is locale aware). This may also generate invalid values for z-index for dialogs, in case you would change the global locale during session runtime.

Actions #4

Updated by Roel Standaert over 5 years ago

The two phase rendering threshold is intended to improve perceived response time. Wt will push visible content to the browser first, and afterwards push what is currently not visible yet. An application that reproduces this problem would be helpful.

Are you using WebSockets? It may also help to turn that on if you aren't.

Wt is indeed not resistant to global locale changes. I've improved that a bit already (mostly on the master branch, so Wt 4), but we're definitely not there yet.

Actions #5

Updated by Stephan Kerker over 5 years ago

Thanks for the reply.

We aren't using websockets, but enabling them seems to workaround the issue. I'm not sure whether we can enable that since we have to support quite old browsers.

I wasn't sucessful in writing some quick small testcode which reproduces the issue, but I've digged in myself a bit.

CollectJavascriptUpdate generates javascript code for visible and invisible changes. In our case the invisible code is larger than the threshold and won't be appended to the visible js-code.

Due to user-action the method WebRenderer::saveChanges is called, which appends new JS code to the previous generated visible-js-code. This code may remove some elements which are used in the generated invisible js-code.

When the js code is sent, its gets transmitted to the browser in the order "visibleJS, saveChangesJS, invisibleJS", but has been generated in the order "visibleJS, invisibleJS, saveChangesJS".

I've tried to flush the invisibleJS_ into collectedJS1_ before adding new JS code for user-generated actions.

void WebRenderer::saveChanges()

{

if (invisibleJS_.length() > 0) {

collectedJS1_ << invisibleJS_.str();

invisibleJS_.clear();

}

collectJS(&collectedJS1_);

}

That fixes the issue, but I don't know whether that may have side effects, since my knowledge about internals of Wt isn't as good as yours. Also it won't use the threshold-value and making this setting somewhat useless in certain situations.

Best regards,

Stephan

Actions

Also available in: Atom PDF