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

Register resource classes for reflection when ContainerResponseFilter exists #42754

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

geoand
Copy link
Contributor

@geoand geoand commented Aug 26, 2024

This is needed because those filters can call
setEntityStream which then forces the use of the
slow path for calling writers

@quarkus-bot

This comment has been minimized.

Copy link
Member

@FroMage FroMage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure your comment is accurate, the original issue is not about setEntityStream but obtaining annotations on the filtered resource/method.

Also, the original issue uses ContainerRequestFilter which must go through reflection to obtain annotations, while our docs advise @ServerRequestFilter which can probably obtain method annotations without registering the entire class for reflection (to be checked). So, is this new test taking this into account and only adding reflection for ContainerRequestFilter and not @ServerRequestFilter?

Or are they equally broken ATM?

Last, adding a test would probably save us a future headache :)

@quarkus-bot

This comment has been minimized.

@geoand
Copy link
Contributor Author

geoand commented Aug 27, 2024

the original issue is not about setEntityStream but obtaining annotations on the filtered resource/method.

Yes and no. It's correct as the condition under which the error happens only occurs when ContainerResponseFilter#setEntityStream is used.

Also, the original issue uses ContainerRequestFilter

Both the title and the reproducer use ContainerResponseFilter.

Last, adding a test would probably save us a future headache :)

Sure, I'll add one.

… exists

This is needed because those filters can call
setEntityStream which then forces the use of the
slow path for calling writers

Closes: quarkusio#42537
@geoand
Copy link
Contributor Author

geoand commented Aug 27, 2024

PR updated with a test

@FroMage
Copy link
Member

FroMage commented Aug 27, 2024

Both the title and the reproducer use ContainerResponseFilter.

My question was badly formulated, but I meant to ask whether @ServerRequestFilter also required reflection?

@quarkus-bot
Copy link

quarkus-bot bot commented Aug 27, 2024

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 2a050f7.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.


Flaky tests - Develocity

⚙️ JVM Tests - JDK 17

📦 extensions/infinispan-cache/deployment

io.quarkus.cache.infinispan.InfinispanCacheTest.testGetAsyncWithParallelCalls - History

  • expected: "thread1" but was: "thread2" - org.opentest4j.AssertionFailedError
org.opentest4j.AssertionFailedError: 

expected: "thread1"
 but was: "thread2"
	at io.quarkus.cache.infinispan.InfinispanCacheTest.testGetAsyncWithParallelCalls(InfinispanCacheTest.java:283)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at io.quarkus.test.QuarkusUnitTest.runExtensionMethod(QuarkusUnitTest.java:499)
	at io.quarkus.test.QuarkusUnitTest.interceptTestMethod(QuarkusUnitTest.java:413)

⚙️ Native Tests - HTTP

📦 integration-tests/rest-client-reactive

io.quarkus.it.rest.client.BasicTestIT.shouldCreateClientSpans - History

  • expected: <1> but was: <2> - org.opentest4j.AssertionFailedError
org.opentest4j.AssertionFailedError: expected: <1> but was: <2>
	at io.quarkus.it.rest.client.BasicTest.shouldCreateClientSpans(BasicTest.java:216)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptTestMethod(QuarkusTestExtension.java:821)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

@FroMage
Copy link
Member

FroMage commented Aug 27, 2024

Yes and no. It's correct as the condition under which the error happens only occurs when ContainerResponseFilter#setEntityStream is used.

Oh, OK, I thought it was only due to using Method to obtain the annotations.

@geoand
Copy link
Contributor Author

geoand commented Aug 27, 2024

👍🏽

@geoand geoand merged commit e81202b into quarkusio:main Aug 27, 2024
46 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.16 - main milestone Aug 27, 2024
@geoand geoand deleted the #42537 branch August 27, 2024 10:05
@gsmet gsmet modified the milestones: 3.16 - main, 3.14.1 Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

REST usage fails with native when e.g. ContainerResponseFilter is used
3 participants