Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[FLINK-38349][runtime] Address SpillingThread Zero-Division During Channel Merging Operations#27238

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
rionmonster wants to merge5 commits intoapache:master
base:master
Choose a base branch
Loading
fromrionmonster:flink-38349

Conversation

@rionmonster
Copy link
Contributor

@rionmonsterrionmonster commentedNov 13, 2025
edited
Loading

What is the purpose of the change

This pull request addresses the issue detailed inFLINK-38349 which describes scenarios in which certain edge-case values formaxFanIn andchannelIDs.size() could result in floating-point errors that resulted in thrownArithmeticException exceptions (specifically division by zero). This adds the appropriate safeguards to prevent these issues.

The originating JIRA ticket provides detailed examples illustrating how the floating-point errors were reproduced. In summary,the issue occurs whenever the channel count (channelIDs.size()) is greater than or equal to a power ofmaxFanIn:

channelIDs.size() ≥ maxFanInⁿ

The overall change not only addresses the floating-point issues but alsoimproves scaling calculation performance by 3-4x on average (see chart below).

Brief change log

  • Updated the scaling logic that occurs withinSpillingThread.mergeChannelList() by replacing the previousMath.log()-based calculations, which could result in floating point errors, in favor of an iterative, exponential search.
    • Added a privatecomputeMergeScaleForChannelSize() function to encapsulate and document the updated scaling calculations.
  • Added a newSpillingThreadTest file with an associated, parameterizedtestMergeChannelListDivideByZeroSafety test that was used to reproduce the original issue and was later adjusted to confirm the fix.

Verifying this change

This change added tests and can be verified as follows:

  • Added newSpillingThreadTest.testMergeChannelListDivideByZeroSafety which originally reproduced the issue by creating a series of parameterized tests founds within the originating JIRA ticket.
  • Ensured all previous test suites within the related areas were passing as expected.

Verifying Performance

In addition to these tests related to reproduction, I performed a series of manual tests to verify performance between the previousMath.log()-based approach (prone to floating-point error) and the newer iterative, exponential approach.

IterationsOld Approach (ns/call)New Approach (ns/call)Improvement
1,00033.0717.681.87x
10,00028.628.63.33x
100,0008.944.422.02x
1,000,0006.21.783.48x
100,000,0005.661.284.42x

You cansee the full gist here with all of the necessary code comparing the older and newer approaches (elected not to commit as it was purely for demonstration purposes).

Verifying Correctness

In addition to the above performance tests, I also performed a similar equivalence test comparing the generated results between the previous and new approaches to ensure parity (sans floating-point errors) for many of the common and edge case values presented earlier:

image

You can finda related gist containing these tests as well.

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):yes / don't know
  • Anything that affects deployment or recovery: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

[FLINK-38349][runtime] Updated SpillingThreadTest Verbiage
… During Channel Merging Operations[FLINK-38349][runtime] Address Potential SpillingThread Zero-Division During Channel Merging Operations
@flinkbot
Copy link
Collaborator

flinkbot commentedNov 13, 2025
edited
Loading

CI report:

Bot commands The@flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@rionmonster
Copy link
ContributorAuthor

@flinkbot run azure

@rionmonster
Copy link
ContributorAuthor

@dawidwys

First of all, hi! I’m tagging you becausegit blame shows you as the main (and only) person who has worked onSpillingThread, and I wasn’t able to easily find or tag you in JIRA (which has also been pretty unreliable lately). Sincethe ticket marked this issue as a blocker, I wanted to reach out in case it was a higher priority than some of the other items I’ve tackled in the past.

Most of the changes are in the tests—first to reproduce the issue, then to verify the fix. The actual fix for the floating-point bug ended up being quite small by comparison. Any feedback you have would be greatly appreciated!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@rionmonster@flinkbot

[8]ページ先頭

©2009-2025 Movatter.jp