I’m now able to log in and use Keycloak again after upgrading to 21.0.2 from 21.0.1 (on k8s with an HA Postgres setup), however my theme isn’t working and when I try to change the theme to see if the Keycloak theme works, I get the following error:
Realm could not be updated: javax.persistence.OptimisticLockException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; statement executed: delete from COMPONENT where ID=?
Can you give us more information about your setup? How are you packaging the theme? How are you deploying it to the docker container? What is your startup command?
Discourse doesn’t have this by default (it’s available as a plugin, but it’s not installed here), so I just try to an answer that I find helps/resolves the issue. Assuming others are following the same, it let’s the community “vote” on the best solution. Not as clean as Stack Overflow, but it seems to work here.
I’m having the same problems as you were but setting flag KEYCLOAK_ENABLE_HTTPS didn’t work.
For some reason, after updating our theme, Keycloak raises an Optimistic Lock error whenever i update a realm attribute:
Error! javax.persistence.OptimisticLockException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; statement executed: delete from REALM_ATTRIBUTE where NAME=? and REALM_ID=?
I tried to roll back to the last working version, even removed the custom theme but it still didn’t work. Looks like some irreversible damages have been done to the database (somehow?) that caused the problem.
I also tried to look for a version field in every table in the database but did not find any, the only optimistic lock-related logics i could find in the code is JPA entities related models, but since we don’t use map storage by default, I’m not sure it’s relevent.
Can someone give me some help with troubleshooting this issue?
I’m using Keycloak 19.0.3 on a clustered Postgres DB.