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

lock names: Remove uid suffix & hash entire path #6059

Merged
merged 7 commits into from
Dec 11, 2019

Conversation

tstromberg
Copy link
Contributor

@tstromberg tstromberg commented Dec 11, 2019

This PR makes lock names unique again for Windows users.

Currently, we generate lock names by taking the last 39 characters of:

fmt.Sprintf("%s-%s", path, uid))

On most platforms, uid's are 0-6 characters long. However, on Windows, a SID is returned, which looks like:

S-1-5-21-1180699209-877415012-3182924384-1004

That's 46 characters long. Effectively, on Windows, all of our locks shared the same name:

m21-1180699209-877415012-3182924384

Why was the UID added anyways? Because we used to assign lock names based on a descripter, like "kubeConfig", and we wanted multiple users to be able to run minikube simultaneously. Now that we only generate locks on a path name, this is no longer necessary, as we actually do want to lock a file if multiple users try to update it.

Fixes #6058

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 11, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tstromberg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 11, 2019
@tstromberg
Copy link
Contributor Author

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Dec 11, 2019
@minikube-bot
Copy link
Collaborator

Error: running mkcmp: exit status 1

@tstromberg tstromberg changed the title Use md5 to generate unique lock names Generate unique lock names via checksum Dec 11, 2019
@codecov-io
Copy link

codecov-io commented Dec 11, 2019

Codecov Report

Merging #6059 into master will decrease coverage by 0.03%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #6059      +/-   ##
=========================================
- Coverage   36.74%   36.7%   -0.04%     
=========================================
  Files         113     113              
  Lines        8366    8355      -11     
=========================================
- Hits         3074    3067       -7     
+ Misses       4890    4887       -3     
+ Partials      402     401       -1
Impacted Files Coverage Δ
pkg/minikube/kubeconfig/settings.go 64.81% <100%> (ø) ⬆️
pkg/minikube/bootstrapper/certs.go 75.25% <100%> (ø) ⬆️
pkg/util/lock/lock.go 41.17% <33.33%> (-8.83%) ⬇️

@minikube-bot
Copy link
Collaborator

All Times minikube: [ 127.604308 130.908744 127.251100]
All Times Minikube (PR 6059): [ 127.944323 128.706528 125.571980]

Average minikube: 128.588051
Average Minikube (PR 6059): 127.407610

Averages Time Per Log

+----------------------+-----------+--------------------+
|         LOG          | MINIKUBE  | MINIKUBE (PR 6059) |
+----------------------+-----------+--------------------+
| minikube v           |  0.278992 |           0.279004 |
| Creating kvm2        | 49.790154 |          48.040097 |
| Preparing Kubernetes | 51.770099 |          51.245501 |
| Pulling images       |  2.765938 |           3.389353 |
| Launching Kubernetes | 21.337014 |          21.485065 |
| Waiting for cluster  |  2.596055 |           2.917906 |
+----------------------+-----------+--------------------+

@minikube-bot
Copy link
Collaborator

All Times minikube: [ 126.190235 126.979790 128.087883]
All Times Minikube (PR 6059): [ 128.101241 125.874494 127.215820]

Average minikube: 127.085969
Average Minikube (PR 6059): 127.063851

Averages Time Per Log

+----------------------+-----------+--------------------+
|         LOG          | MINIKUBE  | MINIKUBE (PR 6059) |
+----------------------+-----------+--------------------+
| minikube v           |  0.274026 |           0.276365 |
| Creating kvm2        | 48.627733 |          47.296535 |
| Preparing Kubernetes | 51.345713 |          52.086880 |
| Pulling images       |  3.098376 |           3.161714 |
| Launching Kubernetes | 20.958029 |          21.447277 |
| Waiting for cluster  |  2.732127 |           2.745347 |
+----------------------+-----------+--------------------+

@medyagh
Copy link
Member

medyagh commented Dec 11, 2019

maybe add a description to the PR that why you think it fixes the issue ?

@sharifelgamal
Copy link
Collaborator

ok to test

@tstromberg tstromberg changed the title Generate unique lock names via checksum Fix lock name generation by removing uid and hashing the path Dec 11, 2019
@tstromberg tstromberg changed the title Fix lock name generation by removing uid and hashing the path lock name generation: Remove uid suffix & hash the entire path Dec 11, 2019
@tstromberg tstromberg changed the title lock name generation: Remove uid suffix & hash the entire path lock names: Remove uid suffix & hash the entire path Dec 11, 2019
@minikube-bot
Copy link
Collaborator

All Times minikube: [ 129.505926 126.133423 113.651865]
All Times Minikube (PR 6059): [ 127.121494 127.868825 127.814676]

Average minikube: 123.097071
Average Minikube (PR 6059): 127.601665

Averages Time Per Log

+----------------------+-----------+--------------------+
|         LOG          | MINIKUBE  | MINIKUBE (PR 6059) |
+----------------------+-----------+--------------------+
| minikube v           |  0.282188 |           0.283870 |
| Creating kvm2        | 48.525958 |          47.563997 |
| Preparing Kubernetes | 48.113624 |          52.490516 |
| Pulling images       |  3.028203 |           3.159913 |
| Launching Kubernetes | 20.477955 |          21.155682 |
| Waiting for cluster  |  2.619155 |           2.895266 |
+----------------------+-----------+--------------------+

@tstromberg tstromberg changed the title lock names: Remove uid suffix & hash the entire path lock names: Remove uid suffix & hash entire path Dec 11, 2019
@minikube-bot
Copy link
Collaborator

All Times minikube: [ 132.483634 125.859874 127.080990]
All Times Minikube (PR 6059): [ 113.841001 125.400895 127.009401]

Average minikube: 128.474833
Average Minikube (PR 6059): 122.083766

Averages Time Per Log

+----------------------+-----------+--------------------+
|         LOG          | MINIKUBE  | MINIKUBE (PR 6059) |
+----------------------+-----------+--------------------+
| minikube v           |  0.275496 |           0.278832 |
| Creating kvm2        | 48.901489 |          47.157970 |
| Preparing Kubernetes | 52.357620 |          48.457573 |
| Pulling images       |  2.736398 |           2.919455 |
| Launching Kubernetes | 21.242898 |          20.589065 |
| Waiting for cluster  |  2.910510 |           2.630382 |
+----------------------+-----------+--------------------+

Copy link
Collaborator

@sharifelgamal sharifelgamal left a comment

Choose a reason for hiding this comment

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

I like this a lot more conceptually.

@tstromberg tstromberg merged commit 8d3fed0 into kubernetes:master Dec 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Win10: error acquiring lock for C:\Users<username>/.kube/config: timeout acquiring mutex
6 participants