-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Child fiber interrupted while parent runs onInterrupt #8804
Comments
Any of our attempt to minimize this further (not using stream) failed. In other words, it could be that this is a bug/feature of the streams implementation. |
In ZIO 2, transitive fiber interruption is "instantaneous". This means a great grand-child can be interrupted before a parent finishes its winddown process. This is different behavior than earlier versions of ZIO. In general, it's a better default, but there are some cases where you might have to add explicit synchronization to prevent this behavior. In this case, could be a bug in streams (or could be a feature, depending on your point of view). Interested in feedback. |
A workaround would be great, but we're not sure how. We can't run the stream with
My first thought was that since we're explicitly using Another thought is that we could introduce an interrupt strategy that governs how child fibers are interrupted. For example, a zio might get method |
Interesting, under ZIO 2.1 (2.1.0-RC5) the problem does not seem to occur. Does ZIO 2.1 not interrupt all fibers at once like ZIO 2.0 does? |
@erikvanoosten, would it be possible to test whether the issue is there with version 2.1-RC1? I changed a bunch of things after RC1 and want to know whether it's something I did or was done previously |
@kyri-petrou 2.1-RC1 also has the expected behavior. BTW, I am testing this with the app listed above, but with the last line replaced by: p.timeout(100.millis).repeatN(100000) |
In zio-kafka we're trying to add clean shutdown. The goal is to complete processing a stream, that is, process it up to the end marker that we insert when interrupted. However, unfortunately the stream sometimes gets interrupted ahead of time as well.
Below is a minimizer. Every few executions the stream is interrupted, shown by the console output:
While we expect that the console output is always:
Our expectation is that the stream is not interrupted until after
fib.join.onInterrupt
completes.In other words, we expect that child fibers are not interrupted as long as the parent is running
onInterrupt
.If this is expected behavior, is there another way to achieve the same effect?
The text was updated successfully, but these errors were encountered: