Closed nigelpatsmith closed 10 years ago
I'm kinda surprised you aren't seeing side effects of this.
Would you be able to provide a reproducible sample? I don't quite know what's going on.
Hi Luke
Not sure if I'll be able to create a reproducible sample. I'm not sure which part of our grails app is causing the issue, so I'm not sure which part to send you, and I can't send you the whole app. If you can point me in the direction of what might be causing the issue, I might be able to have a dig around myself.
I can think of two things that we might be able to do:
If you have any other suggestions, I'm open to ideas.
Here is the snippet:
class TimeMachine {
def remote
TimeMachine(String machineIP, String port) {
def transport = new HttpTransport("http://" + machineIP + ":" + port + "/grails-remote-control")
remote = new RemoteControl(transport)
}
public void setOffsetSeconds(long seconds) {
remote.exec { DateTimeUtils.setCurrentMillisOffset(seconds * 1000) }
}
public long getCurrentSeconds() {
return remote.exec { new DateTime().millis / 1000 }
}
public void reset() {
remote.exec { DateTimeUtils.setCurrentMillisSystem() }
}
}
We're calling this code from Ruby, using rjb. As you can see, we're only using it to manipulate time within our app (for anything that is coupled to joda time, which our app is)
Cheers, Nigel
On 26/01/2013, at 8:06 PM, Luke Daley notifications@github.com wrote:
I'm kinda surprised you aren't seeing side effects of this.
Would you be able to provide a reproducible sample? I don't quite know what's going on.
— Reply to this email directly or view it on GitHub.
Hi Luke,
I don't know if you ever got to the bottom of this, but I have been seeing the same thing for months. Every time a remote endpoint is hit, I get:
| Error 2013-09-19 17:18:55,534 [http-bio-8080-exec-6] ERROR agent.SpringLoadedPreProcessor - Unexpected problem transforming call sites
Message: null
Line | Method
->> 109 |
| 792 | defineClass in java.lang.ClassLoader | 635 | defineClass . . . in '' | 73 | defineClass in groovyx.remote.server.CommandInvoker | 57 | instantiate . . . in '' | 37 | invokeAgainst in '' | 129 | invokeCommandChain in groovyx.remote.server.Receiver | 125 | execute in '' | 74 | doExecute . . . . in groovyx.remote.transport.http.RemoteControlServlet | 30 | doExecute in grails.plugin.remotecontrol.RemoteControlServlet | 39 | doPost . . . . . . in groovyx.remote.transport.http.RemoteControlServlet | 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor | 615 | run . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker ^ 724 | run in java.lang.Thread
As you can imagine, it makes trying to look at log output whilst running tests fairly pointless, as this is almost a constant scroll.
Did you ever discover the cause?
I think I am seeing the same problem, when I run functional tests against a separate run-app. The cause looks like a bug in spring-loaded (v1.1.3 in Grails 2.2.4):
The bug is that SpringLoadedPreProcessor.needsClientSideRewriting() is true for a null class name, so that class calls typeRegistry.methodCallRewriteUseCacheIfAvailable() with a null class name, but the cachekey does not handle null class names.
2013-09-26 12:25:29,657 [http-bio-8080-exec-4] ERROR StackTrace - Full Stack Trace:
java.lang.NullPointerException
at java.lang.StringBuilder.
Unfortunately, the problem being in an agent, I suppose I cannot just override it with a patch from my Grails app.
Thanks for the investigation. I've asked the Spring Loaded guys to fix this.
Thanks, Luke! I think the key to reproducing this is to run-app as dev, to get reloading, and then run functional tests with remote-control against that.
I am trying the following work-around, but not sure if it is a good solution:
--- a/org.springsource.loaded/src/main/java/org/springsource/loaded/agent/SpringLoadedPreProcessor.java
+++ b/org.springsource.loaded/src/main/java/org/springsource/loaded/agent/SpringLoadedPreProcessor.java
@@ -103,6 +103,9 @@ public class SpringLoadedPreProcessor implements Constants {
if (disabled) {
return bytes;
}
+ if (slashedClassName == null) {
+ slashedClassName = "null" + Utils.calculateSHA256(bytes);
+ }
// System.err.println("> SpringLoadedPreProcessor.preProcess(classLoader=" + classLoader + ",slashedClassName=
// + slashedClassName + ",...)");
(I think I found Utils.calculateSHA256() on stackoverflow.com.)
Thanks.
The issue I raised is here: https://github.com/spring-projects/spring-loaded/issues/24
This will be fixed in Grails 2.4.
I'm seeing a NullPointerException whenever I make an exec() call. As far as I can tell, the calls are successful. However, I'm guessing that the error means something, not that I have seen any immediate side effects.
I'm using a custom grails environment (ie not "test"), have set remoteControl.enabled = true, and basically everything seems to be working.
The stack trace is: [http-nio-8080-exec-3] ERROR agent.SpringLoadedPreProcessor - Unexpected problem transforming call sites java.lang.NullPointerException at java.lang.ClassLoader.defineClass(ClassLoader.java:791) at java.lang.ClassLoader.defineClass(ClassLoader.java:634) at groovyx.remote.server.CommandInvoker.defineClass(CommandInvoker.groovy:73) at groovyx.remote.server.CommandInvoker.instantiate(CommandInvoker.groovy:57) at groovyx.remote.server.CommandInvoker.invokeAgainst(CommandInvoker.groovy:37) at groovyx.remote.server.CommandChainInvoker.invokeAgainst(CommandChainInvoker.groovy:37) at groovyx.remote.server.Receiver.invokeCommandChain(Receiver.groovy:129) at groovyx.remote.server.Receiver.execute(Receiver.groovy:125) at groovyx.remote.transport.http.RemoteControlServlet.doExecute(RemoteControlServlet.groovy:74) at grails.plugin.remotecontrol.RemoteControlServlet.doExecute(RemoteControlServlet.groovy:30) at groovyx.remote.transport.http.RemoteControlServlet.doPost(RemoteControlServlet.groovy:39) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722)