HotswapProjects / HotswapAgent

Java unlimited redefinition of classes at runtime.
GNU General Public License v2.0
2.32k stars 491 forks source link

Eclipse: Timeout occurred while waiting for packet ... #297

Open cristian-spiescu opened 5 years ago

cristian-spiescu commented 5 years ago

A part of the files of my application are generated. E.g. a lot of boiler plate interfaces and similar. This generation happens when I invoke a custom Maven plugin. Each time I run it, the Maven plugin outputs something between 60 files (for a simple project) and 700 files (for a big project).

HotswapAgent doesn't seem to have an issue with this. I.e. after regenerating the files, I see it successfully brings my new code into the JVM. However, after a couple of seconds Eclipse brings up the Hot Code Replace Failed popup, with detail: Timeout occurred while waiting for packet ....

My intuition tells me that because a lot of files changed (although the content is practically the same), the JVM (through HotswapAgent) occupies the thread and Eclipse temporarily looses the connection with the JVM (debugger).

NOTE: I saw this error message mentioned in #177 . However, there, the hotcode swap seemed not to work at all.

Have you got any ideas around this? Thanks in advance!

cristian-spiescu commented 5 years ago

An UPDATE that makes me think the suspected cause (cf. above) is not correct. The issue happens when Eclipse becomes aware that the generated files (e.g. the 60 modified files) were changed on disk. With an Eclipse workspace with "auto refresh = true", this happens automatically, a couple of seconds after I run my plugin. With the default setting, i.e. "auto refresh = false", this happens if I perform right click + refresh on the folder containing generated files.

FloFlo93 commented 3 years ago

I had the same problem and solved it by adding disabledPlugins=ClassInitPlugin to my hotswap-agent.properties File.

skybber commented 3 years ago

ClassInit plugin iterates through static fields and initializes only fields that are new in modified class, otherwise dcevm let them unitialized. It seems strange, it looks like you have some "expensive" static field initializer. Could you try modify ClassInitPlugin log level in hotswap-agent.properties by appending following line:

LOGGER.org.hotswap.agent.plugin.ClassInitPlugin=debug

you should see following messages:

https://github.com/HotswapProjects/HotswapAgent/blob/master/hotswap-agent-core/src/main/java/org/hotswap/agent/plugin/jvm/ClassInitPlugin.java#L93