-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
ObjectMapper cannot work with a non-ThreadLocal based BufferRecycler pool #4321
Comments
This was my big miss: basic due diligency would have been to add one happy-path test for jackson-databind, at minimum. |
Ok, well, adding basic verification (see But it does look like use of |
@cowtowncoder I will try to provide an isolated reproducer based on the Quarkus test case that I was investigating yesterday. |
I have understood why it is not possible to reproduce the problem with the which in my opinion is equally wrong. The pool implementation that we're trying to use in Vert.x/Quarkus is a bit smarter, recognizing the kind of thread that is requiring the resource and falling back to the ThreadLocal based implementation in case of a native thread. In this case the 2 subsequent acquires performed by the write operation retrive the same instance of BufferRecycler and try to register it twice as taken from a pool, thus triggering that exception. I added a simplified version of that hybrid pool to your test and reproduced the problem. I'm not sure if that hybrid pool strategy should be considered an antipattern at this point or we should try to support it anyway, but in my opinion is not correct (or at least suboptimal) that a single write operation requires the use of 2 different BufferRecycler, so I will try to send a pull request fixing this. |
This change actually fixes our hybrid pool eclipse-vertx/vert.x@766f232 I believe this is a good improvement so I will leave it there. That said I believe there is still something wrong in jackson-databind for requiring more than one BufferRecycler for a single write operation. Please advice if this is something that you think it should (and could) be fixed, or you're happy with this for now. |
I sent a pull request to As you can see with this change in place the same instance of |
Yes, I did notice that separate |
As far as I understand, this is not longer concern; closing. |
Search before asking
Describe the bug
I was trying to integrate a new virtual threads friendly into Vert.x/Quarkus and found that jackson-databing cannot work with it, see quarkusio/quarkus#38196 (comment)
Version Information
2.16.1
Reproduction
I will provide an isolated reproducer asap, but this can be easily reproduced using any of the tests in the jackson quarkus extension after trying to to plug a custom pool.
Expected behavior
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: