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 #17359

Closed
andreas-eberle opened this issue May 19, 2021 · 8 comments · Fixed by #17366
Closed

Dev mode fails to reload classes when using reactive rest client #17359

andreas-eberle opened this issue May 19, 2021 · 8 comments · Fixed by #17366

Comments

@andreas-eberle
Copy link
Contributor

Describe the bug

We are using resteasy reactive and the reactive rest client in Quarkus 1.13.4.Final, gradle and Kotlin. 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 Mo

Actual behavior

The classes do not seem to be reloaded correctly.

To Reproduce

  1. Download reproducer and unzip 2021-05-19-restclient-dev-mode.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.
@andreas-eberle andreas-eberle added the kind/bug Something isn't working label May 19, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented May 19, 2021

/cc @evanchooly, @michalszynkiewicz

@geoand
Copy link
Contributor

geoand commented May 19, 2021

What versions have you tried? 1.13.4.Final, 2.0.0.Alpha2, main?

@andreas-eberle
Copy link
Contributor Author

Only 1.13.4.Final so far.

@geoand
Copy link
Contributor

geoand commented May 19, 2021

I just tried Quarkus from main and the problem still exists.

I'll take a look soon

@andreas-eberle
Copy link
Contributor Author

Thanks @geoand!

geoand added a commit to geoand/quarkus that referenced this issue May 19, 2021
@geoand geoand self-assigned this May 19, 2021
stuartwdouglas added a commit that referenced this issue May 19, 2021
Fix case of lost TCCL in dev-mode when RESTEasy Reactive reads the HTTP body
@quarkus-bot quarkus-bot bot added this to the 2.0 - main milestone May 19, 2021
@gsmet gsmet modified the milestones: 2.0 - main, 1.13.5.Final May 20, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue May 20, 2021
@andreas-eberle
Copy link
Contributor Author

Hi @geoand ,

it looks like the same issue happens with Quarkus 2.0.0.CR2 when you use coroutines. Can you have a look? I updated my reproducer project: 2021-05-19-restclient-dev-mode (2).zip

Many thanks!

@geoand
Copy link
Contributor

geoand commented Jun 1, 2021

Can you open a new issue please?

@andreas-eberle
Copy link
Contributor Author

Sure

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