Reputation: 4000
I'm running a GWT application using GWT 2.5.1 and Ext GWT v2.2.4 on Eclipse Juno. Java 6 (32 bit) and I can't change any of this.
I was recently handed over this application which is working fine on another machine. After starting the application (Run > GWT Application), I proceed with logging into my application, my code executes normally but then my app freezes. I debugged and found that the applications enters an infinite loop in this GWT internal method (i.e. in class com.google.gwt.dev.shell.BrowserChannelServer
):
public void reactToMessages(SessionHandlerServer handler) {
do {
try {
getStreamToOtherSide().flush();
MessageType messageType = Message.readMessageType(
getStreamFromOtherSide());
switch (messageType) {
case FREE_VALUE:
final FreeMessage freeMsg = FreeMessage.receive(this);
handler.freeValue(this, freeMsg.getIds());
break;
case INVOKE: //<<<< Keeps getting into this block
InvokeOnServerMessage imsg = InvokeOnServerMessage.receive(this);
ExceptionOrReturnValue result = handler.invoke(this, imsg.getThis(),
imsg.getMethodDispatchId(), imsg.getArgs());
sendFreedValues();
ReturnMessage.send(this, result);
break;
case INVOKE_SPECIAL:
handleInvokeSpecial(handler);
break;
case QUIT:
return;
default:
throw new RemoteDeathError(new BrowserChannelException(
"Invalid message type " + messageType));
}
} catch (IOException e) {
throw new RemoteDeathError(e);
} catch (BrowserChannelException e) {
throw new RemoteDeathError(e);
}
} while (true);
}
messageType
is always INVOKE and since the while condition is true, the loop never ends. So the execution is stuck at this stack:
Daemon Thread [Code server for av.mymodule from Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0 on http://127.0.0.1:8889/mymodule.html?gwt.codesvr=127.0.0.1:9997 @ tsb2t8vtLUT/vrj#] (Suspended)
BrowserChannelServer.reactToMessages(BrowserChannelServer$SessionHandlerServer) line: 292
BrowserChannelServer.processConnection() line: 547
BrowserChannelServer.run() line: 364
Thread.run() line: 662
I cleaned the project, deleted cache files, tmp files, recompiled numerous times, tried older version 2.4.0, but I can't try 2.6 because I'll need java 7 which I can't install at the moment. I tried chrome and firefox, same results. After some search I found some suggestions that I should not zoom in using the browser, however, and I'm not doing that.
What could be the problem please ?
Upvotes: 0
Views: 636
Reputation: 4000
The problem was that Ext GWT 2.2.4 isn't compatible with GWT 2.5.1, but it's compatible with GWT 2.5.0
So using GWT 2.5.0 instead, solved the problem.
Upvotes: 1
Reputation: 8548
I think your while condition should be dynamic variable instead of using true. You should break out of do while loop. If not , your execution may stack.
public class TestDoWhile {
private static TestDoWhile test;
public static void main(final String[] args) {
test = new TestDoWhile();
test.invokeMethod(2);
test.invokeMethod(1);
}
public final void invokeMethod(final int testCase) {
do {
switch (testCase) {
case 1:
System.out.println("Invoke");
break;
case 2:
System.out.println("Please , let me quit !");
return;
default:
return;
}
} while (true);
}
}
What is result of my java program ? That may stack. And I can't imagine your these two methods sendFreedValues(); ReturnMessage.send(this, result);
So, Add return instead of break . Have some useful for you.
Upvotes: 0