[ https://issues.apache.org/jira/browse/KNOX-2678?focusedWorklogId=662592&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-662592 ]
ASF GitHub Bot logged work on KNOX-2678: ---------------------------------------- Author: ASF GitHub Bot Created on: 08/Oct/21 08:16 Start Date: 08/Oct/21 08:16 Worklog Time Spent: 10m Work Description: smolnar82 opened a new pull request #508: URL: https://github.com/apache/knox/pull/508 ## What changes were proposed in this pull request? Instead of invoking the entire `evictExpiredTokens` in `DefaultTokenStateService` we only need to call the `removeTokens` method since at this point we already removed expired tokens from the DB and we know the token ID list. ## How was this patch tested? Manual testing: - configured Knox to use the JDBC token state service and set the token eviction interval to 30 secs (5 mins is the default) - I also changed the log level to `DEBUG` - generated 10 tokens with TTL=1 min - waited ~30 seconds - confirmed that all were removed successfully from the DB - checked the gateway log ``` 2021-10-08 10:06:17,526 INFO token.state (JDBCTokenStateService.java:evictExpiredTokens(216)) - Removing 10 expired token(s) from the database: 9c118d02...b546c9202292, 6058370b...e68f85617ab2, c4d3e7ed...db35eb6c82bc, 451b8967...f0f73a4dfa80, 9e5efecb...7e3914bf447c, 7a1cd43c...1ddd6d71d132, 0543ebc5...286128a53628, 77d7c202...da3950e7c919, c5c9d7ee...ed2f7e586789, f1bfe575...1914316db17e 2021-10-08 10:06:17,532 DEBUG token.state (JDBCTokenStateService.java:evictExpiredTokens(219)) - 10 expired tokens have been removed from the database 2021-10-08 10:06:17,533 DEBUG token.state (DefaultTokenStateService.java:removeTokenState(311)) - Removed state for tokens 9c118d02...b546c9202292, 6058370b...e68f85617ab2, c4d3e7ed...db35eb6c82bc, 451b8967...f0f73a4dfa80, 9e5efecb...7e3914bf447c, 7a1cd43c...1ddd6d71d132, 0543ebc5...286128a53628, 77d7c202...da3950e7c919, c5c9d7ee...ed2f7e586789, f1bfe575...1914316db17e ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@knox.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 662592) Remaining Estimate: 0h Time Spent: 10m > Expired tokens are not removed from the in-memory cache > ------------------------------------------------------- > > Key: KNOX-2678 > URL: https://issues.apache.org/jira/browse/KNOX-2678 > Project: Apache Knox > Issue Type: Bug > Components: Server > Reporter: Sandor Molnar > Assignee: Sandor Molnar > Priority: Critical > Time Spent: 10m > Remaining Estimate: 0h > > As a side effect of KNOX-2658, the following error is displayed in the logs > and the given token remains in the in-memory cache: > {noformat} > 2021-10-08 09:40:32,502 INFO token.state > (JDBCTokenStateService.java:evictExpiredTokens(216)) - Removing 1 expired > token(s) from the database: 82ef4c45...e2b047162a35 > 2021-10-08 09:40:32,515 ERROR token.state > (DefaultTokenStateService.java:getExpiredTokens(379)) - Failed to evict > expired token 82ef4c45...e2b047162a35 : > org.apache.knox.gateway.services.security.token.UnknownTokenException: > Unknown token: 82ef4c45...e2b047162a35 > {noformat} > Note: the token was successfully removed from the DB. -- This message was sent by Atlassian Jira (v8.3.4#803005)