-
Notifications
You must be signed in to change notification settings - Fork 37
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Fail Overflow Test less flaky #164
Make Fail Overflow Test less flaky #164
Conversation
Fail overflow test can fail to pass if exception is thrown after more then 256 messages have been processed eclipse#162
Can one of the admins verify this patch? |
@eclipse-microprofile-bot please test this |
To be honest, this test looks pretty sketchy. We're submitting to the executor in a tight loop, but the methods downstream of the processor seem to also run as quickly as possible. I don't think there's any guarantee in this test that the emitter will overflow? |
Yes, it may not overflow depending on the timing of the test. We may want to disable it completely. |
@eclipse-microprofile-bot test this please |
@cescoffier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good.
That'll be a 1 millisecond sleep - which should still be enough to ensure that we send messages to the emitter faster than they can be processed. |
We're also seeing occasional failures in DropOverflowStrategyOverflowTest/ https://issues.redhat.com/browse/WFLY-17635 Would a similar fix be appropriate there? I've not looked beyond verifying that the classes are different :-) |
Please open a different issue and propose a PR @kabir |
@cescoffier are you okay with this PR? |
@ozangunalp can you check? It should be fine (as discussed). |
It seems to me like it'll almost always fail. The second emit will be called before the very first message arrives to the I think we should just get rid of the assertion |
Good point. In practise, the |
Ok, @abutch3r and I just had a chat about this test. As soon as the emitter overflows, it emits a failure and terminates the subscription (1.6). At this point all further messages should result in the Emitter throwing So when the emitter first throws an exception, neither the first message, nor the failure signal may have reached the end of the stream yet. Currently the test awaits on an exception being thrown from the emitter. We think if we change it to wait for the onError signal to arrive, that would guarantee that the At that point, it would be theoretically possible for the test thread not to yet see an exception thrown from the emitter since that's done asynchronously, so we should |
Wait for the failure on the stream to occur instead of the exception on the emitter - this ensures that at least the first message will be sucessfully processed and that a failure did occur before assertions are checked. In the case where the failure may occur sufficiently late in the test execution such that there is a failure, but not yet an exception. In this case emit one more message and wait for the exception before checking emitThree was unused and would close close the stream via `.complete()` - repurpose for being able to send one message and not close the stream if successful.
//If an exception has not yet been thrown after the failure occurred, try one more message | ||
if (bean.exception() == null) { | ||
bean.emitOne(); | ||
await().until(() -> bean.exception() != null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line isn't needed because emitOne
runs synchronously.
I am trying to find a way to make this test work but even by waiting on the |
Hmm, I was under the impression that the failure signal should follow the items down the stream, not reaching the final subscriber until the previous two items had been processed, but I guess that's not the case? |
@cescoffier @ozangunalp do you have any objections to merge this PR? |
I think the previous changes are making this test even more flaky.
I think we can also revert the added |
I think you need the Each call to Having a lock in there so that the test can block tasks from completing until the emitter fails would be an alternative. |
44b9861
to
3a5eeb5
Compare
I have removed the the main issue we saw with the test is that the failure could occur after more then 500 messages were processed, so the Are these changes now satisfactory |
Fail overflow test can fail to pass if exception is thrown after more then 256 messages have been processed.
increase window within which a failure can occur by applying a similar change as was done in #158