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

Fixes the problem of multiple tokens for identical URL patterns #1437

Closed
wants to merge 1 commit into from

Conversation

ubuntolog
Copy link
Contributor

I have recently come across a very strange problem while using SetAccessToken port command. From my application I was updating an access token, however, IGV kept using the old token. The problem could not be reproduced consistently. Fortunately, I was able to track it down to accessTokens HashMap. The variable uses a Pattern object as a key, which allows to have an arbitrary number of identical URL patterns for different tokens (still valid and already expired ones). Since HashMap is not sorted, sometimes it may return correct tokens, but very often it will give you expired ones. Expired tokens are stored indefinitely and are not overwritten by the new ones.
This pull request offers a solution to the described problem by introducing another HashMap and by storing the Pattern object as a value.

@jrobinso
Copy link
Contributor

jrobinso commented Dec 1, 2023

Thanks for the report and PR. I would like to propose a different solution, using a LIFO queue, see #1453. The use of a map here as a container for pairs was never really appropriate. The alternate PR leaves the stale access tokens in the queue, they could be removed with a bit more coding, but they should never be accessed.

@ubuntolog
Copy link
Contributor Author

Your solution seems to be a more elegant alternative. According to the documentation (I never used Deque), it should do the job. A queue is a better data structure for this task, code is more readable, and we do not need an extra variable. I will test it locally and let you know, if I find problems. Thank you

@ubuntolog
Copy link
Contributor Author

ubuntolog commented Dec 1, 2023

Changes from #1453 seem to work as expected.

@ubuntolog ubuntolog closed this Dec 1, 2023
jrobinso added a commit that referenced this pull request Dec 1, 2023
…1453)

* Fix problem of stale access tokens with a LIFO queue -- see PR #1437
jrobinso added a commit that referenced this pull request Dec 4, 2023
…1453)

* Fix problem of stale access tokens with a LIFO queue -- see PR #1437
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.

2 participants