Issue now with updating the theme in use

Hi,

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=?

Any help with this would be greatly appreciated.

Scott

And for some reason, without changing a thing except for trying to change the theme, I can no longer access Keycloak. This is getting frustrating…

Scott

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?

I have an HA setup via Bitnami’s helm chart. In the values.yaml I have the following config to mount my theme.

extraVolumeMounts:
  - mountPath: /opt/bitnami/keycloak/themes/m8a-theme
    name: theme
extraVolumes:
  - name: theme

The theme was working perfectly up until upgrading to version 21.

If you need any more info, please let me know.

Scott

I still haven’t figured this out. Does anyone know if there were changes to the way templates are called upon in Keycloak?

Scott

There’s no change in loading the themes from Keycloak itself.
But as you are using the Bitnami stuff, perhaps there has something changed!? :man_shrugging:

1 Like

Ok. As it seems, for some reason my settings for proxying didn’t work. So, I had to change two settings and everything seems to be working again. Yay!

The settings were:

extraEnvVars:  # newly added
  - name: KEYCLOAK_ENABLE_HTTPS
    value: 'false'
......
proxy: edge

Scott

1 Like

Is there any way to show the thread as being resolved?

Scott

Discourse doesn’t have this by default (it’s available as a plugin, but it’s not installed here), so I just try to :heart: 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.

1 Like

Thanks for the reply. I’ve upvoted my own post as the solution. Would be nice to have that plugin installed. :slight_smile:

Scott

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.