sherry255 opened a new pull request, #28359:
URL: https://github.com/apache/flink/pull/28359
## What is the purpose of the change
Fixes FLINK-31244.
`OffHeapUnsafeMemorySegmentTest.testCallCleanerOnceOnConcurrentFree`
starts two threads that both call `segment.free()` on the same
`MemorySegment` to
verify the cleaner runs exactly once. When the multiple-free check is enabled
(`-Dflink.tests.check-segment-multiple-free`, which is set in CI), the
thread that
loses the race throws `IllegalStateException("MemorySegment can be freed
only once!")`.
Because `free()` was used directly as the thread body, that *expected*
exception was
raised as an uncaught exception in the worker thread and printed to the CI
logs as
noise, e.g.:
```
Exception in thread "Thread-13" java.lang.IllegalStateException:
MemorySegment can be freed only once!
```
The test still passed; only the logs were polluted.
## Brief change log
- Wrap the concurrent `segment.free()` call in a `Runnable` that catches the
expected
`IllegalStateException`, so it is no longer surfaced as an uncaught
exception. The
existing assertion that the cleaner ran exactly once is unchanged.
## Verifying this change
This change is a test-only fix and can be verified as follows:
- Before: running
`OffHeapUnsafeMemorySegmentTest#testCallCleanerOnceOnConcurrentFree`
with `-Dflink.tests.check-segment-multiple-free` passes but prints
`Exception in thread "Thread-N" java.lang.IllegalStateException:
MemorySegment can be freed only once!`.
- After: the same run passes with no such exception printed.
## 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: no
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? no
--
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]