Skip to content

Fix controller proxies after the client is garbage collected - #167

Merged
RazerM merged 1 commit into
mainfrom
feature/proxy-ref
Aug 23, 2026
Merged

Fix controller proxies after the client is garbage collected#167
RazerM merged 1 commit into
mainfrom
feature/proxy-ref

Conversation

@RazerM

@RazerM RazerM commented Aug 22, 2026

Copy link
Copy Markdown
Member

The proxy stored weakref.proxy(client), but nothing else kept the
client alive, so the one-expression idiom
SpaceTrackClient(...).basicspacedata.gp(...) collected the client
mid-expression and raised ReferenceError, and hasattr/getattr on a
proxy that outlived its client raised ReferenceError instead of
reporting the attribute missing. The client-to-proxy reference cycle
this creates is handled by the garbage collector, and the finalizer
still fires because it does not reference the instance.

@RazerM RazerM changed the title Hold a strong reference to the client in _ControllerProxy Fix controller proxies after the client is garbage collected Aug 22, 2026
@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.29%. Comparing base (168de31) to head (51e72ae).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #167      +/-   ##
==========================================
+ Coverage   96.33%   98.29%   +1.96%     
==========================================
  Files           7        7              
  Lines        1147     1293     +146     
  Branches      129      135       +6     
==========================================
+ Hits         1105     1271     +166     
+ Misses         25       12      -13     
+ Partials       17       10       -7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RazerM
RazerM force-pushed the feature/proxy-ref branch 2 times, most recently from 6da685d to 4a1a3f1 Compare August 23, 2026 13:09
The proxy stored weakref.proxy(client), but nothing else kept the
client alive, so the one-expression idiom
SpaceTrackClient(...).basicspacedata.gp(...) collected the client
mid-expression and raised ReferenceError, and hasattr/getattr on a
proxy that outlived its client raised ReferenceError instead of
reporting the attribute missing. The client-to-proxy reference cycle
this creates is handled by the garbage collector, and the finalizer
still fires because it does not reference the instance.
@RazerM
RazerM force-pushed the feature/proxy-ref branch from 4a1a3f1 to 51e72ae Compare August 23, 2026 14:00
@RazerM
RazerM merged commit b12acf5 into main Aug 23, 2026
11 checks passed
@RazerM
RazerM deleted the feature/proxy-ref branch August 23, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant