Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Occasional Network Error popup
Occasional Network Error popup [message #1738470] Wed, 20 July 2016 07:17 Go to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 190
Registered: January 2012
Senior Member
Hi,
after deploying our RAP application on a remote Tomcat server we are encountering a strange behaviour:
sometime the application shows the popup "Network Error: the server seems to be temporary unavailable" (which, up to now, we have seen only when the server is down).
The server is indeed up an running and a click on Retry button allows the user to continue.
Is there a way to avoid or minimize this problem, e.g. some timeout setting to be raised or some override of RAP classes to skip the popup?

Thank you very much
Vincenzo
Re: Occasional Network Error popup [message #1738586 is a reply to message #1738470] Thu, 21 July 2016 07:08 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2263
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Vincenzo,
the error handling is done in ErrorHandler.js. For me the important part
is why it's happening . Please monitor the requests sent by the browser.
Are there any non 200 response? Are there any long running request? Is
ServerPush running?
Regards,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Occasional Network Error popup [message #1738610 is a reply to message #1738586] Thu, 21 July 2016 11:49 Go to previous messageGo to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 190
Registered: January 2012
Senior Member
Hi Ivan,
thank you for your support!
Indeed I noticed this problem only after accessing the same Tomcat server, but now behind some security manager (IBM Security Access Manager).
I suspect that this is adding some occasional delay/latency in the communication between the client and the server.

All the clients are running just IE10.
I am including some screenshots of the network traffic details when the problem occours.
The problem seems related to occsasionally slow RAP file upload processes.

If I understood well ErrorHandler.js and related .js code, the popup is shown when for 3 times in a row the delay in receiving an answer is about 1 sec each (or 1sec + 2sec + 3sec ? ).
In this case can we just raise this time in order to avoid the popup?
I am suggesting this because, in the end, it is better that the user waits a little more, rather than showing him/her an error popup.

Let me know if the attachment details can be useful for you.
Thank you very much.
Vincenzo
Re: Occasional Network Error popup [message #1738615 is a reply to message #1738610] Thu, 21 July 2016 12:21 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2263
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
the retry attempts, which you mentioned are for ServerPush requests
only. The error message you mentioned ("Network Error: the server seems
to be temporary unavailable") is shown ONLY if the statusCode indicates
connection error (see Connection.js#_isConnectionError). For IE we have
this list:
statusCode === 12007 // ERROR_INTERNET_NAME_NOT_RESOLVED
|| statusCode === 12029 // ERROR_INTERNET_CANNOT_CONNECT
|| statusCode === 12030 // ERROR_INTERNET_CONNECTION_ABORTED
|| statusCode === 12031 // ERROR_INTERNET_CONNECTION_RESET
|| statusCode === 12152 // ERROR_HTTP_INVALID_SERVER_RESPONSE
|| statusCode === 0 // Standard browser connection error status
Could you try to find, which exact statusCode is returned? Is the
problem reproducible with other browsers? Is the IE10 patched with all
the recent updates?
Regards,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Occasional Network Error popup [message #1738655 is a reply to message #1738615] Thu, 21 July 2016 18:32 Go to previous messageGo to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 190
Registered: January 2012
Senior Member
Hi Ivan,
I was on a customer pc today, so I made some tests:

- I tried several times to reproduce the problem on Chrome (the only alternative browser allowed here) and it never happened!

- IE 10 seems updated to 10.0.35 (KB3124275)

- I couldn't find a way to inspect the statusCode, but the IE console showed this error (not shown in Chrome console)

Quote:
SCRIPT7002: XMLHttpRequest: Errore di rete 0x2eff, Impossibile completare l'operazione a causa di un errore 00002eff.

(translated is: Network error 0x2eff, Impossible to complete the operation because of error 00002eff)

Does this help?
Thank you
Vincenzo

[Updated on: Thu, 21 July 2016 18:34]

Report message to a moderator

Re: Occasional Network Error popup [message #1738671 is a reply to message #1738655] Fri, 22 July 2016 07:01 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2263
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Vincenzo,
are you using HTTPS? There are several posts on SoF about problems with
IE. Search for "XMLHttpRequest IE10 error 0x2eff" and you will find
them. Other JS libraries like jquery also have similar problems with IE
and XMLHttpRequest. There is a suggestion to restore the defaults to
"Advanced settings" in IE. Also read this [1].

[1]
http://stackoverflow.com/questions/14527387/script7002-xmlhttprequest-network-error-0x2ef3-could-not-complete-the-operati
HTH,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Occasional Network Error popup [message #1738689 is a reply to message #1738671] Fri, 22 July 2016 09:20 Go to previous messageGo to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 190
Registered: January 2012
Senior Member
Yes Ivan,
I am using HTTPS.
I read the posts on SoF, but I cannot change IE settings because customer's pc's are administered remotely by a security team and every change has to be validated and approved by them Sad

Is there some 'hack', let's say, changing something in ErrorHandler.js or Connection.js in the generated war obtained Exporting from .warproduct in order to skip this popup?

Thank you very much!
Vincenzo
Re: Occasional Network Error popup [message #1738693 is a reply to message #1738689] Fri, 22 July 2016 10:14 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2263
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Vincenzo,
there is always a 'hack' :-). You could patch the JavaScript
ErrorHandler.js#showErrorBox function at runtime with
JavaScriptExecutor. Execute a script in your entry point like this:
---
(function() {
var origShowErrorBox= rwt.runtime.ErrorHandler.showErrorBox;
rwt.runtime.ErrorHandler.showErrorBox = function(errorType, freeze,
errorDetails) {
if (errorType !== "connection error") {
origShowErrorBox(errorType, freeze, errorDetails);
}
};
}());
---
This will skip the error box if errorType is "connection error" and call
original function otherwise.
Note, that this approach (patching RAP client at runtime) is really,
really a BIG hack :-) and it's not recommended as RAP internals (RAP
client) can change between RAP versions without notice.
Regards,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Occasional Network Error popup [message #1738737 is a reply to message #1738693] Fri, 22 July 2016 18:21 Go to previous messageGo to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 190
Registered: January 2012
Senior Member
Wow, great!
Ok, we are perfectly aware that this is a bad practice, but risks are under control if balanced with finding a working solution.

And It works! but I was a little in a rush and was not precise.
Given that when the "Network popup" appears, it is sufficient to click on Retry button to get back to normal functionality, I would like to automate this.
So my original request to not showing the popup should indeed be reformulated in: "when the problem occours simulate a Retry action, ideally avoiding the popup, but not necessarily, since the Retry action just after should take care of closing it, maybe even whitout making the user aware of it".
Should I do something like this (I put your previous code in the unique Perspective class that I have, is it ok?)?

        String script = 
        		"(function() {"
        		+ "		var origShowErrorBox= rwt.runtime.ErrorHandler.showErrorBox;"
        		+ "		rwt.runtime.ErrorHandler.showErrorBox = function(errorType, freeze, errorDetails) {"
        		+ "			if (errorType !== \"connection error\") {"
        		+ "				origShowErrorBox(errorType, freeze, errorDetails);"
        		+ "			} else {"
        		+ "				rwt.remote.Connection.getInstance()._retry();"
        		+ "			};"
        		+ "		};"
        		+ "}());";

or
        String script = 
        		"(function() {"
        		+ "		var origShowErrorBox= rwt.runtime.ErrorHandler.showErrorBox;"
        		+ "		rwt.runtime.ErrorHandler.showErrorBox = function(errorType, freeze, errorDetails) {"
        		+ "			if (errorType === \"connection error\") {"
        		+ "				rwt.remote.Connection.getInstance()._retry();"
        		+ "			};"
        		+ "		};"
        		+ "}());";

?
Re: Occasional Network Error popup [message #1739005 is a reply to message #1738737] Tue, 26 July 2016 17:32 Go to previous messageGo to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 190
Registered: January 2012
Senior Member
No way Sad,
I tried also this way

        String script = 
        		"(function() {"
        		+ "		var origShowErrorBox= rwt.runtime.ErrorHandler.showErrorBox;"
        		+ "		rwt.runtime.ErrorHandler.showErrorBox = function(errorType, freeze, errorDetails) {"
        		+ "			origShowErrorBox(errorType, freeze, errorDetails);"
        		+ "			if (errorType === \"connection error\") {"
        		+ "				rwt.remote.Connection.getInstance()._retry();"
        		+ "			}"
        		+ "		};"
        		+ "}());";

but I just end up (when the Network Error happens) in blocking the UI without any feedback for the user.
I suppose I should put a delay, in order to avoid a loop ...
Any little help?
TIA
Vincenzo
Re: Occasional Network Error popup [message #1739007 is a reply to message #1739005] Tue, 26 July 2016 18:17 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2263
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Vincenz,
try to wrap "rwt.remote.Connection.getInstance()._retry();" in
setTimeout function like:
---
setTimeout(function() {
rwt.remote.Connection.getInstance()._retry();
}, 500);
---
Regards,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Occasional Network Error popup [message #1739040 is a reply to message #1739007] Wed, 27 July 2016 07:17 Go to previous messageGo to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 190
Registered: January 2012
Senior Member
Hi Ivan,
thank you, I tried, but doesn't work.
But there is something more basic that I do not understand:
if I get it correctly (I am very poor at JS) from your very first snippet in this thread, this is a way to override the original method.
Assuming this, then this variant:

       String script = 
        		"(function() {"
        		+ "		var origShowErrorBox=rwt.runtime.ErrorHandler.showErrorBox;"
        		+ "		rwt.runtime.ErrorHandler.showErrorBox = function(errorType, freeze, errorDetails){"
        		+ "			origShowErrorBox(errorType, freeze, errorDetails);"
        		+ "		};"
        		+ "}()"
        		+ ");";

should have zero-effect, that is, should override the showErrorBox() method with itself unchanged.

Instead if I try this (just stopping the server and trying to continue to use the application) I see a different behaviour with or without executing this script: without executing a get a Network Error popup, while executing this I get no popup, just the application doesn't respond (which is normal since the server is stopped).
Shouldn't the behaviour be the same?
What am I missing?
Thank you
Vincenzo
Re: Occasional Network Error popup [message #1739043 is a reply to message #1739040] Wed, 27 July 2016 08:03 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2263
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Vincenzo,
here is a working Java function:
---
private static void patchClient() {
JavaScriptExecutor executor = RWT.getClient().getService(
JavaScriptExecutor.class );
StringBuilder builder = new StringBuilder();
builder.append( "(function() {" );
builder.append( " var errorHandler = rwt.runtime.ErrorHandler;" );
builder.append( " var origShowErrorBox = rwt.util.Functions.bind(
errorHandler.showErrorBox, errorHandler );" );
builder.append( " errorHandler.showErrorBox = function( errorType,
freeze, errorDetails ) {" );
builder.append( " if( errorType === \"connection error\" ) {" );
builder.append( " setTimeout( function() {");
builder.append( " rwt.remote.Connection.getInstance()._retry();" );
builder.append( " }, 100 );");
builder.append( " } else {");
builder.append( " origShowErrorBox( errorType, freeze,
errorDetails );");
builder.append( " }");
builder.append( " };" );
builder.append( "}() );" );
executor.execute( builder.toString() );
}
---
The "context" was not set when the original function is called.
HTH,
Ivan

On 7/27/2016 10:17, Vincenzo Caselli wrote:
> origShowErrorBox(errorType, freeze, errorDetails);

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Occasional Network Error popup [message #1739061 is a reply to message #1739043] Wed, 27 July 2016 09:24 Go to previous message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 190
Registered: January 2012
Senior Member
Wow, thanks Ivan!
I cannot still test it on customer scenario, but on my pc the test that I did before (stopping the server) are now working!!
Thank you very much again.
Vincenzo
Previous Topic:RAP Incubator Add-Ons - Chart, Creation new Types
Next Topic:Error creating a target platform
Goto Forum:
  


Current Time: Mon Feb 19 14:51:38 GMT 2018

Powered by FUDForum. Page generated in 0.02195 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software