RongtongJin opened a new issue, #10927:
URL: https://github.com/apache/rocketmq/issues/10927

   ### Before Creating the Bug Report
   
   - [x] I found a bug, not just a question.
   - [x] I searched RocketMQ issues, pull requests, and discussions and found 
no duplicate.
   - [x] I confirmed that the affected dependency is used by this repository.
   
   ### Runtime platform environment
   
   - OS: macOS arm64
   - Build tool: Maven 3.9.2
   
   ### RocketMQ version
   
   - Branch: `develop`
   - Commit: `7eee0fc366e869cbfe92b5c763f1a7daafc91af9`
   - fastjson2: `2.0.63`
   
   ### JDK Version
   
   Amazon Corretto `1.8.0_502-b07`.
   
   ### Describe the Bug
   
   RocketMQ `develop` currently uses fastjson2 2.0.63 after #10715. In a fresh 
JDK 8 process, remoting serialization can fail while fastjson2 creates a 
property accessor:
   
   ```text
   RuntimeException: Failed to create lambda for method:
   public void 
org.apache.rocketmq.remoting.protocol.body.BatchAck.setTopic(java.lang.String)
   
   Caused by: java.lang.invoke.LambdaConversionException:
   Invalid caller: org.apache.rocketmq.remoting.protocol.body.BatchAck
   ```
   
   The result depends on whether `MethodHandles.Lookup` was initialized before 
fastjson2, so broader test execution or application initialization order may 
mask the problem.
   
   ### Steps to Reproduce
   
   Use JDK 8 and run the remoting compatibility test in a fresh JVM:
   
   ```bash
   mvn -B -ntp -nsu -pl remoting -am \
     -Djacoco.skip=true \
     -Dtest=RemotingSerializableCompatTest \
     -Dsurefire.failIfNoSpecifiedTests=false \
     clean test
   ```
   
   With fastjson2 2.0.63:
   
   ```text
   Tests run: 2, Failures: 0, Errors: 1, Skipped: 1
   BUILD FAILURE
   ```
   
   Override only the fastjson2 version:
   
   ```bash
   mvn -B -ntp -nsu -pl remoting -am \
     -Dfastjson2.version=2.0.64 \
     -Djacoco.skip=true \
     -Dtest=RemotingSerializableCompatTest \
     -Dsurefire.failIfNoSpecifiedTests=false \
     clean test
   ```
   
   Result:
   
   ```text
   Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
   BUILD SUCCESS
   ```
   
   ### What Did You Expect to See?
   
   RocketMQ remoting objects should serialize and deserialize normally on the 
supported JDK 8 runtime.
   
   ### What Did You See Instead?
   
   fastjson2 2.0.63 throws `LambdaConversionException: Invalid caller` during 
property accessor creation.
   
   ### Additional Context
   
   This JDK 8 cold-start regression is fixed upstream in fastjson2 2.0.64:
   
   - https://github.com/alibaba/fastjson2/issues/7691
   - https://github.com/alibaba/fastjson2/pull/7718
   - https://github.com/alibaba/fastjson2/releases/tag/2.0.64
   
   The proposed RocketMQ fix is to upgrade Maven and Bazel to fastjson2 2.0.64 
without adding an initialization-order workaround.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to