MartijnVisser opened a new pull request, #30275:
URL: https://github.com/apache/flink/pull/30275

   ## What is the purpose of the change
   
   On JDK 17 and later, `ClosureCleaner` throws `InaccessibleObjectException` 
instead of reporting the non-serializable field when a field value's class is 
in a package that is not opened, such as an `HttpClient`. The `bin/flink run` 
defaults do not open the package involved there, `jdk.internal.net.http`, 
either.
   
   ## Brief change log
   
   - `ClosureCleaner` recurses only into field values that implement 
`Serializable`.
   - `ClosureCleaner` reads the fields of a class only if its package is open 
to Flink.
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
   - Three tests in `ClosureCleanerTest`. On master two fail with 
`InaccessibleObjectException` and one names `NonSerializableInner` instead of 
`NonSerializableOuter`. All pass on JDK 11, 17, 21 and 25.
   - 47 function shapes on JDK 11, 17, 21 and 25, with no opens, the `bin/flink 
run` defaults and all packages open: no `InaccessibleObjectException`, nothing 
master cleans now fails, cleaned functions serialize to the same bytes, and the 
error names the class `ObjectOutputStream` reports.
   
   A function inside some JDK wrappers, such as `AtomicReference`, is still 
cleaned only when the wrapper's package is open. Without the opens it now fails 
with the serializability error instead. On JDK 11 with the default 
`--illegal-access=permit`, such functions print the same illegal-access warning 
as on master.
   
   A field value that `serialPersistentFields` leaves out no longer makes the 
cleaner fail.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented? not applicable
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (Claude Opus 5.5)
   


-- 
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