OpenLiberty / open-liberty

Open Liberty is a highly composable, fast to start, dynamic application server runtime environment
https://openliberty.io
Eclipse Public License 2.0
1.14k stars 587 forks source link

Root cause exception is hidden for OAuth 2.0 database failures #19022

Open jensengelke opened 2 years ago

jensengelke commented 2 years ago

Describe the bug
When database access, e.g. to add a token to the database fails for any reason with a SQLException, this exception is caught and a database migration is attempted. In case the database is already using the appropriate schema, this migration fails and the root cause of the original failure is never logged.

Steps to Reproduce
We cannot tell what the actual current issue with our database is, because the error is not logged. To force the issue, you may use a debugger and force an exception during DB insert. Maybe you can attempt to insert a new OIDC client with an overly long name or id.

Expected behavior
Root cause should be available as FFDC or warning.

Diagnostic information:

https://github.com/OpenLiberty/open-liberty/blob/427439c048275927a83bd7da54d1adf9528aa8f1/dev/com.ibm.ws.security.oauth/src/com/ibm/ws/security/oauth20/plugins/db/CachedDBOidcTokenStore.java#L459

Additional context
n/a

teddyjtorres commented 2 years ago

I agree this is a serviceability problem.