Home » Eclipse Projects » Remote Application Platform (RAP) » Occasional Network Error popup
Occasional Network Error popup [message #1738470] |
Wed, 20 July 2016 07:17 |
|
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 #1738610 is a reply to message #1738586] |
Thu, 21 July 2016 11:49 |
|
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 #1738655 is a reply to message #1738615] |
Thu, 21 July 2016 18:32 |
|
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 #1738689 is a reply to message #1738671] |
Fri, 22 July 2016 09:20 |
|
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
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 |
Ivan Furnadjiev Messages: 2427 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 |
|
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 |
|
No way ,
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 #1739040 is a reply to message #1739007] |
Wed, 27 July 2016 07:17 |
|
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 |
Ivan Furnadjiev Messages: 2427 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/
|
|
| |
Goto Forum:
Current Time: Tue Sep 24 15:25:06 GMT 2024
Powered by FUDForum. Page generated in 0.05537 seconds
|