Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: remove logger field from portforwarder to avoid race with goroutine #2959

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

QxBytes
Copy link
Contributor

@QxBytes QxBytes commented Aug 26, 2024

Reason for Change:

When running pipelines, we pass the testing object into the port forwarder struct. Then, we spawn a go routine and from within it, call the test's logger. This causes a data race in the unit tests, which causes various scenarios to flake. The testing logger is not thread safe and should not be called from within a go routine. Instead, this PR modifies these log statements to use the "log" package, which is thread safe, to log messages from the port forwarding file.

Issue Fixed:

Requirements:

Notes:
Ran the cni release pipeline (where this issue was detected) three times, and the data race error has not shown up. Even during failure, it is not a data race, and the error logs do print: example

@QxBytes QxBytes added cni Related to CNI. fix Fixes something. ci Infra or tooling. needs-backport Change needs to be backported to previous release trains labels Aug 26, 2024
@QxBytes QxBytes self-assigned this Aug 26, 2024
@QxBytes QxBytes marked this pull request as ready for review August 26, 2024 23:26
@QxBytes QxBytes requested a review from a team as a code owner August 26, 2024 23:26
@QxBytes QxBytes requested a review from thomasricci August 26, 2024 23:26
ramiro-gamarra
ramiro-gamarra previously approved these changes Aug 27, 2024
@QxBytes
Copy link
Contributor Author

QxBytes commented Aug 27, 2024

/azp run Azure Container Networking PR

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@QxBytes QxBytes added this pull request to the merge queue Aug 27, 2024
github-merge-queue bot pushed a commit that referenced this pull request Aug 27, 2024
…ne (#2959)

do not pass testing logger into goroutine to avoid race
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 28, 2024
@paulyufan2 paulyufan2 added this pull request to the merge queue Aug 28, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 28, 2024
@QxBytes QxBytes added this pull request to the merge queue Aug 28, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 28, 2024
@QxBytes QxBytes added this pull request to the merge queue Aug 28, 2024
@QxBytes QxBytes removed this pull request from the merge queue due to a manual request Aug 28, 2024
@paulyufan2 paulyufan2 enabled auto-merge August 29, 2024 15:45
@paulyufan2
Copy link
Contributor

/azp run Azure Container Networking PR

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@paulyufan2 paulyufan2 added this pull request to the merge queue Aug 29, 2024
Merged via the queue into master with commit a508336 Aug 29, 2024
14 checks passed
@paulyufan2 paulyufan2 deleted the alew/fix-portforward-race branch August 29, 2024 18:44
QxBytes added a commit that referenced this pull request Aug 29, 2024
…ne (#2959)

* do not pass testing logger into goroutine to avoid race

* fix port forwarder
github-merge-queue bot pushed a commit that referenced this pull request Sep 5, 2024
…th goroutine (#2959) (#2975)

ci: remove logger field from portforwarder to avoid race with goroutine (#2959)

* do not pass testing logger into goroutine to avoid race

* fix port forwarder
QxBytes added a commit that referenced this pull request Dec 12, 2024
…ne (#2959)

* do not pass testing logger into goroutine to avoid race

* fix port forwarder
QxBytes added a commit that referenced this pull request Dec 12, 2024
…ne (#2959)

* do not pass testing logger into goroutine to avoid race

* fix port forwarder
QxBytes added a commit that referenced this pull request Dec 13, 2024
…th goroutine (#2959) (#3264)

ci: remove logger field from portforwarder to avoid race with goroutine (#2959)

* do not pass testing logger into goroutine to avoid race

* fix port forwarder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Infra or tooling. cni Related to CNI. fix Fixes something. needs-backport Change needs to be backported to previous release trains
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants