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

Clearer service exceptions #1245

Merged
merged 4 commits into from Sep 3, 2018
Merged

Conversation

carver
Copy link
Contributor

@carver carver commented Sep 3, 2018

What was wrong?

When child services couldn't start (in run_child_service or run_daemon), the stack had lost who the calling parent was because of asyncio indirection.

How was it fixed?

  • Raise exceptions earlier in the flow, with clearer messaging
  • ValidationError slightly more helpful than RuntimeError

Also, prefer run_child_service over run_task in peer, because it has more info
to give better error messages.

Cute Animal Picture

put a cute animal picture link inside the parentheses

- if child service can't start
- ValidationError mildly more helpful than RuntimeError

Also, prefer run_child_service over run_task, because it has more info
to give better error messages.
Copy link
Member

@pipermerriam pipermerriam left a comment

Choose a reason for hiding this comment

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

Marked as "request changes" due to concern over unbounded growth of the child services set. If this is not an issue 👍 on this PR.

@@ -732,7 +732,7 @@ def unsubscribe(self, subscriber: PeerSubscriber) -> None:
peer.remove_subscriber(subscriber)

async def start_peer(self, peer: BasePeer) -> None:
self.run_task(peer.run())
self.run_child_service(peer)
Copy link
Member

Choose a reason for hiding this comment

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

This seems problematic as I don't see a mechanism for peers which stop to be removed from the self._child_services set, which will result in that set growing in an unbounded nature. I know that the task set uses a WeakSet to ensure that old tasks are garbage collected (which I'm realizing we should maybe validate that at some point?).

@carver
Copy link
Contributor Author

carver commented Sep 3, 2018

Weird, my tox -elint-py3{5,6} started giving false positives. Sorry for the churn on the PR. Off to investigate...

@cburgdorf
Copy link
Contributor

You probably missed #1229

@carver
Copy link
Contributor Author

carver commented Sep 3, 2018

You probably missed #1229

Ah yes, thanks @cburgdorf . I'm actually using make lint, and so the Makefile is missing it too. I'll add it.

@carver
Copy link
Contributor Author

carver commented Sep 3, 2018

Wait, it's worse/weirder than that, the tox envlist didn't get changed either.

@cburgdorf
Copy link
Contributor

Oops 🙈🙉

Copy link
Member

@pipermerriam pipermerriam left a comment

Choose a reason for hiding this comment

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

Can we get a test in the tests/p2p module somewhere that validates that completed tasks and child services do indeed get cleared from the list. I'm now paranoid we think these will be automatically cleaned up but that they won't.

@carver
Copy link
Contributor Author

carver commented Sep 3, 2018

👍 done

@carver carver merged commit dd304cc into ethereum:master Sep 3, 2018
@carver carver deleted the service-exceptions branch September 3, 2018 21:32
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

3 participants