-
We've been getting random errors from mod_auth_openidc like this:
We suspect this might be caused by a race condition in src/cache/file.c. Our appliction is javascript based and fires tens of json requests at the same time, potentially triggering multiple oidc_cache_file_set's / oidc_cache_file_get's at once. The way that oidc_cache_file_set works now is that it always opens the file with APR_FOPEN_TRUNCATE and only after does an APR_FLOCK_EXCLUSIVE. This means that after oidc_cache_file_get gets a lock it might find an empty file because of a oidc_cache_file_set that has preemptively emptied the file. As a suggested fix, perhaps the file could be truncated after locking instead of before. Additional info: config settings:
|
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 19 replies
-
just a few questions about that: |
Beta Was this translation helpful? Give feedback.
-
a) Yes I replaced it with "PATH", the actual filenames exist and contain data (by the time we look at it) Perhaps it might be possible for you to reproduce this problem in a test setup by putting a sleep before |
Beta Was this translation helpful? Give feedback.
-
Ok, thanks, I confirmed the issue with the suggested sleep indeed:
and fixed it in 244afa7; let me know if you want a release candidate build for a particular platform |
Beta Was this translation helpful? Give feedback.
-
Good evening, I happened to see that same error: So I decided to update to the new version v2.4.11. But I still see the same error, less frequently. It still appears, and we are not certain how to fix this issue. The current architecture is as follow, we have 2 application servers using this module in apache sitting behind a load balancer. Additionally, the cache sessions are stored on a NFS, so that the sessions are shared between both servers. If you need more information, please let me know. Thank you very much! |
Beta Was this translation helpful? Give feedback.
-
I still don't see why non-expired sessions would expire, but at least one other potential race condition was fixed in: |
Beta Was this translation helpful? Give feedback.
-
Thanks for reporting and suggesting, I'll adapt according to the suggestion |
Beta Was this translation helpful? Give feedback.
-
I just discovered something funny: On 2.4.9.4, so before most of the fixes mentioned in this thread it seems to help to add Now this doesn't really make sense to me at all, but maybe that's a valid workaround to someone else. |
Beta Was this translation helpful? Give feedback.
-
for the record, the complete fix is included in release 2.4.11.1 and upwards edit: it needed another fix in #955 |
Beta Was this translation helpful? Give feedback.
Ok, thanks, I confirmed the issue with the suggested sleep indeed:
and fixed it in 244afa7; let me know if you want a release candidate build for a particular platform