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

Fixes for data races in logs #1125

Merged

Conversation

Mixaster995
Copy link
Contributor

Signed-off-by: Mikhail Avramenko avramenkomihail15@gmail.com

Description

Refactored usage of log fields to prevent data races

Issue link

fixes networkservicemesh/cmd-forwarder-vpp#372

How Has This Been Tested?

  • Added unit testing to cover
  • Tested manually
  • Tested by integration testing
  • Have not tested

Types of changes

  • Bug fix
  • New functionallity
  • Documentation
  • Refactoring
  • CI

@Mixaster995 Mixaster995 changed the title used immutable pattern Used immutable pattern for log.Fields() Oct 28, 2021
@Mixaster995 Mixaster995 force-pushed the bug/fix-data-race branch 7 times, most recently from 35041ec to 3fdb382 Compare October 29, 2021 10:40
@@ -38,7 +38,7 @@ import (
func TestCreateEndpointDuringRequest(t *testing.T) {
t.Cleanup(func() { goleak.VerifyNone(t) })

ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5*10)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we suddenly 10x-ing all of the timeouts? What are we doing that is bloating the latency by 10x?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems, that enabling full logs in tests running with race flag, increases time for tests. That's not something i'm going to actually push to sdk code, some changes only have been made for testing, so i'm converted this PR to draft, until it's ready.

@Mixaster995 Mixaster995 marked this pull request as draft October 31, 2021 04:57
@Mixaster995 Mixaster995 force-pushed the bug/fix-data-race branch 4 times, most recently from eae57ad to eb9653e Compare November 1, 2021 08:55
@Mixaster995 Mixaster995 changed the title Used immutable pattern for log.Fields() Fixes for data races in logs Nov 1, 2021
Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>
Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>
@Mixaster995 Mixaster995 force-pushed the bug/fix-data-race branch 6 times, most recently from dfe7b40 to eaceefe Compare November 1, 2021 12:57
Copy link
Member

@denis-tingaikin denis-tingaikin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Could you remove all debug changes?

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>
@Mixaster995 Mixaster995 marked this pull request as ready for review November 2, 2021 04:09
@Mixaster995
Copy link
Contributor Author

@denis-tingaikin removed all unrelated changes from PR

@denis-tingaikin denis-tingaikin merged commit 0a90a22 into networkservicemesh:main Nov 2, 2021
nsmbot pushed a commit to networkservicemesh/cmd-nsmgr-proxy that referenced this pull request Nov 2, 2021
…k@main

PR link: networkservicemesh/sdk#1125

Commit: 0a90a22
Author: Авраменко Михаил
Date: 2021-11-02 12:54:45 +0700
Message:
  - Fixes for data races in logs (#1125)
* added logging infrustructure in tests to catch races

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* added set log options to registry chains

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* changed context in heal to prevent data races

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
nsmbot pushed a commit to networkservicemesh/cmd-registry-memory that referenced this pull request Nov 2, 2021
…k@main

PR link: networkservicemesh/sdk#1125

Commit: 0a90a22
Author: Авраменко Михаил
Date: 2021-11-02 12:54:45 +0700
Message:
  - Fixes for data races in logs (#1125)
* added logging infrustructure in tests to catch races

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* added set log options to registry chains

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* changed context in heal to prevent data races

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
nsmbot pushed a commit to networkservicemesh/cmd-nse-vfio that referenced this pull request Nov 2, 2021
…k@main

PR link: networkservicemesh/sdk#1125

Commit: 0a90a22
Author: Авраменко Михаил
Date: 2021-11-02 12:54:45 +0700
Message:
  - Fixes for data races in logs (#1125)
* added logging infrustructure in tests to catch races

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* added set log options to registry chains

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* changed context in heal to prevent data races

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
nsmbot pushed a commit to networkservicemesh/cmd-nsc-init that referenced this pull request Nov 2, 2021
…k@main

PR link: networkservicemesh/sdk#1125

Commit: 0a90a22
Author: Авраменко Михаил
Date: 2021-11-02 12:54:45 +0700
Message:
  - Fixes for data races in logs (#1125)
* added logging infrustructure in tests to catch races

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* added set log options to registry chains

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* changed context in heal to prevent data races

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
nsmbot pushed a commit to networkservicemesh/sdk-k8s that referenced this pull request Nov 2, 2021
…k@main

PR link: networkservicemesh/sdk#1125

Commit: 0a90a22
Author: Авраменко Михаил
Date: 2021-11-02 12:54:45 +0700
Message:
  - Fixes for data races in logs (#1125)
* added logging infrustructure in tests to catch races

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* added set log options to registry chains

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* changed context in heal to prevent data races

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
nsmbot pushed a commit to networkservicemesh/cmd-registry-proxy-dns that referenced this pull request Nov 2, 2021
…k@main

PR link: networkservicemesh/sdk#1125

Commit: 0a90a22
Author: Авраменко Михаил
Date: 2021-11-02 12:54:45 +0700
Message:
  - Fixes for data races in logs (#1125)
* added logging infrustructure in tests to catch races

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* added set log options to registry chains

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* changed context in heal to prevent data races

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
nsmbot pushed a commit to networkservicemesh/cmd-nsmgr that referenced this pull request Nov 2, 2021
…k@main

PR link: networkservicemesh/sdk#1125

Commit: 0a90a22
Author: Авраменко Михаил
Date: 2021-11-02 12:54:45 +0700
Message:
  - Fixes for data races in logs (#1125)
* added logging infrustructure in tests to catch races

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* added set log options to registry chains

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* changed context in heal to prevent data races

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
nsmbot pushed a commit to networkservicemesh/sdk-kernel that referenced this pull request Nov 2, 2021
…k@main

PR link: networkservicemesh/sdk#1125

Commit: 0a90a22
Author: Авраменко Михаил
Date: 2021-11-02 12:54:45 +0700
Message:
  - Fixes for data races in logs (#1125)
* added logging infrustructure in tests to catch races

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* added set log options to registry chains

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* changed context in heal to prevent data races

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
@Mixaster995 Mixaster995 deleted the bug/fix-data-race branch November 2, 2021 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants