Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2097350

Summary: Swift/rgw gives error 401 after openstack deploy/update for about 60 minutes
Product: Red Hat OpenStack Reporter: Luca Davidde <ldavidde>
Component: tripleo-ansibleAssignee: Grzegorz Grasza <ggrasza>
Status: CLOSED ERRATA QA Contact: Joe H. Rahme <jhakimra>
Severity: high Docs Contact:
Priority: high    
Version: 16.2 (Train)CC: alee, cbodley, ceph-eng-bugs, cephqe-warriors, cschwede, emilien, enothen, gfidente, ggrasza, gjose, hrybacki, jagee, jpretori, kbader, kkeithle, mbenjamin, mwatts, owalsh, ravsingh, stchen, tvignaud, yoliynyk
Target Milestone: z4Keywords: Triaged
Target Release: 16.2 (Train on RHEL 8.4)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tripleo-ansible-0.8.1-2.20221005190229.f251fee Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of:
: 2138815 (view as bug list) Environment:
Last Closed: 2022-12-07 19:23:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2138815    

Description Luca Davidde 2022-06-15 13:39:06 UTC
Description of problem:
In OpenStack environment where swift/ceph-rgw combination is used for object storage, right after the deploy, swift starts responding with "401 & 404" for around 60min & then everything works fine.
By default fernet tokens are rotated during deploy/update, so it seems that RGW is not able to handle a token that becomes invalid until it expires.

Setting "rgw_keystone_token_cache_size: '0'" should solve the issue, which is easy reproducible in a lab. 
But is likely a workaround.
Is it possible to improve how RGW handles invalid tokens?  


Version-Release number of selected component (if applicable):
Red Hat Ceph Storage 4 on RHEL 8 4-54

How reproducible:
everytime

Steps to Reproduce:
1.stack update/deploy in an env with swift/ceph-rgw
2.
3.

Actual results:
swift commands gives you:
Unrecognized schema in response body. (HTTP 401) (Request-ID: tx000000000000000f7d427-00628372c5-4eca605-default)
for ~60 minutes

Expected results:
swift working fine from minute 0 after the deploy

Additional info:

Comment 25 Eric Nothen 2022-10-13 06:35:44 UTC
I might be wrong here, but I think we are missing the point. The problem I see is that Swift is unable to detect that it's handling an invalid token, and keeps using it until the expiration time, then it uses a new one and the problem "self heals". 

If Swift is able to resolve the situation in which a token is expired, shouldn't also handle more appropriately an invalid token, for example by requesting a new one upon the first 401 it receives and not after retrying for ~40 minutes?

Comment 49 Eric Nothen 2022-10-21 07:26:56 UTC
This is the ansible task that is causing the token revocation:

~~~
2022-10-20 14:35:16,822 p=280722 u=mistral n=ansible | TASK [tripleo-keystone-resources : Async creation of Keystone user] ************
2022-10-20 14:35:16,822 p=280722 u=mistral n=ansible | Thursday 20 October 2022  14:35:16 +0200 (0:00:02.879)       0:18:20.701 ****** 
2022-10-20 14:35:17,387 p=280722 u=mistral n=ansible | changed: [undercloud] => (item=None) => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": true}
2022-10-20 14:35:17,389 p=280722 u=mistral n=ansible | changed: [undercloud] => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": true}
2022-10-20 14:35:17,395 p=280722 u=mistral n=ansible | TASK [tripleo-keystone-resources : Check Keystone user status] *****************
2022-10-20 14:35:17,396 p=280722 u=mistral n=ansible | Thursday 20 October 2022  14:35:17 +0200 (0:00:00.573)       0:18:21.275 ****** 
2022-10-20 14:35:23,057 p=280722 u=mistral n=ansible | changed: [undercloud] => (item=swift) => {"ansible_job_id": "789898991559.931199", "ansible_loop_var": "tripleo_keystone_resources_user_async_result_item", "attempts": 2, "changed": true, "finished": 1, "tripleo_keystone_resources_user_async_result_item": {"ansible_job_id": "789898991559.931199", "ansible_loop_var": "tripleo_keystone_resources_data", "changed": true, "failed": false, "finished": 0, "results_file": "/root/.ansible_async/789898991559.931199", "started": 1, "tripleo_keystone_resources_data": {"swift": {"password": "XEVRrkX7XnhA9NiYeUtVVKGq4"}}}, "user": {"default_project_id": null, "description": null, "domain_id": "default", "email": "swift@localhost", "enabled": true, "id": "536d28a39ccc43b486764b6761acec39", "name": "swift", "username": null}}
~~~

This task comes from /var/lib/mistral/overcloud/external_deploy_steps_tasks_step4.yaml, which imports the role "tripleo-keystone-resources". Specifically, the task is users.yaml, and I suppose the reason for the token revocation is the "update_password: always", here [0].


[0] https://github.com/openstack/tripleo-ansible/blob/stable/train/tripleo_ansible/roles/tripleo-keystone-resources/tasks/users.yml#L24

Comment 50 Eric Nothen 2022-10-21 08:01:13 UTC
Oliver, Emilien,

I'm adding you because you might be knowledgeable about the background on this commit [0]. It seems that this password update on the swift user (even when the password doesn't change) causes a token revocation that in turns makes the external RGW fail until a new token is expired (possibly up to 1 hour). Is there a workaround we can provide to skip this task while we analyze and propose a fix to this issue?


[0] https://github.com/openstack/tripleo-ansible/commit/b8ff5517a1726a89a6adcae51a1c999fe2c88442

Comment 51 Eric Nothen 2022-10-21 08:04:48 UTC
(In reply to Eric Nothen from comment #50)

> makes the external RGW fail until a new token is expired (possibly up to 1 hour). 

s/expired/requested/

Comment 52 Grzegorz Grasza 2022-10-21 10:10:30 UTC
(In reply to Eric Nothen from comment #49)
> This is the ansible task that is causing the token revocation:
> 
> (...)
> 
> This task comes from
> /var/lib/mistral/overcloud/external_deploy_steps_tasks_step4.yaml, which
> imports the role "tripleo-keystone-resources". Specifically, the task is
> users.yaml, and I suppose the reason for the token revocation is the
> "update_password: always", here [0].
> 

I can confirm that updating the password revokes the tokens, there was a similar issue, but in keystone-manager bootstrap in the past [1].

I have set up an environment to run just keystone-manager bootstrap, but didn't encounter the token revocation issue (the previous logs suggested that it might be an issue in the keystone-manager bootstrap), so it looks like you've found the root cause.

> 
> [0]
> https://github.com/openstack/tripleo-ansible/blob/stable/train/
> tripleo_ansible/roles/tripleo-keystone-resources/tasks/users.yml#L24

[1] https://bugs.launchpad.net/keystone/+bug/1647800

Comment 53 Grzegorz Grasza 2022-10-21 14:48:55 UTC
(In reply to Eric Nothen from comment #50)
> Oliver, Emilien,
> 
> I'm adding you because you might be knowledgeable about the background on
> this commit [0]. It seems that this password update on the swift user (even
> when the password doesn't change) causes a token revocation that in turns
> makes the external RGW fail until a new token is expired (possibly up to 1
> hour). Is there a workaround we can provide to skip this task while we
> analyze and propose a fix to this issue?
> 

I started drafting a patch [1], which tries to login with the new password and changes the update_password argument accordingly.
I'll probably have something more complete on Monday.

> 
> [0]
> https://github.com/openstack/tripleo-ansible/commit/
> b8ff5517a1726a89a6adcae51a1c999fe2c88442

[1] https://review.opendev.org/c/openstack/tripleo-ansible/+/862372

Comment 57 Ollie Walsh 2022-10-24 12:14:34 UTC
(In reply to Eric Nothen from comment #50)
> Oliver, Emilien,
> 
> I'm adding you because you might be knowledgeable about the background on
> this commit [0].
>  It seems that this password update on the swift user (even
> when the password doesn't change) causes a token revocation that in turns
> makes the external RGW fail until a new token is expired (possibly up to 1
> hour). Is there a workaround we can provide to skip this task while we
> analyze and propose a fix to this issue?
> 
> 
> [0]
> https://github.com/openstack/tripleo-ansible/commit/
> b8ff5517a1726a89a6adcae51a1c999fe2c88442

That was to preserve the existing behaviour when upgrading Ansible from 2.7 to 2.8.

Comment 67 Ade Lee 2022-11-02 09:50:08 UTC
Changing the component here to reflect that the change being delivered here is in tripleo-ansible, rather than ceph.

Comment 83 errata-xmlrpc 2022-12-07 19:23:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Release of components for Red Hat OpenStack Platform 16.2.4), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:8794