Race in gateway/apps tests: scanner.New called concurrently from parallel tests
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ó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 84/100
Hướng nghiên cứu
Đọc internal/gateway/apps/ai_secrets_test.go, đặc biệt là secretsFixture, và kiểm tra cách các bài kiểm thử chạy song song lấy scanner. Issue đề xuất chia sẻ một scanner cho mỗi package bằng sync.OnceValues; hãy xác minh rằng Scanner hỗ trợ sử dụng đồng thời như được mô tả. Chạy go test -race ./internal/gateway/apps nhiều lần và xác nhận race không còn xuất hiện.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
go test -race ./internal/gateway/apps fails now and then with DATA RACE in tests that have nothing in common, such as TestExplainOfAHealthyAppIsRefused, TestTemplateListCarriesMaxSharing and TestNonMemberCannotCreate. Locally it failed 2 of 7 runs. CI has been green, so it may only show up under load.
The race is two goroutines writing viper's global config:
Write at ... by goroutine 61:
github.com/spf13/viper.(*Viper).SetConfigType() [email protected]/viper.go:2189
github.com/zricethezav/gitleaks/v8/detect.NewDetectorDefaultConfig() detect.go:136
github.com/nebari-dev/javo/internal/ai/redact/scanner.New() scanner.go:32
.../gateway/apps_test.secretsFixture() ai_secrets_test.go:22
.../gateway/apps_test.TestInjectedLogTextChangesNothing() ai_injection_test.go:20
Previous write ... by goroutine 62:
... same path via TestExplainBundleIsShownOnlyToTheOwner() ai_secrets_test.go:58
scanner.New says "Call it once at start-up: the rules are parsed through viper's global instance" (internal/ai/redact/scanner/scanner.go:29-30). The gateway does call it once. The test helper secretsFixture (internal/gateway/apps/ai_secrets_test.go:20) calls it for every test, and those tests run with t.Parallel(), so two of them can parse gitleaks' rules at the same time. When the race detector fires, it fails whichever tests are running then, which is why the failing names vary.
Production is not affected. The fix is in the tests: build one scanner per package (for example with sync.OnceValues in the test file) and share it, since Scanner already guards its detector with a mutex. Making New itself safe to call concurrently would also work, but it would hide the "once at start-up" contract instead of keeping it.
- Ngôn ngữ chính
- Go
- Star
- 5
- Fork
- 0
- Merge trung bình
- 21 giờ 13 phút
- Pull request đã merge (30 ngày)
- 53
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọ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 nebari-dev/tapas
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
nebari-dev/tapas#124 ·
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
nebari-dev/tapas#121 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Suggest saving a memory when a chat message holds something worth rememberingCó thể đã có người làm @jbouder đã nhận hôm nay. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
nebari-dev/tapas#137 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 54/100
nebari-dev/tapas#136 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
type: enhancement 💅🏼
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
nebari-dev/tapas#133 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của nebari-dev/tapas
Issue tương tự
-
--auto-tier: hashing, dedup, resume validation and DVC/git reads still update atime on LinuxĐang mởarea: pipeline priority: low type: bug
Độ 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
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
prime-radiant-inc/evener#8335 ·
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 74/100
-
ui: OnTextKey on SearchField never sees keys (it does not reach the inner input)Có thể đã có người làm @szluyu99 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
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 76/100