bug: alphabetical order of resolving users when fixing duplicate issues
See original GitHub issueThanks for the latests updates you released. I’ve found some more information about the possible bug regarding conflicts when updating resolved users.
I am using v1.3.0 (docker) and Keycloak 9.0.2
I have a users.json like this:
{
"realm": "my-realm",
"users": [
{
"username": "abc@company.fi",
"email": "abc.stakeholder@company.fi",
"enabled": true,
"firstName": "Abc",
"lastName": "Stakeholder",
"credentials": [
{
"type": "password",
"value": "password"
}
]
},
{
"username": "company",
"email": "company.stakeholder@company.fi",
"enabled": true,
"firstName": "Company",
"lastName": "Stakeholder",
"credentials": [
{
"type": "password",
"value": "password"
}
]
}
]
}
Guess: What happens when you use keycloak search for user company, it will get list of these users in alphabetical order.
In this case, I already had the company user and added a abc@company.fi
So mr. abc gets created, but when trying to update company, it’s HTTP 409 conflict.
Is it possible that your new filter operation still returns the full list, gets the first item which is wrong in this case somehow?
stack trace:
2020-04-01 10:52:50.347 INFO 27 --- [ main] de.adorsys.keycloak.config.Application : Starting Application v1.3.0_2020-03-27T20:40:28Z on a09b077849de with PID 27 (/opt/keycloak-config-cli.jar started by root in /)
... (omitted) ...
2020-04-01 10:52:53.806 DEBUG 27 --- [ main] d.a.k.config.service.UserImportService : Create user 'abc@company.fi' in realm 'company-application'
2020-04-01 10:52:53.949 DEBUG 27 --- [ main] d.a.k.config.service.UserImportService : Remove realm-level roles [uma_authorization,offline_access] from user 'abc@company.fi' in realm 'company-application'
2020-04-01 10:52:54.019 DEBUG 27 --- [ main] d.a.k.config.service.UserImportService : Update user 'company' in realm 'company-application'
2020-04-01 10:52:54.138 INFO 27 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-04-01 10:52:54.147 ERROR 27 --- [ main] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:787) ~[spring-boot-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:768) ~[spring-boot-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) ~[spring-boot-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
at de.adorsys.keycloak.config.Application.main(Application.java:47) ~[classes!/:1.3.0_2020-03-27T20:40:28Z]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) ~[keycloak-config-cli.jar:1.3.0_2020-03-27T20:40:28Z]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[keycloak-config-cli.jar:1.3.0_2020-03-27T20:40:28Z]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) ~[keycloak-config-cli.jar:1.3.0_2020-03-27T20:40:28Z]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) ~[keycloak-config-cli.jar:1.3.0_2020-03-27T20:40:28Z]
Caused by: javax.ws.rs.ClientErrorException: HTTP 409 Conflict
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.handleErrorStatus(ClientInvocation.java:241) ~[resteasy-client-3.9.1.Final.jar!/:3.9.1.Final]
at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.DefaultEntityExtractorFactory$3.extractEntity(DefaultEntityExtractorFactory.java:50) ~[resteasy-client-3.9.1.Final.jar!/:3.9.1.Final]
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invokeSync(ClientInvoker.java:151) ~[resteasy-client-3.9.1.Final.jar!/:3.9.1.Final]
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:112) ~[resteasy-client-3.9.1.Final.jar!/:3.9.1.Final]
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76) ~[resteasy-client-3.9.1.Final.jar!/:3.9.1.Final]
at com.sun.proxy.$Proxy93.update(Unknown Source) ~[na:na]
at de.adorsys.keycloak.config.repository.UserRepository.updateUser(UserRepository.java:86) ~[classes!/:1.3.0_2020-03-27T20:40:28Z]
at de.adorsys.keycloak.config.service.UserImportService$UserImport.updateUser(UserImportService.java:101) ~[classes!/:1.3.0_2020-03-27T20:40:28Z]
at de.adorsys.keycloak.config.service.UserImportService$UserImport.importUser(UserImportService.java:86) ~[classes!/:1.3.0_2020-03-27T20:40:28Z]
at de.adorsys.keycloak.config.service.UserImportService.importUser(UserImportService.java:68) ~[classes!/:1.3.0_2020-03-27T20:40:28Z]
at de.adorsys.keycloak.config.service.UserImportService.doImport(UserImportService.java:61) ~[classes!/:1.3.0_2020-03-27T20:40:28Z]
at de.adorsys.keycloak.config.service.RealmImportService.updateRealm(RealmImportService.java:176) ~[classes!/:1.3.0_2020-03-27T20:40:28Z]
at de.adorsys.keycloak.config.service.RealmImportService.updateRealmIfNecessary(RealmImportService.java:157) ~[classes!/:1.3.0_2020-03-27T20:40:28Z]
at de.adorsys.keycloak.config.service.RealmImportService.doImport(RealmImportService.java:132) ~[classes!/:1.3.0_2020-03-27T20:40:28Z]
at de.adorsys.keycloak.config.Application.run(Application.java:57) ~[classes!/:1.3.0_2020-03-27T20:40:28Z]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:784) ~[spring-boot-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
... 13 common frames omitted
company-application-keycloak-config exited with code 1
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
What is Defect/Bug Life Cycle in Software Testing? Defect Life ...
States are Resolved and Verification. Invalid and Duplicate Defect Report. Sometimes defects occur, not because of code but because of test ...
Read more >Am I bugging you? Bug Reports - I.M. Wright's “Hard Code”
One of the most important and most often misused fields in a bug report is “Resolution”—the indicator of what was done to resolve...
Read more >Bug listing with status RESOLVED with resolution FIXED as at ...
Bug :2 - "How do I attach an ebuild." status:RESOLVED resolution:FIXED severity:normal · Bug:3 - "poedit-1.1.5.ebuild" status:RESOLVED resolution:FIXED ...
Read more >[Update: Dec. 14] YouTube bugs/issues & pending ...
Here we are tracking all the bugs and problems found on YouTube and their status as well as any pending improvements that are...
Read more >Ability to change the order of the Issues in Epic | Jira Cloud
Atlassian update on June 21st. Hi everyone, thanks so much for your suggestions. You can now see a new dropdown box that allows...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Awesome
Hi, I re-tested with my example users.json with 1.3.0, got the error, and your new JAR file v1.3.1, and I no longer get the HTTP 409 conflict.
I also quickly checked that correct persons was updated, so I was able to update both users without affecting each other.
This seems to fix my problem.
Extra ordinary thanks to you for quick solution 😃