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

Group not found in list after creation #26983

Closed
1 task done
stianst opened this issue Feb 13, 2024 · 2 comments · Fixed by #27289 · May be fixed by #26997
Closed
1 task done

Group not found in list after creation #26983

stianst opened this issue Feb 13, 2024 · 2 comments · Fixed by #27289 · May be fixed by #26997
Assignees
Labels
area/core kind/bug Categorizes a PR related to a bug priority/blocker Highest Priority. Has a deadline and it blocks other tasks release/24.0.0 team/core-iam
Milestone

Comments

@stianst
Copy link
Contributor

stianst commented Feb 13, 2024

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

core

Describe the bug

ConcurrencyTest#createGroup started failing on the 27th October 2023, which was the day after 6949738 was merged.

The error is that a newly created group is not found in the group list:

2024-02-13T07:58:05.2629139Z ConcurrencyTest ++ java.lang.AssertionError: Group g-79 [affcccbf-f981-43a0-8f85-48dd664a9c87]  not found in group list
2024-02-13T07:58:05.2630974Z ConcurrencyTest ++ 	at org.junit.Assert.fail(Assert.java:89)
2024-02-13T07:58:05.2631978Z ConcurrencyTest ++ 	at org.junit.Assert.assertTrue(Assert.java:42)
2024-02-13T07:58:05.2633037Z ConcurrencyTest ++ 	at org.junit.Assert.assertFalse(Assert.java:65)
2024-02-13T07:58:05.2634509Z ConcurrencyTest ++ 	at org.keycloak.testsuite.admin.concurrency.ConcurrencyTest$CreateGroup.run(ConcurrencyTest.java:248)
2024-02-13T07:58:05.2637014Z ConcurrencyTest ++ 	at org.keycloak.testsuite.admin.concurrency.AbstractConcurrencyTest.lambda$run$0(AbstractConcurrencyTest.java:94)
2024-02-13T07:58:05.2638885Z ConcurrencyTest ++ 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
2024-02-13T07:58:05.2640522Z ConcurrencyTest ++ 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
2024-02-13T07:58:05.2642345Z ConcurrencyTest ++ 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
2024-02-13T07:58:05.2643793Z ConcurrencyTest ++ 	at java.base/java.lang.Thread.run(Thread.java:840)

The mentioned PR also introduced a hack to retry listing the groups after the group was created:

boolean retry = true;
int i = 0;
do {
List<String> groups = realm.groups().groups().stream()
.map(GroupRepresentation::getName)
.filter(Objects::nonNull)
.collect(Collectors.toList());
retry = !groups.contains(name);
i++;
} while(retry && i < 3);
assertFalse("Group " + name + " [" + id + "] " + " not found in group list", retry);

However, this should not be needed the group should be available immediately. As a side-note the retry mechanism above has no wait in-between the retries, so will just pull the endpoint many times in a row.

Version

main

Expected behavior

Groups are available in the list after they have been created

Actual behavior

Groups are not available in the list even after retrying several times

How to Reproduce?

Run ConcurrencyTest.createGroup, or view results from #24337

Anything else?

No response

@alice-wondered
Copy link
Contributor

To help with debugging: When I added this I was trying to correct for a non-repeatable read that was occurring during the concurrency tests where stale data was being grabbed. At the time that resolved the issue and it passed the tests and checks

I'll take a look at the test again and revert/see if I can't also provide more info

alice-wondered added a commit to alice-wondered/keycloak that referenced this issue Feb 13, 2024
…aibilty work. Notably this fails on local and potentially on GHA. Adding a thread sleep of one second between creation and read fixes the failure pointing to non-repeatable read issue of stale data

Signed-off-by: Alice W <105500542+alice-wondered@users.noreply.github.com>
alice-wondered added a commit to alice-wondered/keycloak that referenced this issue Feb 13, 2024
…caching, and limits on what the cache keys are capable of. Prevents stale reads from cache for top level group queries

Signed-off-by: Alice W <105500542+alice-wondered@users.noreply.github.com>
alice-wondered added a commit to alice-wondered/keycloak that referenced this issue Feb 13, 2024
…caching, and limits on what the cache keys are capable of. Prevents stale reads from cache for top level group queries

Signed-off-by: Alice W <105500542+alice-wondered@users.noreply.github.com>
@alice-wondered
Copy link
Contributor

I've gained a lot more understanding of the infinispan workings on this project and discovered a pretty hidden bug while trying to resolve this issue.

The issue relating specifically to that bug is linked above and should help to update the solution for this issue to preserve the pagination cache entry as well

@pedroigor pedroigor assigned pedroigor and martin-kanis and unassigned pedroigor Feb 19, 2024
pedroigor added a commit to pedroigor/keycloak that referenced this issue Feb 28, 2024
Closes keycloak#26983

Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
pedroigor added a commit to pedroigor/keycloak that referenced this issue Feb 28, 2024
Closes keycloak#26983

Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
pedroigor added a commit to pedroigor/keycloak that referenced this issue Feb 28, 2024
Closes keycloak#26983

Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
pedroigor added a commit to pedroigor/keycloak that referenced this issue Feb 28, 2024
Closes keycloak#26983

Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
pedroigor added a commit to pedroigor/keycloak that referenced this issue Feb 28, 2024
Closes keycloak#26983

Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
ahus1 pushed a commit to ahus1/keycloak that referenced this issue Mar 22, 2024
Closes keycloak#26983

Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core kind/bug Categorizes a PR related to a bug priority/blocker Highest Priority. Has a deadline and it blocks other tasks release/24.0.0 team/core-iam
Projects
None yet
4 participants