Continuous page reload while debugging using hotswap

Hi,

When I’m using hotswap on my project I get continuous page reloads and I don’t understand why. The moment I log in it starts.

You can see how my network console looks like while not doing anything on a page with just a grid and a couple of rows.

When I set a breakpoint in an onAttach method for example, I see that it continuously arrives there.

I’m using 21.0.5 jbr (installed by sdkman) and Vaadin 24.5.2. I followed the instructions on the vaadin documentation to enable live reload in Intellij. The JBR already has the hotswap-agent shipped with it, and I’ve set the additional flags en enable it in the Run configuration.

The page reloading doesn’t happen when I do a regular debug without Hotswap

Any ideas what could be happening here?

Kind regards!
Kristof

1 Like

Which version of Hotswap agent is shipped with the JDK?
The problem may relate to this agent issue that has been fixed in 2.0.1

Hmmm,

The logs state that that is the version it’s using

HOTSWAP AGENT: 23:48:23.625 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {2.0.1} - unlimited runtime class redefinition.

You can try to set logs at debug level for both Flow Hotswapper ( category com.vaadin.flow.hotswap) and the Hotswap agent Vaadin plugin ( LOGGER.org.hotswap.agent.plugin.vaadin=DEBUG in hotswap-agent.properties) to see what is causing the reload.
Another option is to put a breakpoint in com.vaadin.flow.hotswap.Hotswapper.onHotswapInternal() where triggerClientUpdate is called and check what’s in the classes HashSet.

Thank you Marco,

I get two breakpoint hits:

  • class com.oriumfit.web.ui.manager.UserOverview$SpringCGLIB$633
  • class com.oriumfit.web.ui.ManagerPage$SpringCGLIB$637

I see the same in the logs

HOTSWAP AGENT: 09:46:29.364 DEBUG (org.hotswap.agent.plugin.vaadin.VaadinPlugin) - Reloading class com.oriumfit.web.ui.ManagerPage$$SpringCGLIB$$305 because of DEFINE
HOTSWAP AGENT: 09:46:29.364 DEBUG (org.hotswap.agent.plugin.vaadin.VaadinPlugin) - Reloading class com.oriumfit.web.ui.ManagerPage$$SpringCGLIB$$305 because of DEFINE
HOTSWAP AGENT: 09:46:29.395 DEBUG (org.hotswap.agent.plugin.vaadin.VaadinPlugin) - Reloading class com.oriumfit.web.ui.manager.UserOverview$$SpringCGLIB$$305 because of DEFINE
HOTSWAP AGENT: 09:46:29.396 DEBUG (org.hotswap.agent.plugin.vaadin.VaadinPlugin) - Reloading class com.oriumfit.web.ui.manager.UserOverview$$SpringCGLIB$$305 because of DEFINE
HOTSWAP AGENT: 09:46:29.911 DEBUG (org.hotswap.agent.plugin.vaadin.VaadinPlugin) - Reloading class com.oriumfit.web.ui.ManagerPage$$SpringCGLIB$$306 because of DEFINE
HOTSWAP AGENT: 09:46:29.912 DEBUG (org.hotswap.agent.plugin.vaadin.VaadinPlugin) - Reloading class com.oriumfit.web.ui.ManagerPage$$SpringCGLIB$$306 because of DEFINE

When I click around in the app, this basically changes to whatever page I’m on, and it’s parent.

I don’t see anything that refers to why it’s happening though :/

Kind regards,
Kristof

It seems like Spring is constantly creating and loading new proxy classes for those views.
It could be that fix: trigger refresh on hotswap only for redefined classes by mcollovati · Pull Request #20684 · vaadin/flow · GitHub fixes this issues.
Do you mind upgrading to Vaadin 24.5.9?

1 Like

That indeed fixed it!

Thank you Marco! :-)

1 Like