[BUG] TUI requests not cancelled, causing potential memory leak
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu trong pkg/tui/gui/dispatch.go, đọc TODO quanh dòng 29 và việc sử dụng context.Background() quanh dòng 95. Theo dõi cách các request được tạo trong quá trình chuyển đổi view nhanh và xác định nơi cần đặt việc hủy các request đang chờ. Hoàn thành khi các request bị thay thế được hủy và việc chuyển đổi nhanh không còn khiến các request trước đó tiếp tục chạy trong nền.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
In the TUI code at pkg/tui/gui/dispatch.go, there's a TODO comment on line 29 indicating that request contexts should be tracked and cancelled when new requests come in. Currently, the code on line 95 uses context.Background() which cannot be cancelled.
Impact
When users rapidly switch between views or make multiple requests, previous pending requests continue to run in the background. This can lead to:
- Unnecessary memory usage
- Wasted network bandwidth
- Potential race conditions when outdated responses arrive
Location
File: pkg/tui/gui/dispatch.go
Lines: 29 (TODO comment), 95 (context creation)
Current Code
// Line 29
// TODO: Should these keep track of the context for pending requests
// and cancel previous ones as new ones come in?
// Line 95
g, _ := errgroup.WithContext(context.Background())
Suggested Fix
Implement context cancellation for pending requests:
type RequestManager struct {
cancel context.CancelFunc
mu sync.Mutex
}
func (rm *RequestManager) NewRequest(ctx context.Context) context.Context {
rm.mu.Lock()
defer rm.mu.Unlock()
// Cancel previous request
if rm.cancel != nil {
rm.cancel()
}
// Create new cancellable context
newCtx, cancel := context.WithCancel(ctx)
rm.cancel = cancel
return newCtx
}
Steps to Reproduce
- Open the Doppler TUI
- Rapidly switch between different views
- Monitor network requests - you'll see multiple pending requests
Additional Context
This issue was identified during a security audit of the codebase. While not a security vulnerability, it affects resource management and user experience.
- Ngôn ngữ chính
- Go
- Star
- 400
- Fork
- 87
- Merge trung bình
- 38 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DopplerHQ/cli
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] doppler secrets substitute panics when an environment entry is missing '='Có thể đã có người làm @pvarshh đã nhận 24 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
DopplerHQ/cli#559 · 4 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] `doppler secrets delete` shouldn't re-print every secret in plain textCó thể đã có người làm @paymog đã nhận 14 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
DopplerHQ/cli#542 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của DopplerHQ/cli
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
hyperledger/fabric-x-orderer#1409 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-area
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Azure/typespec-azure#5936 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
-
Fix mode unpins a reusable workflow call when the same repository is also used as a step actionĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
github/gh-actions-lock#261 ·
Maintainer thường phản hồi trong vòng 1 ngày