[jcifs] Deadlock while cleaning up old sessions in transport

Felix Schumacher felix.schumacher at internetallee.de
Mon Aug 13 11:04:45 GMT 2007

Sorry for not including the patch. My Mailclient seems to have a problem.
The interested can find the patch at

Am Mo, 13.08.2007, 11:15, schrieb Felix Schumacher:
> Hi all,
> We hit the deadlock (which haunts the archives since a long time) while
> cleaning up old sessions in transport, too.
> When we traced the usage of setupDiscoLock, it became clear, that it was
> called in different order in some paths to treeConnect.
> When called from logoff() it would first lock transport and after that it
> would try to get setupDiscoLock.
> When someone came into treeConnect without any lock that someone would try
> to get setupDiscoLock first. (So you get your dining philosopher problem)
> To stop this problem you would have to always lock setupDiscoLock first,
> but in that case you could use the transport lock instead and get rid of
> setupDiscoLock and make the philosophers use only on fork.
> This is what the attached patch tries to accomplish.
> With it applied we could not reproduce the deadlock anymore.
> Bye
>  Felix
> PS. Why is the cleanup not done in its own thread? The way it is now
> implemented will punish somone who just tried to login and gets a new
> session.

More information about the jcifs mailing list