Fixes memory leak when the job crashes before it's freed#3178
Fixes memory leak when the job crashes before it's freed#3178madolson merged 7 commits intovalkey-io:unstablefrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #3178 +/- ##
================================
================================
🚀 New features to boost your workflow:
|
|
@madolson looks like valgrind is green with this PR: https://github.com/sarthakaggarwal97/valkey/actions/runs/21770227707 Do you have any feedbacks on this change on a high level? I know we discussed that this is a bit inefficient. |
|
@madolson valgrind run is green: https://github.com/sarthakaggarwal97/valkey/actions/runs/21887850029/job/63288991006 |
Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
94d1513 to
b992da4
Compare
Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
) If there is a crash between the time the job is popped and freed, we technically leak memory. This change allows us to peek, and pop just before we are about to free the job. Fixes valgrind errors: https://github.com/valkey-io/valkey/actions/runs/21969557125/job/63467641572#step:6:8648 --------- Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
|
@madolson Good to see that this change resolves the test issue. However, I'm not keen on the API change. It's common/typical for a mutex queue to support multiple readers. By adding a I'll look into alternatives. |
Another thing we considered was to have a global/static pointer which keeps track of the per-thread objects. So even when the thread is killed, there is still a global reference so valgrind is happy. I am indifferent to the new API, but we needed a fix for the valgrind issue. |
If there is a crash between the time the job is popped and freed, we technically leak memory. This change allows us to peek, and pop just before we are about to free the job.
Fixes valgrind errors: https://github.com/valkey-io/valkey/actions/runs/21969557125/job/63467641572#step:6:8648