Skip to content
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

TestEnvironment: Fix timeout arithmetic #544

Merged
merged 1 commit into from
Aug 4, 2023

Conversation

Scottmitch
Copy link
Contributor

Motivation:
The timeout calculation decrementing totalTimeoutRemainingNs is incorrect which results in premature timeouts and test failures.

@Scottmitch
Copy link
Contributor Author

@viktorklang - are you still merging commits? are there other contributors (do you need more)?

@Scottmitch
Copy link
Contributor Author

@rkuhn @akarnokd - wdyt?

@akarnokd
Copy link
Contributor

akarnokd commented May 7, 2023

Indeed the original code looks wrong but I don't remember tripping this failure case ever. Also isn't there a TCK test that verifies this timeout case?

@rkuhn
Copy link
Member

rkuhn commented May 7, 2023

The fact that this obvious bug only surfaces now means that this TCK facility is not used correctly anywhere in the code — long underflow seems unlikely to occur here. I can’t offer further comments as the TCK was mainly conceived and implemented by @ktoso (and I haven’t used JVM languages for the past few years).

@Scottmitch
Copy link
Contributor Author

If errors are delivered synchronously (like in the TCK tests) and the unit under test is behaving as expected, it is unlikely this code will be hit (e.g. env.asyncErrors.isEmpty() will be false). We occasionally hit the condition in ServiceTalk due to testing async signal delivery (different thread than test thread).

@Scottmitch
Copy link
Contributor Author

I added a unit test to the TCK to demonstrate the issue (if you remove the fix the test will likely fail).

@Scottmitch Scottmitch force-pushed the timeout_fix branch 2 times, most recently from 2b7af33 to b7c8c83 Compare May 13, 2023 16:28
@Scottmitch Scottmitch requested a review from akarnokd May 13, 2023 16:28
@Scottmitch Scottmitch force-pushed the timeout_fix branch 4 times, most recently from d1e0462 to f606fa1 Compare May 13, 2023 16:57
@Scottmitch
Copy link
Contributor Author

@akarnokd - thanks for approval. What are the next steps to getting this merged and released?

@akarnokd
Copy link
Contributor

akarnokd commented Jun 8, 2023

I don't know. Most of the original crew have moved on afaik so no idea.

@rkuhn
Copy link
Member

rkuhn commented Jun 8, 2023

I’m afraid I lost my sonatype credentials, so I can’t publish anymore. If someone else wants to step up and needs me to confirm something, then I’ll happily do that!

@Scottmitch
Copy link
Contributor Author

@akarnokd @rkuhn - how does one become a contributor for this repo? I pinged victor offline and he is no longer involved. would love to get this merged and released.

@akarnokd
Copy link
Contributor

No idea. Also no idea how the release infrastructure is working.

If I had this annoying issue, after so much time, I'd seriously consider cloning the TCK, applying the fixes and begin using that to verify my projects. Given the amount of development in RS, you probably won't have to worry about becoming incompatible.

(If I understood .NET better, I would have done it for the Reactive Streams .NET TCK repo, which practically unusable with newer test frameworks of .NET)

Copy link
Contributor

@ktoso ktoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIKS this looks fine, LGTM. I guess it "worked ok enough" so that we didn't notice earlier, thanks for the fix @Scottmitch.

As for releasing, I don't think I can help with that nowadays.

@Scottmitch
Copy link
Contributor Author

Scottmitch commented Jul 19, 2023

@ktoso - thx for review. comments addressed.

"worked ok enough" so that we didn't notice earlier

I'm assuming most tests have publisher and verification on same thread which would make it unlikely to come up.

Motivation:
The timeout calculation decrementing `totalTimeoutRemainingNs` is incorrect
which results in premature timeouts and test failures.

Signed-off-by: Scott Mitchell <scott_mitchell@apple.com>
@ktoso
Copy link
Contributor

ktoso commented Aug 4, 2023

I'd approve and merge but have long since lost merge rights here.

@viktorklang @rkuhn are you able to help out here?

@rkuhn rkuhn merged commit 793cd16 into reactive-streams:master Aug 4, 2023
3 checks passed
@rkuhn
Copy link
Member

rkuhn commented Aug 4, 2023

I can merge, so I did that, but as I said I can’t publish anymore.

@ktoso
Copy link
Contributor

ktoso commented Aug 4, 2023

Thank you! It seems I can publish (but not merge) huh, so I’ll give that a try if we want a patch release with this :)

@rkuhn
Copy link
Member

rkuhn commented Aug 4, 2023

Sure, go ahead! I guess you’ll need another PR to bump the version, right?

@Scottmitch Scottmitch deleted the timeout_fix branch August 4, 2023 14:59
@Scottmitch
Copy link
Contributor Author

version update: #547

anything else required for release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants