[Samba] Re: Different behaviour of samba share in XP and Windows 2003 Server

Kiran VM kiran.vm at gmail.com
Thu Mar 24 17:41:44 GMT 2005

Hello Jerry,

No CloseHandle() call is made in both the case. CFile (or for that
reason CStdioFile) Close() method will close the OS file handle.
(closehandle() in the sample code is commented given can be ignored)

Just to make it a bit more clearer, the executable (for testing i just
put the sample code above inside a for loop of 1000) is run from a
win2k3 server and xp machine. XP shows no handle increase leak (handle
count of 85), but in Win2k3 the handle count was around 1085 ( for
1000 iterations). This information i got from the windows task
manager. Upon this, i tried the procexp tool from sysinternals. This
clearly showed that the Handle being leaked is a file handle,
\\TestServer\TestShare in our case. (This is not the file as such but
the directory).

BTW, my samba server is on Solaris 9.

Please let me know if you erquire any further information...


On Thu, 24 Mar 2005 09:52:20 -0600, "Gerald (Jerry) Carter"
<jerry at samba.org> wrote:
> Hash: SHA1
> Kiran VM wrote:
> |>|       CString strSearchPath =
> _T("\\\\TestServer\\TestShare\\tempfile.txt");
> |>|       CStdioFile fValueFile;
> |>|       if( !fValueFile.Open(strSearchPath,CFile::modeReadWrite  ) )
> ...
> |>|               //CloseHandle( (HANDLE)fValueFile.m_hFile );
> |>|               fValueFile.Close();
> |
> | Hello Jerry,
> |
> | I just now compiled and installed 3.0.13. But the result is the same.
> | Any idea why this is happening?
> Nope.  Just to make sure I understand the issue.  With a Samba
> file share you have to explicitly include the call to CloseHandle()
> where as on a 2k3 file server, the Close() method handles it all
> right?  How do you know you're leaking handles here ?  e.g. what
> tool are you using ?
> We'll probably need to look at raw network traces between the same test
> program run against 2k3 and Samba file servers.
> cheers, jerry
> =====================================================================
> Alleviating the pain of Windows(tm)      ------- http://www.samba.org
> GnuPG Key                ----- http://www.plainjoe.org/gpg_public.asc
> "I never saved anything for the swim back."     Ethan Hawk in Gattaca
> Version: GnuPG v1.2.5 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
> iD8DBQFCQuI0IR7qMdg1EfYRAgz7AJwNdN4IQdVE3cPHYLz+cXMqxDtnEgCfeisM
> UPpJwi+pVmxW/VMfLj0zapk=
> =edpH

More information about the samba mailing list