[PR #472] [MERGED] fix: race condition in deployment_state metric updates #486

Closed
opened 2026-02-16 02:15:05 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/run-llama/llama_deploy/pull/472
Author: @masci
Created: 2/24/2025
Status: Merged
Merged: 2/26/2025
Merged by: @masci

Base: mainHead: massi/fix-deployment-status


📝 Commits (1)

  • cb1f484 fix: deployment_state metric not updated in containers

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 llama_deploy/apiserver/deployment.py (+1 -1)

📄 Description

Due to the asynchronous nature of thestart() method, the metric deployment_state running state could be overwritten with starting_services at a later time. This was very consistent in containers, where low resources highlighted the problem causing the metric to report an incorrect value.

Note that technically a better fix would have been adding a mutex to make sure the state is always 100% accurate, but I preferred to go with this fix because metric fidelity is good enough and the code is much simpler and easy to read.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/run-llama/llama_deploy/pull/472 **Author:** [@masci](https://github.com/masci) **Created:** 2/24/2025 **Status:** ✅ Merged **Merged:** 2/26/2025 **Merged by:** [@masci](https://github.com/masci) **Base:** `main` ← **Head:** `massi/fix-deployment-status` --- ### 📝 Commits (1) - [`cb1f484`](https://github.com/run-llama/llama_deploy/commit/cb1f48406462bba4905ec3ea741abdd5d4f9333a) fix: deployment_state metric not updated in containers ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `llama_deploy/apiserver/deployment.py` (+1 -1) </details> ### 📄 Description Due to the asynchronous nature of the`start()` method, the metric `deployment_state` running state could be overwritten with `starting_services` at a later time. This was very consistent in containers, where low resources highlighted the problem causing the metric to report an incorrect value. Note that technically a better fix would have been adding a mutex to make sure the state is always 100% accurate, but I preferred to go with this fix because metric fidelity is good enough and the code is much simpler and easy to read. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 02:15:05 -05:00
yindo closed this issue 2026-02-16 02:15:05 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/llama_deploy#486