-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Calling awaitOne on nonconforming Publishers gives nondescriptive errors #2079
Comments
👍 for such fix. |
Hi @vemilyus! Thanks for the report! It does look like this could be a useful change to make, but could you please clarify in which way the existing behavior diverges from the specifications? I looked through the spec and the only relevant point I found was 1.7:
By the definition of a signal, this means that a correct publisher must not call anything after |
Hi @dkhalanskyjb! Technically you are correct in your interpretation of the specification. However, simply ignoring the current state and allowing an illegal call anyway doesn't seem the right approach to me. The way I interpret the specification is to explicitly prohibit such further signals after a terminal state. So rather than potentially creating an undefined state by allowing such signals I would throw an appropriate exception that indicates that no further signals were expected. This would also help others who are writing Publishers to implement correct behavior, if illegal calls were made explicitly apparent. I think this is such a case where it would be helpful to follow the spirit of the specification, not just the letter of it. Please let me know if you have further thoughts on this. |
We are going to do something, the question is what exactly. The initial comment states specifically that in order to conform to the spec, we have to ignore calls after a terminal state was reached. If this were true, then just throwing a more descriptive error would be plainly incorrect and we would need to ignore additional terminal calls, which is why I asked for clarifications. So, are we in agreement here that our implementation is conforming in this regard, the error is on the jOOQ's side, and the best course of action for us will be to detect non-conforming publishers and throw a more informative error? |
Yes, the implementation is correct, but a more informative error would be much appreciated. |
The implementation of Reactive Streams' Subscriber used for `await*` operations was assuming that the publisher is correct. Now, the implementation detects some instances of problematic behavior for publishers and reports them. Fixes #2079
The implementation of Reactive Streams' Subscriber used for `await*` operations was assuming that the publisher is correct. Now, the implementation detects some instances of problematic behavior for publishers and reports them. Fixes #2079
The implementation of Reactive Streams' Subscriber used for `await*` operations was assuming that the publisher is correct. Now, the implementation detects some instances of problematic behavior for publishers and reports them. Fixes #2079
The implementation of Reactive Streams' Subscriber used for `await*` operations was assuming that the publisher is correct. Now, the implementation detects some instances of problematic behavior for publishers and reports them. Fixes Kotlin#2079
Hi, I've noticed that
Publisher.awaitOne
allows further calls toonComplete
after receiving anonError
call. This can potentially hide the exception that was supplied toonError
and instead throws this exception:The problem is that the call to
onError
doesn't mark the subscriber as done, so that no further calls toonComplete
are accepted and processed, as is specified here (reactive-streams specification)kotlinx.coroutines/reactive/kotlinx-coroutines-reactive/src/Await.kt
Lines 131 to 148 in 3bb3e55
This is something that I noticed when using JOOQ and
Publisher.awaitFirstOrNull()
to get a result from the database. JOOQ callsonComplete
at all times, even if it calledonError
before. I've also mentioned that in an issue for JOOQ: jOOQ/jOOQ#10245An easy fix for this would be to set
seenValue = true
inonError
or add an extra field which is then checked inonComplete
.The text was updated successfully, but these errors were encountered: