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

Use Structured Concurrency in the Relayer #159

Closed
1 task
MakMuftic opened this issue Apr 12, 2023 · 0 comments · Fixed by #160
Closed
1 task

Use Structured Concurrency in the Relayer #159

MakMuftic opened this issue Apr 12, 2023 · 0 comments · Fixed by #160
Assignees

Comments

@MakMuftic
Copy link
Contributor

Auditor issue

In the current state, the relayer code liberally creates goroutines whenever a background task is started.
The called function is usually passed a context so it can be canceled, but in some instances goroutines
are leaked, leading to leaked memory. It can also make it hard to keep an overview of which goroutines
are running.

Location:
Chainsafe_Sygma_Relayer/comm/p2p/libp2p.go#L81-L87
Chainsafe_Sygma_Relayer/tss/common/base.go#L119

One approach the industry developed to avoid these problems is structured concurrency. As explained in
[here] and [here], the core idea is that all goroutines must finish before the function starting them
returns.

Implementation details

We should first figure out the scope of these changes, following the proposed approach.

Testing details

TBD

Acceptance Criteria

  • relayers codebase uses structured concurrency throughout the codebase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants