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

Thread safety issue? #9

Open
dmazin-drw opened this issue May 7, 2024 · 0 comments · May be fixed by #10
Open

Thread safety issue? #9

dmazin-drw opened this issue May 7, 2024 · 0 comments · May be fixed by #10

Comments

@dmazin-drw
Copy link

dmazin-drw commented May 7, 2024

Hi there,

If we issue a bunch of requests for different servers like so:

hosts=(server1 server2)
for host in "${hosts[@]}"; do
    curl -s "http://${RF_HOST}/health?target=$host-idrac&job=redfish" &
done

(note the & at the end of the curl command)

Then we run into an issue where the collector actually only talks to one of the hosts, regardless of the hostname.

I think this is because of a thread safety issue in handler.py.
Even though the app is multithreaded, the same instance of metricsHandler is used for all requests (this is correct behavior).
However, on_get function references self, which means that the requests clobber each other's values.

Specifically, this is a problem for the code that translates hostnames to IPs and vice-versa.
Removing references to self in on_get fixes the issue.

Can you please let me know if I am off base here, or if this makes sense to you?

@dmazin dmazin linked a pull request May 24, 2024 that will close this issue
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 a pull request may close this issue.

1 participant