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

Fix bug when connecting to multiple servers #86

Merged
merged 44 commits into from
May 7, 2024

Conversation

Rdornier
Copy link
Contributor

Hello @dominikl, @jburel

I have an unexpected behavior when I'm connecting to 2 different omero servers.
First, I'm connecting to one server (e.g server1) ; the gateway and context are initialized correctly. Then, I get for the AdminFacility and BrowseFacility instance to retreive some images and check if the current user is admin or not.

Then, I'm connecting to the second server (e.g server2). A new gateway is initiliazed, as well as a new Security context. Everything is fine until I get the AdminFacility. At that point, a connection error is raised, which is a bit unexpected as the gateway.connect(cred) works fine.

The cause of the connection error seems to be the hostname. When connecting to server2,

  • before calling gateway.getFacility(AdminFacility.class), the hostname in the attached security context is server2
  • after calling gateway.getFacility(AdminFacility.class), the hostname in the attached security context is server1

It takes me quite some time to understand why the swapping is happening but I finally manage to find what causes this issue.
On this line, the requested facilities are got from the cache (which is a good thing by the way) but they are got only based on their name ; there is no information about the server from which they come from. So, by default, when I request the AdminFacility on server2, it returns me the AdminFacility from server1 i.e. the first cached object.

So, I just added, in the key, the hostname of the server and everything worked correctly. I also added a public method to get the hostname from the Gateway object.

Rémy

@dominikl
Copy link
Member

Thank you very much for your contributions @Rdornier . I'd just slightly change the error message, apart from that I think it's good to merge? Any objections @jburel ?

@Rdornier
Copy link
Contributor Author

Thanks for your quick validation !

Copy link
Member

@dominikl dominikl left a comment

Choose a reason for hiding this comment

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

👍

@jburel jburel closed this May 7, 2024
@jburel jburel reopened this May 7, 2024
jburel and others added 22 commits May 7, 2024 14:18
Since 2003, this codebase has substantially grown thanks to the
input of several tens of contributors. Over two decades, commits
from the same author are associated with multiple variants of the
author line. In order to effectively review and audit contributions,
it is necessary to normalize this variant.

This commit attempts to do so by using the Git mailmap functionality
to associate all commits from the same individual to a single
First Name Last Name <email> form. When applicable, either the
University of Dundee or the Glencoe Software email address is used
as the canonical address.
Co-authored-by: Dominik Lindner <[email protected]>
@jburel jburel closed this May 7, 2024
@jburel jburel reopened this May 7, 2024
@jburel jburel merged commit 0142594 into ome:master May 7, 2024
8 checks passed
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.

4 participants