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

return none if subscription returns early #250

Merged
merged 4 commits into from
Mar 22, 2021

Conversation

gregdhill
Copy link
Contributor

Signed-off-by: Gregory Hill gregorydhill@outlook.com

Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
@@ -95,14 +95,7 @@ impl<'a, T: Runtime> EventSubscription<'a, T> {
if self.finished {
return None
}
let change_set = match self.subscription.next().await {
Some(c) => c,
None => {
Copy link
Member

Choose a reason for hiding this comment

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

The proper action should be to indicate that the subscription is dropped and need to restarted because after it returns None it shouldn't be polled anymore because the channel has been terminated.

If you poll if after None it will panic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Which is exactly why I would expect it to return None, to indicate the stream has closed (much like with StreamExt).

Copy link
Member

Choose a reason for hiding this comment

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

Alright, that makes sense to me but perhaps we should document it because it's not obvious to me ^^

Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
Copy link
Contributor

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

LGTM

@ascjones
Copy link
Contributor

ascjones commented Mar 16, 2021

I think our CI is broken, all test runs are hanging now, possibly due to recent client changes.

@niklasad1
Copy link
Member

niklasad1 commented Mar 16, 2021

I get this locally:

[2021-03-16T12:52:42Z ERROR sc_finality_grandpa] GRANDPA voter error: Safety("`voter_commands_rx` was closed.")
[2021-03-16T12:52:42Z ERROR sc_service::task_manager] Essential task `grandpa-voter` failed. Shutting down service.
test frame::balances::tests::test_state_read_free_balance ... ok
test tests::test_getting_read_proof ... ok
test tests::test_iter ... ok
test tests::test_tx_transfer_balance ... ok
test tests::test_insert_key ... ok
test frame::balances::tests::test_transfer_subscription ... ok
[2021-03-16T12:52:48Z ERROR sc_finality_grandpa] GRANDPA voter error: Safety("`voter_commands_rx` was closed.")
[2021-03-16T12:52:48Z ERROR sc_service::task_manager] Essential task `grandpa-voter` failed. Shutting down service.
test frame::balances::tests::test_basic_transfer ... ok
test frame::sudo::tests::test_sudo_unchecked_weight ... ok
test frame::sudo::tests::test_sudo ... ok
[2021-03-16T12:53:12Z ERROR sc_finality_grandpa] GRANDPA voter error: Client(DatabaseError(DatabaseError(Custom { kind: Other, error: Error { message: "IO error: No such file or directoryWhile open a file for appending: /tmp/subxt-.QfQWaR1EUaUu/db/000033.log: No such file or directory" } })))
[2021-03-16T12:53:12Z ERROR sc_service::task_manager] Essential task `grandpa-voter` failed. Shutting down service.
test frame::balances::tests::test_transfer_error has been running for over 60 seconds

@gregdhill
Copy link
Contributor Author

I don't think the CI issue is related to the client changes as it was working before on this pipeline, also worked locally for me with these latest changes. Is it possible it has something to do with the environment? There's an annotation on the last successful run that ubuntu-latest was scheduled to be upgraded.

@ascjones
Copy link
Contributor

@gregdhill please merge master, it should fix CI

@niklasad1 niklasad1 mentioned this pull request Mar 19, 2021
@ascjones ascjones merged commit cb4bee5 into paritytech:master Mar 22, 2021
@gregdhill gregdhill deleted the none-on-sub-exit branch March 22, 2021 11:05
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.

3 participants