-
Notifications
You must be signed in to change notification settings - Fork 38k
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
Spring Framework >= 5.3.8 ASM ClassReader fails to parse class file due to InputStream optimization #27429
Comments
I've modified readStream() method to have more data:
For the failed class I see following result:
Here I see, that buffer data differs from outputStream.toByteArray() result.
|
@MichalKoziorowski-TomTom Spring Framework is tracking changes on the official ASM repository. |
Hi @bclozel The more I try to reproduce this issue locally, the more I think it is somewhere in my JDK / linux distribution, not in Spring / ASM. I've tried to reproduce it on my local machine using trivial code in which I read same class from same JAR:
On my local machine it this always works. I will try next week to run this in the same docker environment where For me, it looks like last call to |
This sounds like a "fun" issue to track down - I'll leave this issue opened, waiting for your feedback. |
I worked with Michal to analyze this problem. We managed to reproduce the problem and determine the minimum necessary environment. The environment we use uses the cloudflare's zlib fork (https://github.com/cloudflare/zlib). We have created a sample github repository that easily reproduces the problem. Reproduction steps: We were also able to confirm supposition that last call to So the problem appears on a custom environment. However it seems to me, that cloudflare's zlib fork is so good and popular, that it is worth to take this problem and continue compatibility with spring boot. |
The InputStream handling optimization seems to be linked to this original ASM commit: https://gitlab.ow2.org/asm/asm/-/commit/cfda364ce57e39412b6cc89699b1003c6da6ec41 - making it not only into our ASM fork but also into ASM 9.2 proper. From that perspective, you should talk the issue to the ASM project itself; we'll track the outcome there. That said, this does look like a misbehaving For a quick fix, we can remove the optimization in our ASM fork in Spring Framework 5.3.11. It just seems like a workaround for a bug in that particular |
Hi. We will report this also in ASM project, but temporary removing this optimization would be nice to have. I'm not sure how long it will take until problem in Java |
I have created an issue in the ASM issues tracker: https://gitlab.ow2.org/asm/asm/-/issues/317955 |
@MichalKoziorowski-TomTom @180254 It looks like the issue got closed on the ASM side. We agree that the We're willing to reverse this optimization for the next version - until this situation is properly handled in CloudFlare's zlib. Did you report this issue to the library maintainers? Could you share the link here? Thanks! |
I would love to create issue in CloudFlare zlib (https://github.com/cloudflare/zlib), but they don't seem to have issues tab :( Also no contact information. I think we will try to contact one of the commiters. Maybe we will be lucky :) |
Affects: \ spring framework >= 5.3.8
In my project, after switching from using spring boot 2.4.4 to 2.4.10 At the very beginning of start I'm getting following exception:
I've unpacked HealthConfig.class from built jar and saw following when reading using linux midnight commander:
I've tried multiple versions of spring boot and spring framework and found that issue starts in spring 5.3.8.
In that version I see that org.springframework.asm.ClassReader was modified in: #27023
The text was updated successfully, but these errors were encountered: