[
https://issues.apache.org/jira/browse/FLINK-41719?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18154498#comment-18154498
]
Fabian Hueske commented on FLINK-41719:
---------------------------------------
Another occurrence:
https://dev.azure.com/apache-flink/apache-flink/_build/results?buildId=82409&view=logs&j=fc5181b0-e452-5c8f-68de-1097947f6483&t=995c650b-6573-581c-9ce6-7ad4cc038461
{noformat}
java.lang.AssertionError:
[part 1 is still in flight]
Expecting AtomicInteger(1) to have value:
1
but did not.
at
org.apache.flink.fs.s3native.writer.NativeS3RecoverableFsDataOutputStreamTest.partUploadFailureStopsWritesWhileEarlierPartsAreInFlight(NativeS3RecoverableFsDataOutputStreamTest.java:345)
{noformat}
I think the cause is a race in the test. The test releases \{{failingPartGate}}
right after the two writes and then waits only until the stream has failed. It
never waits until the upload of part 1 has started. \{{FakeNativeS3Operations}}
increments \{{inFlightUploads}} only when the upload task enters
\{{uploadPart}}, so on a slow machine the assertion can run before the pool
thread of part 1 gets there. The message shows this: AssertJ read 0 for the
comparison, and the counter was 1 when it printed the message.
The other tests in the class wait for the in-flight count before they assert.
Waiting until both uploads are in flight before part 2 is released should fix
it:
{code:java}
asyncStream.write(bytes('A', 10), 0, 10);
asyncStream.write(bytes('B', 10), 0, 10);
waitUntilCondition(() -> s3.inFlightUploads.get() == 2);
s3.failingPartGate.countDown();
{code}
The failing test was introduced for FLINK-41427.
Could you take a look [~dbsamrat]?
> NativeS3RecoverableFsDataOutputStreamTest.partUploadFailureStopsWritesWhileEarlierPartsAreInFlight
> is flaky
> -----------------------------------------------------------------------------------------------------------
>
> Key: FLINK-41719
> URL: https://issues.apache.org/jira/browse/FLINK-41719
> Project: Flink
> Issue Type: Bug
> Components: FileSystems
> Affects Versions: 2.4.0, 2.5.0
> Reporter: Purushottam Sinha
> Priority: Major
> Labels: test-stability
>
> *Problem*
> The test checks that part 1 is still in flight without waiting for part 1's
> upload to start. It fails at random when the upload thread is slow to start.
> *Evidence*
> * [Azure build
> 82234|https://dev.azure.com/apache-flink/apache-flink/_build/results?buildId=82234&view=logs&j=fc5181b0-e452-5c8f-68de-1097947f6483&t=995c650b-6573-581c-9ce6-7ad4cc038461],
> stage {{test_ci misc}}, on PR #30175, which doesn't touch S3:
> {{NativeS3RecoverableFsDataOutputStreamTest.java:345}} failed with
> {noformat}
> [part 1 is still in flight]
> Expecting AtomicInteger(1) to have value:
> 1
> but did not.
> {noformat}
> The value changed between the check and the message.
> * {{FakeNativeS3Operations.uploadPart}} increments {{inFlightUploads}} only
> once an upload thread enters it. The test waits only for
> {{isFailed(asyncStream)}} before checking the counter.
> * The test was added in {{9b82e9ca9b2}} (#29890) and backported to
> release-2.4 (#30103).
> *Proposed fix*
> * Before the assertion at line 345, wait for {{s3.inFlightUploads.get() ==
> 1}}, as other tests in the class do (lines 361, 404 and 430).
> *Acceptance*
> * The test passes repeatedly in a loop on master and release-2.4.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)