Skip to content

Add a timeout to the socket in memray attach #753

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

Merged
merged 1 commit into from
Jul 24, 2025

Conversation

ZeroIntensity
Copy link
Contributor

Issue number of the reported bug or feature request: N/A

Describe your changes
Adds a timeout to memray attach to prevent some rare hangs if the attached Python process crashed or begins finalizing.

Testing performed
Removed this line to simulate the process never attaching.

Additional context
I arbitrarily chose 10 seconds as the timeout. It's probably fine to shorten that, but I don't know how long it usually takes for Memray to connect on slower systems.

cc @godlygeek

@codecov-commenter
Copy link

codecov-commenter commented Apr 14, 2025

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 92.72%. Comparing base (9884c9d) to head (9babce9).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/memray/commands/attach.py 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #753      +/-   ##
==========================================
- Coverage   92.94%   92.72%   -0.22%     
==========================================
  Files          95       95              
  Lines       11686    11690       +4     
  Branches      407      407              
==========================================
- Hits        10861    10839      -22     
- Misses        825      851      +26     
Flag Coverage Δ
cpp 92.72% <60.00%> (-0.22%) ⬇️
python_and_cython 92.72% <60.00%> (-0.22%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@godlygeek godlygeek left a comment

Choose a reason for hiding this comment

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

LGTM

@godlygeek godlygeek enabled auto-merge (rebase) July 24, 2025 02:31
@godlygeek
Copy link
Contributor

Sorry for the delay here, thanks for the contribution @ZeroIntensity!

@godlygeek godlygeek merged commit 1dcf950 into bloomberg:main Jul 24, 2025
18 checks passed
@ZeroIntensity ZeroIntensity deleted the attach-timeout branch July 24, 2025 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants