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

Kiran VM kiran.vm at gmail.com
Sat Mar 26 05:51:25 GMT 2005


> >
> Hello Jeremy, Hello Jerry,
> 
> I have attached a test exe (tester.exe) which will reproduce the
> problem. ( rename the tester.exe1 to tester.exe inside the zip file tester.zip1)
> 
> Just run tester with the remote file name (from the samba share) as
> the parameter. (eg. Tester.exe \\TestServer\TestShare\tempfile.txt).
> The program will open the given file 1000 times in a loop. The source
> code for this is also attached if you want to make any change. If you
> run this on a Win2K3 server, the handle count increases to >1000 and
> on an XP client it is around 10.
> 
> You can see the handle count in the taskmanager itself. In the process
> tab of task manager, select the option view->select columns. here
> check the Handle count check box. Now just monitor the tester.exe
> process (when it is runnning) in the task manager, you can see the
> count there.
> 
> Task manager does not show what kind of handles are open. For this we
> use a free ware from systinternals (called procexp). This can be
> downloaded from
> http://www.sysinternals.com/ntw2k/freeware/procexp.shtml.(i can send
> it if you want.)  Just run this tool and select
> tester.exe when it is running. This will show all the open handles on
> the bottom pane. On Win2K3 server, we can see that there are many file
> handles are open to the directory in our samba share.
> 
> If you still could not reproduce this problem, please let me know.
> Also, if you require more info from me, please let me know.
> 
> Thanks and best regards,
> Kiran
> 
> PS: Just a brief desc about by samba config.
> 
> Im running a 64 bit Samba 3.0.10( tried 3.0.13 also)  on Solaris 9
> with the smb conf something like this.
> 
> [global]
>       workgroup = NMUSOL
>       netbios name = TestServer
>       interfaces = 132.186.71.238
>       bind interfaces only = Yes
>       security = DOMAIN
>       password server = 132.186.70.122
>       log level = 2
>       ldap ssl = no
>       kernel oplocks = no
> 
> [TestShare]
>       path = /export/home1/TestShare
>       read only = No
>       oplocks = no
>       strict locking = yes
>       level2 oplocks = no
> 
> 
> 

Hello Jerry, Jeremy,

Sorry, iam not able to send attachement to the list so let me put the
code in the mail itself.

Im Msdev, start a new project,  select win32 console application. give
the project name as "Tester". Then in the tester.cpp put the following
code.... compile and execute as mentioned in my earlier mail.

Please let me know if you require any other info.

Thanks,
Kiran


___________________________________________________________n_
// Tester.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "Tester.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// The one and only application object

CWinApp theApp;

using namespace std;

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
	int nRetCode = 0;

	// initialize MFC and print and error on failure
	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
	{
		// TODO: change error code to suit your needs
		cerr << _T("Fatal Error: MFC initialization failed") << endl;
		return 1;
	}

	if( argc != 2)
	{
		cout <<_T("Usage: Tester.exe <complete UNC path of the shared file>")<<endl;
		cout <<_T("Example: Tester.exe
\\\\TestServer\\TestShare\\tempfile.txt")<<endl;
		return 1;
	}

	CString strFileName = argv[1];
	int nCount = 1000;

	cout << _T("Opening file ")<<(LPCTSTR)strFileName<<_T("
")<<nCount<<_T(" times")<<endl;

	for (int i = 0; i < nCount ; i++)
	{
		
		CFile fValueFile;
		if( !fValueFile.Open(strFileName,CFile::modeReadWrite  ) )
		{
		cout<<_T("Open failed with error")<<GetLastError()<<endl;
		}
		else
		{
			cout<<"Opened for iteration "<<i<<endl;
		}

		
		fValueFile.Close();

			
	
	}

	cout<<_T("Iteration completed. Press enter to exit")<<endl;

	getchar();

	return 0;
}
-------------- next part --------------
// Tester.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "Tester.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// The one and only application object

CWinApp theApp;

using namespace std;

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
	int nRetCode = 0;

	// initialize MFC and print and error on failure
	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
	{
		// TODO: change error code to suit your needs
		cerr << _T("Fatal Error: MFC initialization failed") << endl;
		return 1;
	}

	if( argc != 2)
	{
		cout <<_T("Usage: Tester.exe <complete UNC path of the shared file>")<<endl;
		cout <<_T("Example: Tester.exe \\\\TestServer\\TestShare\\tempfile.txt")<<endl;
		return 1;
	}

	CString strFileName = argv[1];
	int nCount = 1000;

	cout << _T("Opening file ")<<(LPCTSTR)strFileName<<_T(" ")<<nCount<<_T(" times")<<endl;

	for (int i = 0; i < nCount ; i++)
	{
		
		CFile fValueFile;
		if( !fValueFile.Open(strFileName,CFile::modeReadWrite  ) )
		{
		cout<<_T("Open failed with error")<<GetLastError()<<endl;
		}
		else
		{
			cout<<"Opened for iteration "<<i<<endl;
		}

		
		fValueFile.Close();

			
	
	}

	cout<<_T("Iteration completed. Press enter to exit")<<endl;

	getchar();

	return 0;
}




More information about the samba mailing list