Deadlock with libsmbclient functions and Multiple forked processes

Akshay V Rao avrao at us.ibm.com
Fri Jun 13 14:08:10 GMT 2003



Well, I tried doing this using threads in the first place but found out
that libsmbclient was not thread safe.  I then moved to forked processes,
therefore, it is in a different address space.  I am not sure that if I
open and close (and read) connections in each forked process, shouldn't
they be different because they exist in different address spaces - where as
threads exist in the same address space.

Thursday, June 12, 2003 8:13 PM
To: Akshay V Rao/Poughkeepsie/IBM at IBMUS
cc: samba-technical at lists.samba.org
From: Andrew Bartlett <abartlet at samba.org>
Subject: Re: Deadlock with libsmbclient functions and Multiple forked
processes



On Fri, 2003-06-13 at 06:08, Akshay V Rao wrote:
>
> I am currently developing a program that forks N Processes.  Each child
> forked process, executes a while loop in which the following function
calls
> are issued in the following order: smbc_open(), smbc_read(),
smbc_close().
> It appears that these functions are responsible for creating deadlocks
when
> there exist more than one child forked process (N > 1).  If I comment out
> the function calls and run the program with multiple processes, the
> deadlock is gone and the program runs normally.  If I then uncomment the
> function calls and run the program with only one process, the deadlock is
> gone as well.  I am running Samba version 2.2.7a on RedHat 7.3 kernel
> version 2.4.7-10smp, 512 Mb RAM, Dual PIII.  If anyone has any ideas,
they
> would definitly be greatly appreciated.

If you are doing this on one connection to the remote server, I'm not
surprised.  The libsmbclient code will still share the connection after
initialization, and you are reading/writing from a common socket!

Don't do that.  We are not thread-safe either.

Andrew Bartlett

--
Andrew Bartlett                                 abartlet at pcug.org.au
Manager, Authentication Subsystems, Samba Team  abartlet at samba.org
Student Network Administrator, Hawker College   abartlet at hawkerc.net
 http://samba.org     http://build.samba.org     http://hawkerc.net
 (Attachments removed)




More information about the samba-technical mailing list