Hey Artem,
thanks for jumping right at my reported issue and please excuse the long delay in my response.
On 07.11.23 11:27, Artem Goncharov wrote:
you found a deep rabbit hole, it took me 3 hours struggle through the traces to actually understand where this is happening. In the mentioned case an attempt to perform discovery was actually even happening multiple times, what is alone already very wrong. I was never seeing this particular case, because I was always forced to use endpoint_override for Swift anyway.
- when the is no endpoint_override current SDK tries to perform
version discovery for every service. In [1] I changed that to the similar logic used when endpoint_override is actually present
- next time proxy is retrieved from connection SDK again invokes
get_endpoint for it (what in the keystone ends in another discovery)
- next request send in the proxy is again ending doing same
(https://opendev.org/openstack/keystoneauth/src/branch/master/keystoneauth1/s...)
While first 2 cases are happening on the SDK side directly it is possible to get that addressed by using "skip_discovery" flag, but the 3rd one is not trivial. So I actually decided it may be reasonable to set endpoint_override in that case. In my test it helped, but please check this as well.
Excuse me for being slow to grasp all of this, I am still looking through the code of OpenStackSDK, keystoneauth1 and your change to understand the flows that happen ...
1) So for the first case do I understand you (and your change [1]) correctly, that you "check" if the proxy (of lowest version) has skip_discovery=True accordingly the new branch is used to explicitly override the endpoint to circumvent discovery?. That would be logical and straightforward.
The other two sentences I don't quite understand fully ...
2) The second case is about getting a fresh instance proxy, as when switching to project context in my case? Is there still an issue in this case or am I misreading you? Running debug I don't see multiple calls to. 3) Is there still a problem here? It's that what https://review.opendev.org/c/openstack/openstacksdk/+/900280/2/openstack/ser... does? Trying to explicitly set an endpoint override?
One hint to your test source: simply having "project_connection.object_store.containers()" is doing actually nothing at all since all list operations in SDK return generators without going to the server. You need to consume them (at least "list(project_connection.object_store.containers())")
[1] https://review.opendev.org/c/openstack/openstacksdk/+/900280
I hope this helps, but anyway - performing discovery in that case is useless and negatively influences performance, but it is not actually breaking the code (consume generators in your test and you will see it working)
Yeah the code was actually a stripped down version of some other tool we wrote. I wanted to reduce it as much as possible. I should have said that my report was "just" about the warning messages (about discovery) and NOT about it not working at all - because even with the warnings it works in the sense that data is returned.
To me your change works as in no more warnings and no more (multiple) discoveries for object storage. Would you want to add some reviewers to the change to get this reviewed and merged to the SDK then?
Thanks again,
Christian