Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Race condition between TargetIn event in StepRunner and events emission in TestStep

Đang mở
#84 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.

Đá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
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
go
Lĩnh vực
testing-qa

Hướng nghiên cứu

Bắt đầu tại pkg/runner/step_runner.go quanh dòng 193 và theo dõi cách StepRunner gửi các target qua kênh đầu vào của nó, cách TestStep phát ra các event và cách outputLoop xử lý kết quả. Hãy tái hiện hoặc phân tích race condition về thứ tự giữa EventTargetIn và TargetOut hoặc TargetError, sau đó xác định một phương pháp đồng bộ hóa để duy trì thứ tự event bắt buộc và xác minh phương pháp đó bằng bộ test hiện có.

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

Mô tả

bug

The problem raises as we can't atomicly (at least without "ugly" locks in events emission) pass the target to the test step via channel and emit EventTargetIn event.

Currently we are having the following partial work-around:

https://github.com/linuxboot/contest/blob/main/pkg/runner/step_runner.go#L193

// put the target into step runner
case sr.input <- tgt:
// by the time we are hare, the test step could have already processed the target and emitted 100500 events
// test steps rarely emit events, so it is not a big issue. For consistency with TargetOut or TargetError I made this hack:

    // we should always emit TargetIn before TargetOut or TargetError
    // we have a race condition that outputLoop may receive result for this target first
    // in that case we will emit TargetIn in outputLoop and should not emit it here
    sr.mu.Lock()
   if targetInfo.acquireTargetInEmission() {
       if err := emitEvent(ctx, ev, target.EventTargetIn, tgt, nil); err != nil {
           sr.setErrLocked(ctx, fmt.Errorf("failed to report target injection: %w", err))
       }
    }
   sr.mu.Unlock()
Ngôn ngữ chính
Go
Star
20
Fork
17
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

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.

Issue khác của linuxboot/contest

Tất cả issue của linuxboot/contest

Issue tương tự

Thêm issue về Go

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.