Menu

#4 Cache Multithreading Issue

Version_2.x
open
None
3
2006-12-26
2006-12-26
No

Duplicate records end up in the cache due to multithreading issues. Here is the scenario:

Thread 1 checks for the user in cache.
Thread 1 does not find user, connects to LDAP and verifies password. Thread yields during this time.
Thread 2 checks for the user in cache.
Thread 2 does not find user, connects to LDAP and verifies password. Thread yields during this time.
Thread 1 adds the user. Exits
Thread 2 adds the user. Exits.

The problem is that Cache_AddUser() does not check the cache for the user. This is intentional for performance reasons.

The cache should be rewritten in a faster fashion so this issue is resolved by checking for the record before adding.

Discussion


Log in to post a comment.