-
Notifications
You must be signed in to change notification settings - Fork 178
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
CachedCodecLookup
wrongly assumes uniqueness of hashCode()
#511
Comments
Codecs are now cached using their value type for simple value/null encoding. Additionally, for decoding we check whether the cached codec can decode the desired format/data type/value type and fall back to the cache supplier if there was a hash collision. [resolves #511] Signed-off-by: Mark Paluch <mpaluch@vmware.com>
That's fixed now. Care to restest against the latest snapshots? |
Mind backporting this to 0.8.x? The codebase where I see this issue is using Spring Boot 2.6.x, making tests with r2dbc-postgresql 0.9.x unfeasible. |
Codecs are now cached using their value type for simple value/null encoding. Additionally, for decoding we check whether the cached codec can decode the desired format/data type/value type and fall back to the cache supplier if there was a hash collision. [resolves #511] Signed-off-by: Mark Paluch <mpaluch@vmware.com>
That's backported to |
Thanks. Can confirm it works fine on the system where it failed before using |
We ran into this on 0.9.1.RELEASE, and had trouble finding the issue in the search. For those looking for a fix to ClassCastException when using r2dbc postgres, upgrading to 0.9.2.RELEASE fixed it for us. |
Bug Report
I got the following error on one of my machines repeatedly, when the same code worked fine on others:
It took me some time to debug this (also because running the JVM with debugger enabled would change the behavior), but I finally found the culprit.
It seems that it can happen that
java.util.UUID.class.hashCode() == java.net.InetAddress.class.hashCode()
and theCachedCodecLookup
implementation does not handle that case. I don't know why this happens and would assume that the JVM makes best effort to not let this happen, but it does happen for me and for as far as I can tell, the JVM and Java documentation do not guarantee that it can't happen.Versions
The text was updated successfully, but these errors were encountered: