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

Relay graceful shutdown implementation #203

Open
sameh-farouk opened this issue Dec 4, 2024 · 7 comments
Open

Relay graceful shutdown implementation #203

sameh-farouk opened this issue Dec 4, 2024 · 7 comments
Assignees

Comments

@sameh-farouk
Copy link
Member

sameh-farouk commented Dec 4, 2024

The RMB relay does not have a complete graceful shutdown implementation. Here are the key observations:

  1. The main relay server loop in src/relay/mod.rs runs in an infinite loop without any shutdown handling.
  2. The federation worker also runs in an infinite loop in src/relay/federation/mod.rs without shutdown handling.
  3. The chain event listener in src/events/mod.rs also lacks shutdown handling.

I recommend implementing proper graceful shutdown handling to ensure reliable operation, maintain data integrity, and prevent resource leaks.

To implement proper graceful shutdown, the relay should:

  1. Handle OS signals (SIGTERM, SIGINT)
  2. Propagate shutdown signals to all components
  3. Allow in-flight messages to complete
  4. Close active connections cleanly
  5. Flush any remaining data to Redis
  6. Clean up any resources
@Nabil-Salah Nabil-Salah self-assigned this Dec 4, 2024
@Nabil-Salah
Copy link
Contributor

5-12-2024

investigate how to do graceful shutdown in rust

@Nabil-Salah
Copy link
Contributor

11-12-2024

implemented graceful shutdown on files specified on the issue and opened a draft pr

@Nabil-Salah Nabil-Salah moved this to In Progress in 3.16.x Dec 12, 2024
@Nabil-Salah Nabil-Salah moved this from In Progress to Pending Review in 3.16.x Dec 12, 2024
@Nabil-Salah Nabil-Salah moved this from Pending Review to Accepted in 3.16.x Dec 17, 2024
@Nabil-Salah
Copy link
Contributor

12-12-2024

reviewed graceful shutdown pr
was in meet with ashraf about tracing a problem in rmb

@Nabil-Salah Nabil-Salah moved this from Accepted to Pending Review in 3.16.x Dec 17, 2024
@Nabil-Salah Nabil-Salah moved this from Pending Review to In Progress in 3.16.x Dec 19, 2024
@Nabil-Salah
Copy link
Contributor

Nabil-Salah commented Jan 2, 2025

2-1-2025

Start exploring Tokio tutorial

@Nabil-Salah
Copy link
Contributor

Nabil-Salah commented Jan 8, 2025

7-1-2025

continued Tokio exploration

@Nabil-Salah
Copy link
Contributor

Nabil-Salah commented Jan 8, 2025

8-1-2025

continued Tokio exploration
and started working on the issue implementation

@Nabil-Salah
Copy link
Contributor

9-1-2025

worked on graceful shutdown implementation using TaskTracker and CancellationToken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

No branches or pull requests

2 participants