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

race-condition in servicesManager #667

Open
chris-tian89 opened this issue Oct 24, 2022 · 0 comments
Open

race-condition in servicesManager #667

chris-tian89 opened this issue Oct 24, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@chris-tian89
Copy link

chris-tian89 commented Oct 24, 2022

Describe the bug

The usage of the artifactory servicesManager Object in go-rutines leads to race-conditions, because it contains the *http.client as a pointer. In concurrent go-rutines those go-rutines are writing to this *http.client in parallel which causes the race-conditions.

newer version v1.24.0 has no change regarding this code.

Current behavior

Currently the race happens in github.com/jfrog/jfrog-client-go@v1.23.4/http/httpclient/client.go at line

  • 148: jc.client.CheckRedirect = func(...)
  • 155: jc.client.CheckRedirect = nil

Reproduction steps

  • create a servicesManager like servicesManager, err := artifactory.New(serviceConfig)
  • use a servicesManager-function within a go-routine like servicesManager.CreateUser(userParams) or servicesManager.UpdatePermissionTarget(params) or servicesManager.CreatePermissionTarget(params)

Expected behavior

A solution could be a logical check if a user has set a custom CheckRedirect-function, and if yes (so if it is not nil), no change must be made to that field any more, in order to prevent concurent access of multiple go-rutines. If no custom-value is set by the user the client can behave like today.

JFrog Client-Go version

1.23.4

JFrog CLI version (if applicable)

No response

Operating system type and version

Windows 10

JFrog Artifactory version

No response

JFrog Xray version

No response

@chris-tian89 chris-tian89 added the bug Something isn't working label Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant