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

Jackson should use HybridJacksonPool #39739

Merged
merged 1 commit into from
Mar 28, 2024
Merged

Conversation

franz1981
Copy link
Contributor

@franz1981 franz1981 commented Mar 27, 2024

@quarkus-bot quarkus-bot bot added the area/jackson Issues related to Jackson (JSON library) label Mar 27, 2024
@franz1981
Copy link
Contributor Author

@mariofusco the problem here seems related https://github.com/FasterXML/jackson-core/blob/b8a132eefe3ccdcccfe4af444c1c3d237211fd1b/src/main/java/com/fasterxml/jackson/core/util/JsonRecyclerPools.java#L29 which create a whole new pool, meaning that the condition to verify if the user have configured the default "type" is always false given that the instances won't matches.

@geoand wdyt?

@geoand
Copy link
Contributor

geoand commented Mar 27, 2024

Seems reasonable to me

@franz1981
Copy link
Contributor Author

franz1981 commented Mar 27, 2024

Copy link
Contributor

@mariofusco mariofusco left a comment

Choose a reason for hiding this comment

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

That's ok for me as a temporary workaround, but in reality the problem should be fixed in jackson-core that when returning the defaultPool() should actually return the shared one instead of creating a new pool each and every time.

I will send a pull request to jackson-core to fix this problem, but when the change will be included in a stable release, and we will upgrade to it, I believe we should also revert this fix otherwise if jackson will decide to change the default pool with a different implementation we will break our integration again.

@franz1981
Copy link
Contributor Author

franz1981 commented Mar 27, 2024

in reality the problem should be fixed in jackson-core that when returning the defaultPool() should actually return the shared one instead of creating a new pool each and every time.

Agree, although, if users set a different instance of still that specific pool I would feel safer by NOT using it, given that is dangerous even for the non virtual thread use case ie after 3 attempts to compare and set a recycler, it will create a whole new one (!), which is not what we want regardless.
Related this specific point I believe jackson should not use that pool as default and/or having an infinite loop-like there, instead.

@mariofusco
Copy link
Contributor

As anticipated I sent this pull request to jackson that should fix the problem.

@franz1981
Copy link
Contributor Author

franz1981 commented Mar 27, 2024

after speaking with @mariofusco I agree on the fact that we cannot save users which want to shoot themselves in the foot ie this PR is just a workaround, which prevent users which use the "wrong" pool type to do it, so, in theory it would be better to wait for the actual fix or merge this in meantime, depending by the time required by jackson to keep up (and us to use it). @geoand

@geoand
Copy link
Contributor

geoand commented Mar 27, 2024

👌

This comment has been minimized.

@mariofusco
Copy link
Contributor

@geoand it seems that Jackson's maintainers don't agree with the change I proposed to avoid creating a new pool at each and every incocation of the defaultPool() method, so we necessarily need to merge this PR asap. \cc @franz1981

@geoand
Copy link
Contributor

geoand commented Mar 28, 2024

Understood, thanks

@geoand
Copy link
Contributor

geoand commented Mar 28, 2024

Mind rebasing onto main please?

@franz1981
Copy link
Contributor Author

franz1981 commented Mar 28, 2024

@geoand @gsmet I don't remember this by heart, but if the existing code path is taken regardless the JDK version in use or if we use RunOnVirtualThread, it means it is impactful for our existing users perf-wise, because the lock free pool, default on Jackson, give up on reusing the recycler (which is ~half meg) after 3 failed concurrent attempts; something that can happen, in real world. - real world ie users which dedicate few resources to containers and get contention issues NOT because too fast, but because too much sharing vs real cores :P

@geoand geoand added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Mar 28, 2024
Copy link

quarkus-bot bot commented Mar 28, 2024

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 982fdb8.

✅ 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.


Flaky tests - Develocity

⚙️ JVM Tests - JDK 21

📦 integration-tests/virtual-threads/grpc-virtual-threads

io.quarkus.grpc.example.streaming.VertxVirtualThreadTest.testUnary - History

  • INTERNAL: Half-closed without a request - io.grpc.StatusRuntimeException
io.grpc.StatusRuntimeException: INTERNAL: Half-closed without a request
	at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:268)
	at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:249)
	at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:167)
	at io.grpc.testing.integration.TestServiceGrpc$TestServiceBlockingStub.unaryCall(TestServiceGrpc.java:220)
	at io.quarkus.grpc.example.streaming.VirtualThreadTestBase.testUnary(VirtualThreadTestBase.java:33)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:1018)

@geoand geoand merged commit e984a98 into quarkusio:main Mar 28, 2024
48 checks passed
@quarkus-bot quarkus-bot bot added kind/bugfix and removed triage/waiting-for-ci Ready to merge when CI successfully finishes labels Mar 28, 2024
@quarkus-bot quarkus-bot bot added this to the 3.10 - main milestone Mar 28, 2024
@gsmet gsmet modified the milestones: 3.10 - main, 3.8.4 Apr 2, 2024
@gsmet gsmet mentioned this pull request Apr 2, 2024
@gsmet gsmet modified the milestones: 3.8.4, 3.10 - main Apr 3, 2024
@gsmet gsmet modified the milestones: 3.10 - main, 3.9.3 Apr 9, 2024
@gsmet gsmet modified the milestones: 3.9.3, 3.8.4 Apr 9, 2024
@gsmet gsmet modified the milestones: 3.8.4, 3.9.3 Apr 11, 2024
@gsmet gsmet modified the milestones: 3.9.3, 3.8.5 May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/jackson Issues related to Jackson (JSON library) kind/bugfix triage/flaky-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quarkus should use HybridJacksonPool with Loom
4 participants