Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot reload : Failed to start quarkus, Already a default codec registered for class class java.util.UUID #10928

Closed
rmanibus opened this issue Jul 23, 2020 · 14 comments · Fixed by #10935
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@rmanibus
Copy link
Contributor

Describe the bug
(Describe the problem clearly and concisely.)
Whenever the hot reload is triggered, it fails to restart the app after upgrade to Quarkus 1.6.1
Expected behavior
The application is reloaded when the code is updated
Actual behavior

java.lang.RuntimeException: java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.dev.appstate.ApplicationStateNotification.waitForApplicationStart(ApplicationStateNotification.java:51)
	at io.quarkus.runner.bootstrap.StartupActionImpl.runMainClass(StartupActionImpl.java:156)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.restartApp(IsolatedDevModeMain.java:139)
	at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:173)
	at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$1.handle(VertxHttpHotReplacementSetup.java:55)
	at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$1.handle(VertxHttpHotReplacementSetup.java:45)
	at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:313)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:715)
	at io.quarkus.runtime.Application.start(Application.java:90)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:91)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:61)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:30)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at io.quarkus.runner.bootstrap.StartupActionImpl$3.run(StartupActionImpl.java:145)
	... 1 more
Caused by: java.lang.IllegalStateException: Already a default codec registered for class class java.util.UUID
	at io.vertx.core.eventbus.impl.CodecManager.registerDefaultCodec(CodecManager.java:132)
	at io.vertx.core.eventbus.impl.EventBusImpl.registerDefaultCodec(EventBusImpl.java:195)
	at io.quarkus.vertx.runtime.VertxRecorder.registerCodecs(VertxRecorder.java:153)
	at io.quarkus.vertx.runtime.VertxRecorder.configureVertx(VertxRecorder.java:40)
	at io.quarkus.deployment.steps.VertxProcessor$build-626852132.deploy_0(VertxProcessor$build-626852132.zig:183)
	at io.quarkus.deployment.steps.VertxProcessor$build-626852132.deploy(VertxProcessor$build-626852132.zig:36)
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:558)
	... 11 more
@rmanibus rmanibus added the kind/bug Something isn't working label Jul 23, 2020
@geoand
Copy link
Contributor

geoand commented Jul 23, 2020

Thanks for reporting,

Two things:

  • I gather that this worked in a previous version of Quarkus, right?
  • Do you have a sample application we could use to reproduce the problem?

@rmanibus
Copy link
Contributor Author

Yes this was working with 1.6.0 and before.

I guess it's linked to my Panache Entities which use UUID.

all my entities are extending the following:

import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.util.UUID;

@Getter
@MappedSuperclass
@EqualsAndHashCode(of = {"id"}, callSuper = false)
abstract public class BaseUUIDEntity extends PanacheEntityBase {

    @Id
    @GeneratedValue(generator = "UUID")
    @GenericGenerator(
            name = "UUID",
            strategy = "org.hibernate.id.UUIDGenerator",
            parameters = {
                    @Parameter(
                            name = "uuid_gen_strategy_class",
                            value = "org.hibernate.id.uuid.CustomVersionOneStrategy"
                    )
            }
    )
    public UUID id;

}

I will try to produce a reproducer

@rmanibus
Copy link
Contributor Author

rmanibus commented Jul 23, 2020

In fact it's because of an event consummer.

the code producing the bug is:

    @ConsumeEvent(value = "event", blocking = true)
    @Transactional
    public void doSomething(UUID commentId) throws InterruptedException {
        [...]
    }

@rmanibus
Copy link
Contributor Author

reproducer is here:
https://github.com/rmanibus/reproducer

@rmanibus
Copy link
Contributor Author

just try to add some dummy code and call the rest endpoint again, the hot reload will fail.

@geoand
Copy link
Contributor

geoand commented Jul 23, 2020

Thanks a lot @rmanibus

@geoand
Copy link
Contributor

geoand commented Jul 23, 2020

@stuartwdouglas @cescoffier this seems to happen because CodecManager is not reloaded (as opposed to what happened in 1.6.0.Final). Looking at the commits, I can't really tell which one caused this.

Do you mind taking a look?

@cescoffier
Copy link
Member

That's a side effect of the "fix" of Vert.x reload. We are keeping the same instance around as without we ended up with multiple vert.x instances and context issues.

@geoand
Copy link
Contributor

geoand commented Jul 23, 2020

So should we then be clearing out the codecs on reload?

@geoand
Copy link
Contributor

geoand commented Jul 23, 2020

That's a side effect of the "fix" of Vert.x reload. We are keeping the same instance around as without we ended up with multiple vert.x instances and context issues.

BTW, which commit brough that in?

geoand added a commit to geoand/quarkus that referenced this issue Jul 23, 2020
This is now needed because of Vert.x is no longer reloaded

Fixes: quarkusio#10928
@geoand geoand self-assigned this Jul 23, 2020
@geoand
Copy link
Contributor

geoand commented Jul 23, 2020

#10935 should take care of this

@sebthom
Copy link
Contributor

sebthom commented Jul 23, 2020

Experiencing the same issue. In my case the message is Hot reload : Failed to start quarkus, Already a default codec registered for class class java.lang.Object

@devnet-io
Copy link

Could I ask when this fix will be applied? The issue is still present in 2.2.2.

@gastaldi
Copy link
Contributor

gastaldi commented Sep 9, 2021

@devnet-io can you open a new issue with a reproducer? This is applied since 1.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants