Unable to retrieve the decryption key #316
-
Good afternoon, Recently, we have been getting an occasional error in the IS (v7.2.4/.NET 9) logs: Failed to deserialize JSON from grant store. This error appears to originate from PersistentGrantSerializer.cs:line 103. We have 3 servers in our load balanced environment. All three show this error at times (not consistently). I am not sure how to troubleshoot this error. Can you provide some direction for me? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 12 replies
-
This is a data protection issue where the Can you share what your data protection setup looks like? It should be the same for all three servers, so that they share the same data protection keys. |
Beta Was this translation helpful? Give feedback.
-
I have the following setup where I am configuring services:
The certificate is the same on all three servers. This has been in place and working for quite some time. Suddenly our 2nd server is unable to find keys. It does throw a slightly different warning and error when I start it up:
The server has been sidelined until I get this one figured out. Thanks! |
Beta Was this translation helpful? Give feedback.
-
All three servers are showing 9.0.8. I will review the log level for that namespace and see if that can provide any additional information. While I noted the problems on the second server initially, further investigation disclosed these same pile of exceptions occur on startup for each server. After the initial exceptions are listed in the log, each server responds properly and seems to work ok. One thing I was not expecting were nearly 1000 keys in the shared folder. Most of the time, when I reviewed the folder, it had only a few. A large number of keys seems kind of odd to me. |
Beta Was this translation helpful? Give feedback.
-
Here is an example of recent entries in the log:
The specific key ID (masked) is not a file in the keys folder. So, something is holding on to an invalid key and attempting to load it. Maybe this will help reveal something to you. I am still a bit in the dark on this one. |
Beta Was this translation helpful? Give feedback.
-
Something is happening during the app startup that attempts to read/find/load these missing keys. There are dozens of WRN/ERR pairs in the logs, then the server starts operating normally. What is happening during startup? And, I can I get this fixed so the WRN/ERR are no longer getting recorded in the log? I will review the certificate to see if that was updated without my knowledge. |
Beta Was this translation helpful? Give feedback.
-
The certificate has been unchanged since Oct 2024. |
Beta Was this translation helpful? Give feedback.
-
Just to give you some perspective on the problem - the log adds 17,202 lines when the application starts up. These entries consist of WRN/ERR pairs that are similar to the pair posted earlier. That is a LOT of exceptions! I really need to mitigate this. |
Beta Was this translation helpful? Give feedback.
-
Even in the "good" logging, I occasionally see an entry like this:
I would think that an exception like this should also be mitigated. I am just not sure what is causing this stuff. |
Beta Was this translation helpful? Give feedback.
-
Would you be able to locate one of the data protection keys that fails to load, by searching for the key ID in the files? I'm mainly interested in the lifetime details of the keys that can't be loaded - the creation, activation and expiration dates. Perhaps the keys that are causing issues where all created before the last certificate rotation, making them unreadable/unrecoverable since October 2024. That is, unless this issue only recently started appearing: then the issue could still be caused by another change in the system (.NET runtime update most likely) |
Beta Was this translation helpful? Give feedback.
-
Thanks for the help! |
Beta Was this translation helpful? Give feedback.
I would suggest the following:
Since this clearly is a data protection specific issue and not an IdentityServer one, we unfortunately cannot invest more time in getting to the bottom of this.
I…