We've experienced some very weird troubles the last 5-6 months. In our project, we use spring-ldap 1.1-RC1. We had to use the release candidate, because that was the latest version around and it contained a bugfix which we needed.
In our application, there are users with certain rights. Each user belongs to a department, which in turn belongs to an agency. It's possible that 1 user is administrator of different departments. In that case, his/her profile contains one or more fields with the name "administratorofdepartment". So let's say you have 3 departments, T001, T002 and T003. If user a is administrator of 2 departments, his profile contains "adminofdepartments: T002" and "adminofdepartments: T003".
For some reason, every once and a while, those fields are erased from the LDAP. I've added logging in our webapplication, but I don't see any trace of those fields being erased. It's also quite hard to simulate this behavior, because every user who experienced this didn't do anything extraordinary. The only thing I can think of is that they executed an update of a user profile,one after the other. But since they've done this multiple times and on multiple different days, it's quite hard to believe that this is what causing the problem.
This is the code to update a profile:
It doesn't happen very often, but when it happens it's quite irritating. Especially for our customers, since we don't have a proper explanation for this.Code:public void update(String username, Citizen citizen) { DistinguishedName currentDn = buildDn(username); if(citizen.getLogin().getUsername().equals(username)) { // SAME UID -> REBIND DirContextAdapter contextAdapter = (DirContextAdapter) ldapTemplate.lookup(currentDn); CitizenToAttributesMapper citizenToAttributesMapper = new CitizenToAttributesMapper(contextAdapter); citizenToAttributesMapper.mapToAttributes(citizen); ModificationItem[] modificationItems = contextAdapter.getModificationItems(); ldapTemplate.modifyAttributes(currentDn, modificationItems); } else { // CHANGED UID -> BIND/UNBIND DistinguishedName newDn = buildDn(citizen.getLogin().getUsername()); CitizenToAttributesMapper citizenToAttributesMapper = new CitizenToAttributesMapper(); citizenToAttributesMapper.mapToAttributes(citizen); ldapTemplate.bind(newDn, citizenToAttributesMapper.getContextAdapter(), null); ldapTemplate.unbind(currentDn); } }
The only thing I can think of is to put extra logging in our DAO-component, to check which fields it wants to update. Then we can find out if he tries to remove those fields and which action triggers the removal.
Now my question is, is this a known bug? Has someone ever experienced this before? It's really weird, because it happens only now and then and it's at random. Not that there's a huge load at that time. I've also checked whether this could be a threading problem or not, but then it 's weird that it only happens once a month.
I've included the latest Spring-LDAP release in our project and I'm going to test every action again. Normally everything should work, but just in case ...


Reply With Quote