IDEMPIERE-4625 Login Page refresh cause error message, randomly when slow db response (#525)
Fix CLOSE-WAIT issue (https://groups.google.com/g/idempiere/c/wppbB5jdByg/m/_VOzSZZyAQAJ)
This commit is contained in:
parent
fb8c045de9
commit
6c6cbf932d
|
@ -236,11 +236,18 @@ public class AtmosphereServerPush implements ServerPush {
|
|||
return;
|
||||
}
|
||||
|
||||
this.resource.set(null);
|
||||
AtmosphereResource currentResource = this.resource.getAndSet(null);
|
||||
synchronized (schedules) {
|
||||
schedules.clear();
|
||||
}
|
||||
|
||||
if (currentResource != null ) {
|
||||
try {
|
||||
currentResource.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
if (Executions.getCurrent() != null) {
|
||||
if (log.isDebugEnabled())
|
||||
log.debug("Stopping server push for " + desktop);
|
||||
|
@ -262,7 +269,14 @@ public class AtmosphereServerPush implements ServerPush {
|
|||
if (!resource.isSuspended()) {
|
||||
resource.suspend();
|
||||
}
|
||||
this.resource.set(resource);
|
||||
AtmosphereResource oldResource = this.resource.getAndSet(resource);
|
||||
if (oldResource != null) {
|
||||
try {
|
||||
if (!oldResource.isCancelled())
|
||||
oldResource.close();
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ import org.zkoss.zk.ui.sys.WebAppCtrl;
|
|||
public class ZkAtmosphereHandler implements AtmosphereHandler {
|
||||
|
||||
private static final String SESSION_NOT_FOUND = "SessionNotFound";
|
||||
private static final String DESKTOP_NOT_FOUND = "DesktopNotFound";
|
||||
private final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Override
|
||||
|
@ -58,14 +59,14 @@ public class ZkAtmosphereHandler implements AtmosphereHandler {
|
|||
if (log.isDebugEnabled())
|
||||
log.debug("Could not find desktop: " + dtid);
|
||||
}
|
||||
return new Either<String, Desktop>("Could not find desktop", desktop);
|
||||
return new Either<String, Desktop>(DESKTOP_NOT_FOUND, desktop);
|
||||
}
|
||||
return new Either<String, Desktop>("Webapp does not implement WebAppCtrl", null);
|
||||
}
|
||||
|
||||
private Either<String, String> getDesktopId(HttpServletRequest request) {
|
||||
String dtid = request.getParameter("dtid");
|
||||
return new Either<String, String>(dtid, "Could not find desktop id");
|
||||
return new Either<String, String>(dtid, DESKTOP_NOT_FOUND);
|
||||
}
|
||||
|
||||
private Either<String, AtmosphereServerPush> getServerPush(AtmosphereResource resource) {
|
||||
|
|
|
@ -45,7 +45,7 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI).
|
|||
</component>
|
||||
|
||||
<javascript-module name="org.idempiere.websocket" version="202011211500"/>
|
||||
<javascript-module name="jawwa.atmosphere" version="202011170510"/>
|
||||
<javascript-module name="jawwa.atmosphere" version="202101150800"/>
|
||||
<javascript-module name="adempiere.local.storage" version="202011151100"/>
|
||||
<javascript-moudle name="html2canvas" version="1.0.0.rc7"/>
|
||||
<javascript-module name="org.idempiere.commons" version="202012030330"/>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
var me = this;
|
||||
this.ajaxOptions.error = function(jqxhr, textStatus, errorThrown) {
|
||||
if (me.trace)
|
||||
console.log("error: " + textStatus + " dtid: " + me.desktop.id);
|
||||
console.log("error: " + textStatus + " dtid: " + me.desktop.id + " errorThrown: " + errorThrown);
|
||||
if (textStatus != "timeout" && textStatus != "abort" && errorThrown != "SessionNotFound") {
|
||||
if (typeof console == "object") {
|
||||
console.error(textStatus);
|
||||
|
@ -56,9 +56,12 @@
|
|||
me.failures = 0;
|
||||
};
|
||||
this.ajaxOptions.complete = function() {
|
||||
if (me.trace)
|
||||
if (me.trace) {
|
||||
console.log("complete"+ " dtid: " + me.desktop.id);
|
||||
if (me._req && me._req.statusText == "SessionNotFound" && me._req.status == 400) {
|
||||
if (me._req)
|
||||
console.log(me._req.status + " " + me._req.statusText);
|
||||
}
|
||||
if (me._req && (me._req.statusText == "SessionNotFound" || me._req.statusText == "DesktopNotFound") && me._req.status == 400) {
|
||||
;
|
||||
} else {
|
||||
me._schedule();
|
||||
|
|
Loading…
Reference in New Issue