#48374 entry cache locks not released in error conditions
Closed: wontfix None Opened 7 years ago by lkrispen.

In the entry cache code there are scenarios where a lock is not released when return happens in an error condition:

1046     if (!add_hash(cache->c_dntable, (void *)newndn, strlen(newndn), newe, (void **)&alte)) {
1047         LOG("entry cache replace (%s): can't add to dn table (returned %s)\n",
1048             newndn, alte?slapi_entry_get_dn(alte->ep_entry):"none", 0);
1049         cache_lock(cache);
1050         return 1;
1051     }

it should be cache_unlock(cache) in line 1049


1503         PR_Lock(cache-);
1504         if (! e->ep_mutexp) {
1505             e->ep_mutexp = PR_NewMonitor();
1506             if (!e->ep_mutexp) {
1507                 LOG("<= cache_lock_entry (DELETED)\n", 0, 0, 0);
1508                 LDAPDebug1Arg(LDAP_DEBUG_ANY,
1509                               "cache_lock_entry: failed to create a lock for %s\n",
1510                               backentry_get_ndn(e));
1511                 LOG("<= cache_lock_entry (FAILED)\n", 0, 0, 0);
1512                 return 1;
1513             }
1514         }

before the return in line 1512 c_emutexalloc_mutex should be unlocked

oops, in my paste line 1503 got corrupted, it reads:

1503 PR_Lock(cache->c_emutexalloc_mutex);

For some reason, this typo does not exist in 389-ds-base-1.2.11/rhel-6.x.
1049 cache_lock(cache);

Missing unlock of this lock is shared among all versions.
1503 PR_Lock(cache->c_emutexalloc_mutex);

Thanks for the clarification, Ludwig! Yep, definitely, the patch had a copy&paste error... :(

On 12/10/2015 02:25 PM, Ludwig Krispenz wrote:

For some reason, this typo does not exist in 389-ds-base-1.2.11/rhel-6.x.
1049 cache_lock(cache);
I think it was introduced with: https://fedorahosted.org/389/attachment/ticket/47834/0001-Ticket-47834-Tombstone_to_glue-if-parents-are-also-c.4.patch
it is line 1078 in that patch.

Ludwig's fix proposal was feviewed by Noriko.

Pushed to master:
1d217fe..d7bbbf2 master -> master
commit d7bbbf2

Metadata Update from @nhosoi:
- Issue set to the milestone:

6 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/1705

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Fixed)

3 years ago

Login to comment on this ticket.