python / python/cpython

Support add new -X option to dump heap and current stack automaticlly when MemoryError has been raised

未關閉
#121,443 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

type-feature
主要語言
Python
星號
77.2k
分支
36k
PR 合併指標
PR 指標待擷取

描述

Feature or enhancement

Proposal:

This idea may be similar to #60585

In the production environment, the memory leak is a common issue for all the developers. For now, we may have two kinds of way to debug it.

  1. Intrusive way, we need to modify our code, inject some code to monitor the object malloc, and publish/deploy it again. It will use a lot of time in non-python-code process.
  2. Process attach way, we may use the tools like py-spy or other ptrace based way to attach to the process, and dump/analyze the all memory. It's useful but will be limited in the container. For most circumstance, we limit the privilege of the container which is means that the ptrace based way will be unuseable because of the security issue.

I think maybe we can introduce a new -x option to dump heap and current stack automaticlly when MemoryError has been raised just like the developer did in JVM

FYI https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/clopts001.html

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

首先檢閱此提案和相關 issue #60585,然後將要求的行為與連結的 Java 疑難排解選項進行比較。在實作之前,定義命令列介面、堆積和堆疊傾印語意以及 MemoryError 行為;新選項具有已接受的設計和測試後,才算完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
cli, tooling
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
需要釐清
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。