Closed Artur- closed 1 week ago
With trace logging enabled for HA, I see
HOTSWAP AGENT: 10:37:05.105 DEBUG (org.hotswap.agent.command.impl.SchedulerImpl) - Executing Command{class='com.vaadin.flow.hotswap.Hotswapper', methodName='onHotswap'}
HOTSWAP AGENT: 10:37:05.105 TRACE (org.hotswap.agent.command.impl.CommandExecutor) - Executing command Command{class='com.vaadin.flow.hotswap.Hotswapper', methodName='onHotswap'}
HOTSWAP AGENT: 10:37:05.106 TRACE (org.hotswap.agent.command.ReflectionCommand) - Executing command: requestedClassLoader=jdk.internal.loader.ClassLoaders$AppClassLoader@27ddd392, resolvedClassLoader=jdk.internal.loader.ClassLoaders$AppClassLoader@27ddd392, class=class com.vaadin.flow.hotswap.Hotswapper, method=onHotswap, params=[[Ljava.lang.String;@669856bd, false]
Hotswapping[com.vaadin.flow.component.dependency.StyleSheet]
HOTSWAP AGENT: 10:37:05.208 DEBUG (org.hotswap.agent.command.impl.SchedulerImpl) - Executing Command{class='com.vaadin.flow.hotswap.Hotswapper', methodName='onHotswap'}
HOTSWAP AGENT: 10:37:05.208 TRACE (org.hotswap.agent.command.impl.CommandExecutor) - Executing command Command{class='com.vaadin.flow.hotswap.Hotswapper', methodName='onHotswap'}
HOTSWAP AGENT: 10:37:05.208 TRACE (org.hotswap.agent.command.ReflectionCommand) - Executing command: requestedClassLoader=jdk.internal.loader.ClassLoaders$AppClassLoader@27ddd392, resolvedClassLoader=jdk.internal.loader.ClassLoaders$AppClassLoader@27ddd392, class=class com.vaadin.flow.hotswap.Hotswapper, method=onHotswap, params=[[Ljava.lang.String;@669856bd, false]
Hotswapping[com.vaadin.flow.component.dependency.StyleSheet]
HOTSWAP AGENT: 10:37:05.313 DEBUG (org.hotswap.agent.command.impl.SchedulerImpl) - Executing Command{class='com.vaadin.flow.hotswap.Hotswapper', methodName='onHotswap'}
HOTSWAP AGENT: 10:37:05.313 TRACE (org.hotswap.agent.command.impl.CommandExecutor) - Executing command Command{class='com.vaadin.flow.hotswap.Hotswapper', methodName='onHotswap'}
HOTSWAP AGENT: 10:37:05.313 TRACE (org.hotswap.agent.command.ReflectionCommand) - Executing command: requestedClassLoader=jdk.internal.loader.ClassLoaders$AppClassLoader@27ddd392, resolvedClassLoader=jdk.internal.loader.ClassLoaders$AppClassLoader@27ddd392, class=class com.vaadin.flow.hotswap.Hotswapper, method=onHotswap, params=[[Ljava.lang.String;@669856bd, false]
Hotswapping[com.vaadin.flow.component.dependency.StyleSheet]
Could you check please from which method SchedulerImpl.scheduleCommand()
is called?
But the Reloading class {} because of {}"
is not constantly logged, so it would seem that scheduleCommand
is only called once
There are a lot of commands "running"
and in SchedulerImpl.finished() some gets removed from runningCommands
but then when onHotswap
is called again, scheduledCommands
contain the same commands (in this case it is two, apparently it can also be one) and the ones in runningCommands
also seem to remain
LoadEvent.DEFINE
as redefine event in Vaadin Hotswapper?:@OnClassLoadEvent(classNameRegexp = ".*", events = {LoadEvent.DEFINE, LoadEvent.REDEFINE})
it.remove();
in SchedulerImpl
The problem is that it.remove()
does not remove the command. Also when debugging I can see that after
for (Iterator<Map.Entry<Command, DuplicateScheduleConfig>> it = scheduledCommands.entrySet().iterator(); it.hasNext(); ) {
Map.Entry<Command, DuplicateScheduleConfig> entry = it.next();
then
scheduledCommands.containsKey(entry.getKey())
is false
, or in other words scheduledCommands.containsKey(scheduledCommands.entrySet().iterator().next().getKey())
is false. This seems like the hash code of ReflectionCommand
could change after adding the command to the map or something similar
It can, because ReflectionCommand.getTargetClassLoader()
modifies the targetClassLoader
field when it is null
, and after that, the hash code no longer matches
It looks like a bug. I suggest making all attributes in the ReflectionCommand class final and initializing them in the constructor.
A new fixed version is available at:
https://github.com/HotswapProjects/HotswapAgent/releases/tag/2.0.1-SNAPSHOT
Could you please check if it resolves your issue?
Thanks! I think it resolves the issue but as it is a timing issue, I cannot say for sure
Haven't seen it again so far
Problem is fixed in version 2.0.1 , is is released on maven https://mvnrepository.com/artifact/org.hotswapagent
When using the Vaadin plugin in 2.0.0, I every now and then see an infinite stream of hotswapping events for the same class being sent to
Hotswapper.onHotswap
. Today it looks likeand it continues forever. Would this be a problem in the Vaadin plugin, HotswapAgent or JBR?
The stack trace in IntelliJ does not really tell that much