Skip to content

Conversation

@birkjernstrom
Copy link
Member

No description provided.

@vercel
Copy link

vercel bot commented Dec 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Review Updated (UTC)
polar Ignored Ignored Preview Dec 14, 2025 0:06am
polar-sandbox Ignored Ignored Preview Dec 14, 2025 0:06am

@birkjernstrom birkjernstrom changed the title worker: Log task memory consumption > 50MB worker: MemoryTraceMiddleware using tracemalloc Dec 14, 2025
Copy link
Contributor

@Yopi Yopi left a comment

Choose a reason for hiding this comment

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

I think this will be useful to get out

if not self.enabled:
return

self._before_message = tracemalloc.take_snapshot()
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to store these in a thread safe way, either in a thread local variable or on the message. E.g.

message.options['_memory_snapshot'] = tracemalloc.take_snapshot()

Alterantively in __init__ we could do

self._state = threading.local()

and store it there

@frankie567 frankie567 closed this Jan 5, 2026
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.

4 participants