Refreshing tokens leads into a "duplicate key value violates" on postgres
See original GitHub issueIssue Description
What version of UAA are you running?
4.8.0
What output do you see from curl <YOUR_UAA>/info -H'Accept: application/json'
{"app":{"version":"4.8.0"},"links":{"uaa":"http://localhost:8080/uaa","passwd":"/forgot_password","login":"http://localhost:8080/uaa","register":"/create_account"},"zone_name":"uaa","entityID":"cloudfoundry-saml-login","commit_id":"391163e","idpDefinitions":{},"prompts":{"username":["text","Email"],"password":["password","Password"]},"timestamp":"2017-12-04T18:33:28+0000"}
How are you deploying the UAA?
Docker container containing the official JAR from Maven
What did you do?
Refreshing a token
What did you expect to see? What goal are you trying to achieve with the UAA?
I expect to not get any errors in the postgres log.
What did you see instead?
The requests work fine, but I’m getting the following error in the postgres logs:
2017-12-07 15:58:34 UTC:10.3.88.28(60268):cloud_uaa@cloud_uaa:[29756]:ERROR: duplicate key value violates unique constraint "revocable_tokens_pkey"
2017-12-07 15:58:34 UTC:10.3.88.28(60268):cloud_uaa@cloud_uaa:[29756]:DETAIL: Key (token_id)=(1111111111111111111111111111111-r) already exists.
2017-12-07 15:58:34 UTC:10.3.88.28(60268):cloud_uaa@cloud_uaa:[29756]:STATEMENT: INSERT INTO revocable_tokens (token_id,client_id,user_id,format,response_type,issued_at,expires_at,scope,data,identity_zone_id) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)
We traced this down to UaaTokenServices.persistRevocableToken which already contains a comment that this is a known bug. The code basically tries to insert the refresh token again into the database despite it being already there leading into the error above. Would it be possible to fix this error? I suggest that we pass into the persistRevocableToken whether is chould create
or update
to avoid the error. It is well known if the token should be already in the database or not.
Am I overlooking something?
The whole thing is quite a show-stopper for us because we are getting ERRORs in postgres which appear on our alerting. We could try to ignore them but I would rather try to fix the bug.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (4 by maintainers)
@jhamon or @fhanik can you comment on this
Any idea on this? Thanks!