[Mono-dev] Unhandled Exceptions in Novell.Directory.Ldap and other Synchronization Issues

JD Conley jd.conley at coversant.net
Mon Aug 22 19:58:00 EDT 2005

Novell.Directory.Ldap spawns threads for various queued operations.
However, it appears as though there is no "catch all" exception handler
in Connection+ReaderThread:Run() (or other spawned threads either).  If
anything other than an IO exception is thrown the thread will exit
without notifying the consumer, and in Beta 2 this causes the
application to terminate.  In my current application it causes a search

One such example is as follows (this is received some time during
connecting, binding, or doing a search -- I'm not exactly sure):

Unhandled Exception: System.ArgumentException: length
in <0x004a3> System.Array:Copy (System.Array sourceArray, Int32
sourceIndex, System.Array destinationArray, Int32 destinationIndex,
Int32 length)
in <0x0004f> System.Array:Copy (System.Array sourceArray, System.Array
destinationArray, Int32 length)
in <0x00016> System.Collections.ArrayList:CopyTo (System.Array array)
in <0x0002a> System.Collections.ArrayList:ToArray ()
in <0x0004a> Novell.Directory.Ldap.MessageVector:findMessageById (Int32
in <0x001b7> Novell.Directory.Ldap.Connection+ReaderThread:Run ()
in (wrapper delegate-invoke) System.MulticastDelegate:invoke_void ()

This exception looks very strange at first glance.  An invalid length on
an ArrayList:ToArray() just doesn't compute.  After further
investigation I have found that the MessageVector class is only
partially synchronized.  Synchronization happens on the
findMessageById() and some other functions that do iteration, but the
atomic Add, Remove, and Contains operations are not protected.  It
appears as though the findMessageById is being called while messages are
being added to or removed from the MessageVector in another thread.

It is possible that I am the first to notice this since I am currently
doing LDAP queries through a VPN tunnel over an internet connection.
Messages coming back from the server have a tendency to trickle in
relatively slowly.

So, do I submit patches to this group, or through a different Novell
forum?  Is anybody actively working on this subsystem in such a way that
we might have to merge a lot of work?

-JD Conley

More information about the Mono-devel-list mailing list