Skip to content

Commit a0b2f58

Browse files
keukoAlex-Welsh
authored andcommitted
Fix Horizon crash on Memcached node failure
Horizon uses Django's PyMemcacheCache backend to store session data. When one of the Memcached nodes becomes unavailable, Django raises an exception during session access, causing Horizon to return HTTP 500 errors. This patch adds 'ignore_exc': True to the cache OPTIONS to make Django treat such errors as cache misses instead of crashing. This improves Horizon stability in high-availability setups with multiple Memcached nodes. Closes-Bug: #2106557 Change-Id: If8873eaec35c4d2e5b13cdb8bcefb96230c59b51 Signed-off-by: Michal Arbet <[email protected]>
1 parent a940bab commit a0b2f58

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

ansible/roles/horizon/templates/_9998-kolla-settings.py.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ DATABASES = {
1919
{% elif groups['memcached'] | length > 0 and not horizon_backend_database | bool %}
2020
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
2121
CACHES['default']['LOCATION'] = [{% for host in groups['memcached'] %}'{{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ memcached_port }}'{% if not loop.last %},{% endif %}{% endfor %}]
22+
CACHES['default']['OPTIONS'] = {'ignore_exc': True}
2223
{% endif %}
2324

2425
{% if kolla_enable_tls_external | bool or kolla_enable_tls_internal | bool %}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
fixes:
3+
- |
4+
Fixes an issue where Horizon returned HTTP 500 errors when one of the
5+
Memcached nodes was unavailable by setting ``ignore_exc`` to ``True`` in
6+
the cache backend.
7+
`LP#2106557 <https://bugs.launchpad.net/kolla-ansible/+bug/2106557>`__

0 commit comments

Comments
 (0)