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

Dev mode fails to reload classes when using reactive rest client with coroutines in Quarkus 2.0.0.CR2 #17597

Closed
andreas-eberle opened this issue Jun 1, 2021 · 3 comments · Fixed by #17601
Assignees
Milestone

Comments

@andreas-eberle
Copy link
Contributor

andreas-eberle commented Jun 1, 2021

Describe the bug

Please note 2: This looks like the same issue as #17359. The only difference is that we use coroutines and Quarkus 2.0.0.CR2 this time.

Adapted description from #17359

We are using resteasy reactive and the reactive rest client in Quarkus 2.0.0.CR2, gradle and Kotlin with coroutines. Everytime the quarkus dev mode reloads the code, Quarkus is broken and we have to restart it.

We were able to break it down to a small reproducer. The problem seems to appear, when we have a POST resource that receives a DTO in the body and passes this dto to a rest client call that receives a generified response (best take a look at the ReactiveResource:getClient() method in the reproducer). When the service is freshly started gradlew quarkusDev, it all works fine. However, as soon as you change something and quarkus recompiles the code on the next call, it is broken.

We added a logging of the received object and there we get the following error:

2021-05-19 15:52:52,547 ERROR [org.jbo.res.rea.com.cor.AbstractResteasyReactiveContext] (vert.x-eventloop-thread-10) Request failed: java.lang.ClassCastException: class org.acme.dto.ApiResponse cannot be cast to class org.acme.dto.ApiResponse (org.acme.dto.ApiResponse is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @df5f5c0; org.acme.dto.ApiResponse is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @1091b449)
	at org.acme.ReactiveResource$getClient$1.apply(ReactiveResource.kt:18)
	at io.smallrye.context.impl.wrappers.SlowContextualFunction.apply(SlowContextualFunction.java:21)
...

When we do not add the logging, the response from the resource is just empty.

Please note: In the reproducer, we use the rest client to call the same quarkus service again. This is just to make the reproducer self contained. We also experienced this when calling another service.

Expected behavior

Quarkus Dev Mode works and reloads the classes.

Actual behavior

The classes do not seem to be reloaded correctly.

To Reproduce

  1. Download reproducer and unzip
    2021-05-19-restclient-dev-mode (2).zip

  2. In the project run ./gradlew quarkusDev

  3. Call the endpoint with

curl --location --request POST 'localhost:8080/client' \
--header 'Content-Type: application/json' \
--data-raw '{
	"name" : "Bernd"
}'
  1. Change anything in the code to cause a recompile on the next call
  2. Call the service again and observe the error in the log.
@quarkus-bot
Copy link

quarkus-bot bot commented Jun 1, 2021

/cc @evanchooly, @michalszynkiewicz

@gsmet
Copy link
Member

gsmet commented Jun 1, 2021

@geoand this looks like a CL issue. Maybe you want to have a look?

@geoand
Copy link
Contributor

geoand commented Jun 1, 2021

Yup, I'm already looking into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants