-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
rpc stream source does not emit empty optional when the sender is done #2612
Comments
How can source() know that? |
When the sink is closed by the peer and all data has been read out.
We have the end of frame message in user level to tell the rx side there is no more data. The above example skipped it for simplicity. |
This is what the doc say: Basic element of streaming API is To send the data using while (has_data()) {
int data1 = get_data1();
long data2 = get_data2();
sink(data1, data2).get(); // sends data
}
sink.close().get(); // closes stream To receive: while (true) {
std:optional<std::tuple<int, long>> data = source().get();
if (!data) {
// unengaged optional means EOS
break;
} else {
auto [data1, data2] = *data;
// process data
}
} |
I concur |
This hints at a continuation reordering somewhere. Or problem with cross shard stream sending (IIRC debug disables shard to shard optimization). |
… without error queue::abort() drops all queued packets and report an error to a consumer. If stream connection completes normally we want the consumer to get all the data without errors, so abort the queue only in case of an error. Otherwise the queue will wait to be consumed. Since closing the stream involves sending a special EOS packet the consumer should not hang since the queue will not be empty. Fixes: #2612 Message-ID: <[email protected]>
empty opt which indicates there is no more data. (I verified this happened in
practice in the test)
This makes rx side think there is an seastar::rpc::stream_closed error incorrectly.
Instead source() should always return an empty opt to indicate there is no more data.
This bug happens only in debug build.
It was found in file_stream_test here:
scylladb/scylladb#22034 (comment)
https://github.com/scylladb/scylla-enterprise/issues/4295#issuecomment-2179901124
The text was updated successfully, but these errors were encountered: