Skip to content

Conversation

@GitHK
Copy link
Contributor

@GitHK GitHK commented Jul 16, 2025

What do these changes do?

Without altering the current pattern, this fix addresses the issue reported by sonarcloud.

Related issue/s

How to test

Dev-ops

@GitHK GitHK requested a review from Copilot July 16, 2025 15:11
@GitHK GitHK self-assigned this Jul 16, 2025
@GitHK GitHK added this to the Engage milestone Jul 16, 2025

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Jul 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.05%. Comparing base (dbe8878) to head (74c749d).
Report is 1 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (dbe8878) and HEAD (74c749d). Click for more details.

HEAD has 30 uploads less than BASE
Flag BASE (dbe8878) HEAD (74c749d)
unittests 31 1
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #8121       +/-   ##
===========================================
- Coverage   89.83%   67.05%   -22.78%     
===========================================
  Files        1695      725      -970     
  Lines       65858    33422    -32436     
  Branches      814      176      -638     
===========================================
- Hits        59165    22412    -36753     
- Misses       6480    10952     +4472     
+ Partials      213       58      -155     
Flag Coverage Δ
integrationtests 64.21% <33.33%> (-0.02%) ⬇️
unittests 89.16% <100.00%> (+0.84%) ⬆️
Components Coverage Δ
pkg_aws_library ∅ <ø> (∅)
pkg_celery_library ∅ <ø> (∅)
pkg_dask_task_models_library ∅ <ø> (∅)
pkg_models_library ∅ <ø> (∅)
pkg_notifications_library ∅ <ø> (∅)
pkg_postgres_database ∅ <ø> (∅)
pkg_service_integration ∅ <ø> (∅)
pkg_service_library ∅ <ø> (∅)
pkg_settings_library ∅ <ø> (∅)
pkg_simcore_sdk 76.92% <ø> (-8.19%) ⬇️
agent ∅ <ø> (∅)
api_server ∅ <ø> (∅)
autoscaling ∅ <ø> (∅)
catalog ∅ <ø> (∅)
clusters_keeper ∅ <ø> (∅)
dask_sidecar ∅ <ø> (∅)
datcore_adapter ∅ <ø> (∅)
director ∅ <ø> (∅)
director_v2 77.10% <ø> (-13.87%) ⬇️
dynamic_scheduler ∅ <ø> (∅)
dynamic_sidecar 90.06% <100.00%> (+0.01%) ⬆️
efs_guardian ∅ <ø> (∅)
invitations ∅ <ø> (∅)
payments ∅ <ø> (∅)
resource_usage_tracker ∅ <ø> (∅)
storage ∅ <ø> (∅)
webclient ∅ <ø> (∅)
webserver 59.24% <ø> (-29.30%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dbe8878...74c749d. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@GitHK GitHK requested a review from Copilot July 17, 2025 08:09

This comment was marked as outdated.

@GitHK GitHK changed the title 🎨 Avoids early garbage collection of task 🐛 Avoids possible early garbage collection of task Jul 17, 2025
@GitHK GitHK requested a review from Copilot July 17, 2025 08:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a potential issue where a follow-up task could be garbage collected early by retaining a reference to it and ensuring it's properly canceled.

  • Introduces _task_uploading_followup to hold the cleanup task created in the upload-done callback.
  • Updates the remove-downloads callback to assign the task to the new attribute.
  • Extends the cancellation routine to handle and clear the follow-up task.
Comments suppressed due to low confidence (3)

services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/modules/outputs/_manager.py:121

  • [nitpick] The name _task_uploading_followup is somewhat vague. Consider renaming it to something like _task_remove_all_uploading or _cleanup_upload_task for clearer intent.
        self._task_uploading_followup: Task | None = None

services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/modules/outputs/_manager.py:175

  • It would help future maintainers to add a comment here explaining why we retain this task reference (to prevent early garbage collection in the upload-done callback).
            self._task_uploading_followup = create_task(

services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/modules/outputs/_manager.py:186

  • There’s no existing test covering the cancellation of the follow-up task. Consider adding unit tests for _uploading_task_cancel to verify both _task_uploading and _task_uploading_followup are canceled and cleared correctly.
        if self._task_uploading_followup is not None:

@GitHK GitHK added the a:dynamic-sidecar dynamic-sidecar service label Jul 17, 2025
@GitHK GitHK marked this pull request as ready for review July 17, 2025 08:14
Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

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

thanks

@GitHK GitHK added the 🤖-automerge marks PR as ready to be merged for Mergify label Jul 17, 2025
@GitHK
Copy link
Contributor Author

GitHK commented Jul 17, 2025

@Mergifyio queue

@mergify
Copy link
Contributor

mergify bot commented Jul 17, 2025

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 26bc00b

@sonarqubecloud
Copy link

@mergify mergify bot merged commit 26bc00b into ITISFoundation:master Jul 17, 2025
93 of 97 checks passed
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Aug 5, 2025
88 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖-automerge marks PR as ready to be merged for Mergify a:dynamic-sidecar dynamic-sidecar service

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dynamic-sidecar: refactor _uploading_task_start to avoid task being garbage collected and a more robust upload+clean task

4 participants