adobe / adobe/rules_gitops

Race condition in it_sidecar

Offen
#130 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Starlark
Sterne
208
Forks
45
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

@harjsing7 reported a race condition in a sidecar on pod removal.
```
2023-03-22T05:44:02Z | INFO | 2023/03/22 05:44:02 panic: close of closed channel
2023-03-22T05:44:02Z | INFO | 2023/03/22 05:44:02
2023-03-22T05:44:02Z | INFO | 2023/03/22 05:44:02 goroutine 108 [running]:
2023-03-22T05:44:02Z | INFO | 2023/03/22 05:44:02 github.com/adobe/rules_gitops/testing/it_sidecar/stern.(*Tail).Start.func2()
2023-03-22T05:44:02Z | INFO | 2023/03/22 05:44:02 external/com_adobe_rules_gitops/testing/it_sidecar/stern/tail.go:86 +0x45
2023-03-22T05:44:02Z | INFO | 2023/03/22 05:44:02 created by github.com/adobe/rules_gitops/testing/it_sidecar/stern.(*Tail).Start
2023-03-22T05:44:02Z | INFO | 2023/03/22 05:44:02 external/com_adobe_rules_gitops/testing/it_sidecar/stern/tail.go:84 +0x12b
2023-03-22T05:44:02Z | INFO | 2023/03/22 05:44:02 exit status 2
```
The closing of the channel can happen in two spots:
https://github.com/adobe/rules_gitops/blob/eafc9c3e0eac03f9487abb22e3b735c47ff1a043/testing/it_sidecar/stern/tail.go#L86
https://github.com/adobe/rules_gitops/blob/eafc9c3e0eac03f9487abb22e3b735c47ff1a043/testing/it_sidecar/stern/main.go#L56

We need to handle this situation properly, using cancellable context would be appropriate here
Also, we should add a warning in a log on pod deletion, since it is typically an indication of a problem in the test - like pod crashlooping or even early test failure (configurable)

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start with testing/it_sidecar/stern/tail.go at line 86 and testing/it_sidecar/stern/main.go at line 56, where the channel is closed during pod removal. Trace the sidecar shutdown path and the existing pod-deletion logging, then run the relevant integration test. Done means pod removal no longer panics from closing the channel and emits a warning when deletion indicates a possible test problem.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
go, kubernetes
Bereich
devops, testing-qa
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.