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

fsxwindowsfileserver: fixing task concurrency issues #2690

Merged
merged 1 commit into from
Oct 27, 2020
Merged

Conversation

singholt
Copy link
Contributor

Summary

This change fixes task concurrency issues with drive letter assignment during fsxwindowsfileserver task resource initialization.

Implementation details

  1. Moved drive letter assignment to performHostMount method.
  2. Added a mutex lock for performHostMount() method.

Testing

Launched 10 tasks concurrently and each of them gets its own drive letter now.

Description for the changelog

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@singholt singholt requested review from fenxiong, a team and vsiddharth October 23, 2020 22:28
@singholt singholt added this to the 1.47.0 milestone Oct 23, 2020
@@ -519,9 +515,34 @@ func (fv *FSxWindowsFileServerResource) retrieveFileSystemDNSName(fileSystemId s
return nil
}

var mountLock sync.Mutex
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need an additional lock while performing hostMount? Please add a comment to explain the rationale. Also, why is this outside the resource encapsulation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add a comment for this

var execCommand = exec.Command

func (fv *FSxWindowsFileServerResource) performHostMount(remotePath string, localPathArg string, username string, password string) error {
func (fv *FSxWindowsFileServerResource) performHostMount(remotePath string, username string, password string) error {
mountLock.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a comment here documenting why a package level lock is needed here? so that we don't lose context on why this was added

Copy link
Contributor

Choose a reason for hiding this comment

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

does this delay the resource creation for fsx tasks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ran 10 tasks together and noticed about half a second delay between tasks transitioning into running state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add a comment to add some context

@fenxiong fenxiong merged commit e06c355 into aws:dev Oct 27, 2020
@mythri-garaga mythri-garaga mentioned this pull request Oct 28, 2020
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.

7 participants