python / python/cpython

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

Đang mở
#121,443 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

type-feature
Ngôn ngữ chính
Python
Star
77.2k
Fork
35.9k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng việc xem xét đề xuất này và issue liên quan #60585, sau đó so sánh hành vi được yêu cầu với tùy chọn Java xử lý sự cố được liên kết. Xác định giao diện dòng lệnh, ngữ nghĩa của heap dump và stack dump, cũng như hành vi của MemoryError trước khi triển khai; công việc được xem là hoàn tất khi có thiết kế được chấp nhận và các bài kiểm thử cho tùy chọn mới.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
cli, tooling
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.