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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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 75.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 92.90%. Comparing base (41248ed) to head (4e18dd6).
Report is 168 commits behind head on main.

Files with missing lines Patch % Lines
src/memray/commands/attach.py 75.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #753      +/-   ##
==========================================
+ Coverage   92.55%   92.90%   +0.35%     
==========================================
  Files          91       95       +4     
  Lines       11304    11691     +387     
  Branches     1581      407    -1174     
==========================================
+ Hits        10462    10862     +400     
+ Misses        837      829       -8     
+ Partials        5        0       -5     
Flag Coverage Δ
cpp 92.90% <75.00%> (+6.96%) ⬆️
python_and_cython 92.90% <75.00%> (-2.82%) ⬇️

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.

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.

2 participants