You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fluss.apache.org by "beryllw (via GitHub)" <gi...@apache.org> on 2025/07/30 07:42:55 UTC

[I] Avoid ByteBuffer incompatibility when compiling with JDK9+ [fluss]

beryllw opened a new issue, #1419:
URL: https://github.com/apache/fluss/issues/1419

   ### Search before asking
   
   - [x] I searched in the [issues](https://github.com/alibaba/fluss/issues) and found nothing similar.
   
   
   ### Fluss version
   
   0.7.0 (latest release)
   
   ### Please describe the bug 🐞
   
   The explanation for this is given in https://github.com/apache/felix/pull/114 :
   
   > Java 9 introduces overridden methods with covariant return types for the following methods in java.nio.ByteBuffer:
   > ```
   > position​(int newPosition)
   > limit​(int newLimit)
   > flip​()
   > clear​()
   > mark​()
   > reset​()
   > rewind​()
   > ```
   > In Java 9 they all now return ByteBuffer, whereas the methods they override return Buffer,
   resulting in exceptions like this when executing on Java 8 and lower:
   java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer
   > This is because the generated byte code includes the static return type of the method, which is not found on Java 8 and lower because the overloaded methods with covariant return types don't exist (the issue appears even with source and target 8 or lower in compilation parameters).
   The solution is to cast ByteBuffer instances to Buffer before calling the method.
   
   
   Steps to Reproduce:
   1. Compile Fluss with JDK 9+.(Or use fluss website [Fluss Flink 1.18 client](https://repo1.maven.org/maven2/com/alibaba/fluss/fluss-flink-1.18/0.7.0/fluss-flink-1.18-0.7.0.jar))
   2. Use the compiled Fluss client jar in Flink 1.18 with JDK 8.
   ```
   Caused by: java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer;
           at com.alibaba.fluss.utils.ByteBufferReadableChannel.read(ByteBufferReadableChannel.java:56) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at com.alibaba.fluss.shaded.arrow.org.apache.arrow.vector.ipc.ReadChannel.readFully(ReadChannel.java:60) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at com.alibaba.fluss.shaded.arrow.org.apache.arrow.vector.ipc.message.MessageSerializer.readMessage(MessageSerializer.java:683) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at com.alibaba.fluss.shaded.arrow.org.apache.arrow.vector.ipc.message.MessageSerializer.deserializeRecordBatch(MessageSerializer.java:355) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at com.alibaba.fluss.utils.ArrowUtils.createArrowReader(ArrowUtils.java:159) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at com.alibaba.fluss.record.DefaultLogRecordBatch.columnRecordIterator(DefaultLogRecordBatch.java:330) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at com.alibaba.fluss.record.DefaultLogRecordBatch.records(DefaultLogRecordBatch.java:244) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at com.alibaba.fluss.client.table.scanner.log.CompletedFetch.nextFetchedRecord(CompletedFetch.java:219) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at com.alibaba.fluss.client.table.scanner.log.CompletedFetch.fetchRecords(CompletedFetch.java:169) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at com.alibaba.fluss.client.table.scanner.log.LogFetchCollector.fetchRecords(LogFetchCollector.java:159) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at com.alibaba.fluss.client.table.scanner.log.LogFetchCollector.collectFetch(LogFetchCollector.java:117) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at com.alibaba.fluss.client.table.scanner.log.LogFetcher.collectFetch(LogFetcher.java:162) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at com.alibaba.fluss.client.table.scanner.log.LogScannerImpl.pollForFetches(LogScannerImpl.java:233) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at com.alibaba.fluss.client.table.scanner.log.LogScannerImpl.poll(LogScannerImpl.java:143) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at com.alibaba.fluss.flink.source.reader.FlinkSourceSplitReader.fetch(FlinkSourceSplitReader.java:164) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at org.apache.flink.connector.base.source.reader.fetcher.FetchTask.run(FetchTask.java:58) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at org.apache.flink.connector.base.source.reader.fetcher.SplitFetcher.runOnce(SplitFetcher.java:165) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at org.apache.flink.connector.base.source.reader.fetcher.SplitFetcher.run(SplitFetcher.java:117) ~[ads-realtime-feature-test-1.0-SNAPSHOT.jar:?]
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_202]
           at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_202]
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_202]
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_202]
           ... 1 more
   ```
   
   ### Solution
   
   > The solution is to cast ByteBuffer instances to Buffer before calling the method.
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!


-- 
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: issues-unsubscribe@fluss.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Avoid ByteBuffer incompatibility when compiling with JDK9+ [fluss]

Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia commented on issue #1419:
URL: https://github.com/apache/fluss/issues/1419#issuecomment-3163207883

   @beryllw Thanks for the pr. But we are going to upgrade  jdk 11 in #1195 . 


-- 
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: issues-unsubscribe@fluss.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Avoid ByteBuffer incompatibility when compiling with JDK9+ [fluss]

Posted by "beryllw (via GitHub)" <gi...@apache.org>.
beryllw commented on issue #1419:
URL: https://github.com/apache/fluss/issues/1419#issuecomment-3163319257

   > But we are going to upgrade jdk 11 in [#1195](https://github.com/apache/fluss/issues/1195) .
   
   Thanks for answer.


-- 
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: issues-unsubscribe@fluss.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Avoid ByteBuffer incompatibility when compiling with JDK9+ [fluss]

Posted by "beryllw (via GitHub)" <gi...@apache.org>.
beryllw closed issue #1419: Avoid ByteBuffer incompatibility when compiling with JDK9+
URL: https://github.com/apache/fluss/issues/1419


-- 
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: issues-unsubscribe@fluss.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org