Ticket 49873 - Contention on virtual attribute lookup
During lookup of the virtual attribute table (filter evaluation and returned attribute)
the lock is acquired many times in read. For example it is acquired for each targetfilter aci and for
each evaluated entry.
Unfortunately RW lock is expensive and appears frequently on pstacks.
The lock exists because the table can be updated but update is very rare (addition of a new service provider).
So it slows down general proceeding for exceptional events.
The fix is to acquire/release the read lock at the operation level and set a per-cpu flag, so that later lookup
would just check the flag.
SSL initialization does internal searches that access the vattr_global_lock
Call of vattr_global_lock_create needs to be called before slapd_do_all_nss_ssl_init.
Also, 'main' may or may not fork, the initialization fo the thread private variable
is done either on the child or parent depending if main forks or not.
The leak is fixed using a destructor callback of the private variable and so
call PR_SetThreadPrivate only if there is no private variable.
This patch is the merge of the four 49873 patches done in master
Reviewed by: Ludwig Krispenz, William Brown , Simon Pichugi (thanks !!)
Platforms tested: F28
Flag Day: no
Doc impact: no