[Building Sakai] Sakai 2.9.2/JLDAP Issue

Niebel, William (wdn5e) wdn5e at eservices.virginia.edu
Wed Aug 7 07:32:20 PDT 2013


Using the line numbers from the patched JLDAPDirectoryProvider.java you sent, ue is null at 672, reasoning from what's in the log.
Following the code backwards, this null value is from the lines directly before, where the LDAP eid is used for the Map get(),
just lowercased for this use.  (As you said, in your code caseSensitiveCacheKeys==false and so the condition is true.)

The reason null is returned at 671 is that the Map put() at 650 uses the SAKAI eid which is not lowercased (or at least I don't see it in this stretch of code).
So the null returned means the key was put in the Map mixed case and the lowercase version in the get() just isn't in the Map.

I said earlier that we had mixed case user id issues, but I remembered that a little wrong:
our problems were with mixed case email addresses (a la Berkley:  wdn5e at Virginia.EDU    YIKES)

So we haven't seen your issue specifically.

It looks to me like you've encountered another bug, new to me anyway.

I would try lowercasing the sakai eid, too, especially where it's used at 671.
If you do this more generally, note a possible gotcha at 642.  (There may be more.)


621:     */
622:    public void getUsers(Collection<UserEdit> users)
623:    {
624:        if ( M_log.isDebugEnabled() ) {
625:            M_log.debug("getUsers(): [Collection size = " + users.size() + "]");
626:        }
627:
628:        LDAPConnection conn = null;
629:        boolean abortiveSearch = false;
630:        int maxQuerySize = getMaxObjectsToQueryFor();
631:        UserEdit userEdit = null;
632:
633:        HashMap<String, UserEdit> usersToSearchInLDAP = new HashMap<String, UserEdit>();
634:        List<UserEdit> usersToRemove = new ArrayList<UserEdit>();
635:        try {
636:            int cnt = 0;
637:            for ( Iterator<UserEdit> userEdits = users.iterator(); userEdits.hasNext(); ) {
638:                userEdit = (UserEdit) userEdits.next();
639:                String eid = userEdit.getEid();
640:
641:                // Do nothing with this eid if it is in the blacklist
642:                if ( !(isSearchableEid(eid)) ) {
643:                    userEdits.remove();
644:                    continue;
645:                }
646:
647:                // Check the cache before sending the request to LDAP
648:                LdapUserData cachedUserData = getCachedUserEntry(eid);
649:                if ( cachedUserData == null ) {
650:                    usersToSearchInLDAP.put(eid, userEdit);
651:                    cnt++;
652:                } else {
653:                     // populate userEdit with cached ldap data:
654:                    mapUserDataOntoUserEdit(cachedUserData, userEdit);
655:                 }
656:
657:                // We need to make sure this query isn't larger than maxQuerySize
658:                if ((!userEdits.hasNext() || cnt == maxQuerySize) && !usersToSearchInLDAP.isEmpty()) {
659:                    if (conn == null) {
660:                        conn = ldapConnectionManager.getConnection();
661:                    }
662:
663:                    String filter = ldapAttributeMapper.getManyUsersInOneSearch(usersToSearchInLDAP.keySet());
664:                    List<LdapUserData> ldapUsers = searchDirectory(filter, null, null, null, null, 0);
665:
666:                    for (LdapUserData ldapUserData : ldapUsers) {
667:                        String ldapEid = ldapUserData.getEid();
668:                        if (!(caseSensitiveCacheKeys)) {
669:                            ldapEid = ldapEid.toLowerCase();
670:                        }
671:                        UserEdit ue = usersToSearchInLDAP.get(ldapEid);
672:                        mapUserDataOntoUserEdit(ldapUserData, ue);
673:                        usersToSearchInLDAP.remove(ldapEid);
674:                    }
________________________________
From: McCarty, Matthew C [McCartM2 at mail.amc.edu]
Sent: Tuesday, August 06, 2013 4:34 PM
To: Niebel, William (wdn5e); Sam Ottenhoff
Cc: sakai-dev at collab.sakaiproject.org
Subject: RE: [Building Sakai] Sakai 2.9.2/JLDAP Issue

No harm at all.  I just double checked the file and it does appear the patch applied correct.  I’ve attached the source file, if you wouldn’t mind taking a look for me.


From: Niebel, William (wdn5e) [mailto:wdn5e at eservices.virginia.edu]
Sent: Tuesday, August 06, 2013 4:16 PM
To: McCarty, Matthew C; Sam Ottenhoff
Cc: sakai-dev at collab.sakaiproject.org
Subject: RE: [Building Sakai] Sakai 2.9.2/JLDAP Issue

The behavior logged would be explained by
JLDAPDirectoryProvider.java(lines 665-6 below) returning ue == null and then using it as a parm.
    UserEdit ue = usersToSearchInLDAP.get(ldapEid);
    mapUserDataOntoUserEdit(ldapUserData, ue);

This would feed the null parm into JLDAPDirectoryProvider.java method mapUserDataOntoUserEdit(LdapUserData userData, UserEdit userEdit)
and then into SimpleLdapAttributeMapper.java method mapUserDataOntoUserEdit(LdapUserData userData, UserEdit userEdit)

That method calls userEdit object methods that would throw NPE resulting in the log entries.

This looks the same as SAK-23689.  Exactly .  And the log would be as you sent.

Matthew, are you sure the SAK-23689 patch applied ok, and that you rebuilt and restarted before testing again after patching?
(Forgive me and then there's no harm in asking.)

I'd be willing to look at the patched source if that would help.


________________________________
From: McCarty, Matthew C [McCartM2 at mail.amc.edu]
Sent: Tuesday, August 06, 2013 2:30 PM
To: Niebel, William (wdn5e); Sam Ottenhoff
Cc: sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
Subject: RE: [Building Sakai] Sakai 2.9.2/JLDAP Issue
Hi, sorry for the delayed response.  It looks like we are using the SimpleLdapAttributeMapper.

Matthew McCarty
Manager, Information Services - Academic Systems
Albany Medical Center
43 New Scotland Ave.
Albany, NY 12208

desk: 518.262.0280
cell: 518.312.0706

From: Niebel, William (wdn5e) [mailto:wdn5e at eservices.virginia.edu]<mailto:[mailto:wdn5e at eservices.virginia.edu]>
Sent: Tuesday, August 06, 2013 1:28 PM
To: McCarty, Matthew C; Sam Ottenhoff
Cc: sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
Subject: RE: [Building Sakai] Sakai 2.9.2/JLDAP Issue

Sorry to have forgotten the patch earlier.  Here it is.
________________________________
From: sakai-dev-bounces at collab.sakaiproject.org<mailto:sakai-dev-bounces at collab.sakaiproject.org> [sakai-dev-bounces at collab.sakaiproject.org] on behalf of Niebel, William (wdn5e) [wdn5e at eservices.virginia.edu]
Sent: Tuesday, August 06, 2013 12:14 PM
To: McCarty, Matthew C; Sam Ottenhoff
Cc: sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
Subject: Re: [Building Sakai] Sakai 2.9.2/JLDAP Issue
Since from the log trace it's a RuntimeException, looking at the source at 2.9.2 JLDAPDirectoryProvider.java:700, in method getUsers(),
it was an Exception thrown, not an LDAPException.  That suggests that it may be a coding error, like NPE, and not the sakai logic explicitly throwing an LDAPException.

Following back in the log to
2013-08-06 09:48:24,212 DEBUG http-bio-8080-exec-8 edu.amc.sakai.user.JLDAPDirectoryProvider - mapUserDataOntoUserEdit() [cache record = . . .   eid=Zinskid
, that's from line 1113 in mapUserDataOntoUserEdit() of the same source file.
The next code line there is 1118 and reads
ldapAttributeMapper.mapUserDataOntoUserEdit(userData, userEdit);

The exception then is probably from your ldapAttributeMapper implementation,
in its mapUserDataOntoUserEdit() method.

At University of Virginia, we use the EntryAttributeToUserTypeMapper.java implementation
and have a local patch to that code to force our user type mapping to use lowercase user id.
(Because, like you, we have mixed case user id issues to deal with.)

That doesn't sound like it's exactly what's going on for you, but suggestively close.

I'll attach that patch as-is as we applied to for our 2.9.1 but I don't have time right now to adapt it to the sakai distribution 2.9.1 or 2.9.2 source.
(It may have been later in our patching, after some other local patches, and so not match the distribution.  I'm guessing the java code is a close match, but the configuration code further astray.)

If you tell us which AttributeToUserTypeMapper implementation you're using, I may be able to tell something from that code.
________________________________
From: McCarty, Matthew C [McCartM2 at mail.amc.edu]
Sent: Tuesday, August 06, 2013 11:46 AM
To: Niebel, William (wdn5e); Sam Ottenhoff
Cc: sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
Subject: RE: [Building Sakai] Sakai 2.9.2/JLDAP Issue
Nope, this is set to false.

From: Niebel, William (wdn5e) [mailto:wdn5e at eservices.virginia.edu]<mailto:[mailto:wdn5e at eservices.virginia.edu]>
Sent: Tuesday, August 06, 2013 11:36 AM
To: McCarty, Matthew C; Sam Ottenhoff
Cc: sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
Subject: RE: [Building Sakai] Sakai 2.9.2/JLDAP Issue

I would make certain that sakai property caseSensitiveCacheKeys isn't inadvertently set to true in your 2.9.2 test instance.  (I doubt that's it, but it's very much worth looking.)
________________________________
From: sakai-dev-bounces at collab.sakaiproject.org<mailto:sakai-dev-bounces at collab.sakaiproject.org> [sakai-dev-bounces at collab.sakaiproject.org] on behalf of McCarty, Matthew C [McCartM2 at mail.amc.edu]
Sent: Tuesday, August 06, 2013 11:33 AM
To: Sam Ottenhoff
Cc: sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
Subject: Re: [Building Sakai] Sakai 2.9.2/JLDAP Issue
Bear with me, as I’m a newbie to the backend of Sakai. It looks like the JLDAPDirectoryProvider file.

From: Sam Ottenhoff [mailto:ottenhoff at longsight.com]<mailto:[mailto:ottenhoff at longsight.com]>
Sent: Tuesday, August 06, 2013 10:57 AM
To: McCarty, Matthew C
Cc: Steve Swinsburg; sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
Subject: Re: [Building Sakai] Sakai 2.9.2/JLDAP Issue

And what code does that correspond to in your custom JLDAP source?

On Tue, Aug 6, 2013 at 10:56 AM, McCarty, Matthew C <McCartM2 at mail.amc.edu<mailto:McCartM2 at mail.amc.edu>> wrote:
I do, it’s the same as before.  RuntimeException during search eid =username

From: Sam Ottenhoff [mailto:ottenhoff at longsight.com<mailto:ottenhoff at longsight.com>]
Sent: Tuesday, August 06, 2013 10:37 AM
To: McCarty, Matthew C
Cc: Steve Swinsburg; sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>

Subject: Re: [Building Sakai] Sakai 2.9.2/JLDAP Issue


Sam, I tried to merge those patches in, and it did not solve my issue.


Okay, do you still get a stacktrace in your catalina.out after restarting and testing again?  What code does the stacktrace correspond to?
________________________________

CONFIDENTIALITY NOTICE: This email and any attachments may contain confidential information that is protected by law and is for the sole use of the individuals or entities to which it is addressed. If you are not the intended recipient, please notify the sender by replying to this email and destroying all copies of the communication and attachments. Further use, disclosure, copying, distribution of, or reliance upon the contents of this email and attachments is strictly prohibited. To contact Albany Medical Center, or for a copy of our privacy practices, please visit us on the Internet at www.amc.edu<http://www.amc.edu>.

________________________________

CONFIDENTIALITY NOTICE: This email and any attachments may contain confidential information that is protected by law and is for the sole use of the individuals or entities to which it is addressed. If you are not the intended recipient, please notify the sender by replying to this email and destroying all copies of the communication and attachments. Further use, disclosure, copying, distribution of, or reliance upon the contents of this email and attachments is strictly prohibited. To contact Albany Medical Center, or for a copy of our privacy practices, please visit us on the Internet at www.amc.edu<http://www.amc.edu>.

________________________________

CONFIDENTIALITY NOTICE: This email and any attachments may contain confidential information that is protected by law and is for the sole use of the individuals or entities to which it is addressed. If you are not the intended recipient, please notify the sender by replying to this email and destroying all copies of the communication and attachments. Further use, disclosure, copying, distribution of, or reliance upon the contents of this email and attachments is strictly prohibited. To contact Albany Medical Center, or for a copy of our privacy practices, please visit us on the Internet at www.amc.edu<http://www.amc.edu>.

________________________________

CONFIDENTIALITY NOTICE: This email and any attachments may contain confidential information that is protected by law and is for the sole use of the individuals or entities to which it is addressed. If you are not the intended recipient, please notify the sender by replying to this email and destroying all copies of the communication and attachments. Further use, disclosure, copying, distribution of, or reliance upon the contents of this email and attachments is strictly prohibited. To contact Albany Medical Center, or for a copy of our privacy practices, please visit us on the Internet at www.amc.edu<http://www.amc.edu>.

________________________________

CONFIDENTIALITY NOTICE: This email and any attachments may contain confidential information that is protected by law and is for the sole use of the individuals or entities to which it is addressed. If you are not the intended recipient, please notify the sender by replying to this email and destroying all copies of the communication and attachments. Further use, disclosure, copying, distribution of, or reliance upon the contents of this email and attachments is strictly prohibited. To contact Albany Medical Center, or for a copy of our privacy practices, please visit us on the Internet at www.amc.edu.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20130807/0ef11d5c/attachment.html 


More information about the sakai-dev mailing list