<div dir="ltr"><div><div><div>Hi,<br><br></div>We're using Keycloak 1.9.0.Final as of now. I had a quick check on our logs and it seems that we have performed update calls to the same user almost at the same time when this error has popped up. Could be a programmatical error on one of our clients.<br><br>In any case, the occurrences of this error are very rare. Just wanted to note it down here for your exposure. Thanks for the response.<br><br><br></div>Regards,<br></div>Lohitha.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 18, 2016 at 2:49 PM, Marek Posolda <span dir="ltr"><<a href="mailto:mposolda@redhat.com" target="_blank">mposolda@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Hi,<br>
<br>
It seems that you're trying to update same user by 2 concurrent
transactions, hence there is OptimisticLockException thrown by
Hibernate.<br>
<br>
On which version are you? We had some cache fixes for user cache
in latest master, but that's related to infinispan cache. You can
try with latest master, but not sure if it helps with the scenario
you're testing as the error is at DB level. Not sure if Keycloak
should somehow improve the support of the scanario when user is
updated by 2 transactions at the same time. Doesn't look like very
common thing to me.<br>
<br>
Marek<div><div class="h5"><br>
<br>
On 17/03/16 11:03, Lohitha Chiranjeewa wrote:<br>
</div></div></div>
<blockquote type="cite"><div><div class="h5">
<div dir="ltr">
<div>
<div>
<div>Hi,<br>
<br>
</div>
We were executing the 'Update User' API call when the
following exception got thrown:<br>
<pre>[2016-03-17 07:50:36.0590], DEBUG, org.jboss.resteasy.core.SynchronousDispatcher <span>default</span> task-13 - RESTEASY002315: PathInfo: /admin/realms/xxxx/users/e503cb04-3080-4e90-a4b4-80adcd46b81c
[2016-03-17 07:50:36.0590], DEBUG, org.keycloak.services.managers.AuthenticationManager <span>default</span> task-13 - token active - active: <span>true</span>, issued-at: 1,458,201,036, not-before: 0
[2016-03-17 07:50:36.0590], DEBUG, org.keycloak.services.resources.admin.AdminRoot <span>default</span> task-13 - authenticated admin access <span>for</span>: superuser
[2016-03-17 07:50:36.0591], DEBUG, org.keycloak.services.resources.Cors <span>default</span> task-13 - No origin returning
[2016-03-17 07:50:36.0636], DEBUG, org.infinispan.interceptors.InvalidationInterceptor <span>default</span> task-13 - Cache [localhost] replicating InvalidateCommand{keys=[e503cb04-3080-4e90-a4b4-80adcd46b81c]}
[2016-03-17 07:50:36.0637], ERROR, org.keycloak.services.resources.ModelExceptionMapper <span>default</span> task-13 - javax.persistence.OptimisticLockException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1: org.keycloak.models.ModelException: javax.persistence.OptimisticLockException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
at org.keycloak.connections.jpa.PersistenceExceptionConverter.convert(PersistenceExceptionConverter.java:61)
at org.keycloak.connections.jpa.JpaKeycloakTransaction.commit(JpaKeycloakTransaction.java:47)
at org.keycloak.services.DefaultKeycloakTransactionManager.commit(DefaultKeycloakTransactionManager.java:95)
at org.keycloak.services.resources.admin.UsersResource.updateUser(UsersResource.java:170)
at sun.reflect.GeneratedMethodAccessor435.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:138)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:107)</pre>
We're using a clustered Infinispan system as our cache. This
error doesn't get thrown often, nor can we point out a
specific scenario. However, we have now seen this a few
times. What could be the reason for this?<br>
<br>
<br>
</div>
Regards,<br>
</div>
Lohitha.<br>
<div>
<div>
<div>
<div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
</div></div><pre>_______________________________________________
keycloak-user mailing list
<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a></pre>
</blockquote>
<br>
</div>
</blockquote></div><br></div>