You receive the "Too many files open" error message when you run VFP on Windows Terminal Server (219956)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0
  • Microsoft Visual FoxPro for Windows 3.0b
  • Microsoft Visual FoxPro for Windows 5.0
  • Microsoft Visual FoxPro for Windows 5.0a
  • Microsoft Visual FoxPro for Windows 6.0
  • Microsoft FoxPro for Windows 2.6
  • Microsoft FoxPro for Windows 2.6a
  • the operating system: Microsoft Windows NT 4.0

This article was previously published under Q219956

SYMPTOMS

When you run Microsoft Visual FoxPro applications through Microsoft Windows Terminal Server, and if more than 2048 handles are open, you receive the following error message:
Too many files open

CAUSE

To maintain compatibility with existing Server Message Block (SMB)-based products (for example, Windows NT 3.x and 4.0, Windows 95), Terminal Server's use of SMB has not been modified from Windows NT Server 4.0. This may cause a problem if several Terminal Server users connect to a single network share, either on the Terminal Server or elsewhere on the network. The potential problem is an SMB limitation of 2048 open file handles.

MORE INFORMATION

The error message indicates that FoxPro for Windows or Visual FoxPro has attempted to open more than it's internal limit of files. This behavior and the resulting error message occur as a result of a limitation of 2048 open file handles in Windows NT Terminal Server.

Note Microsoft does not support FoxPro for Windows or Visual FoxPro for Windows running on Windows NT 4.0 Terminal Services.

With Windows 2000 server, the open file handles limit has been expanded to 16,384 (as seen with "Net Config server"). While the open file handles limit has been expanded, the error may still occur unless use of a separate virtual circuit by each Terminal Server has been enabled.

Steps to reproduce the behavior

  1. Initiate a connection to a Windows NT Terminal Server.
  2. Using the connection to Windows NT Terminal Server, launch a session of FoxPro for Windows or Visual FoxPro.
  3. Create a program file called "MAXFILES.PRG", using the following code:
    FOR i=1 TO 684
       SELECT 0
       make_cmd="create table test"+ALLTRIM(STR(i))+" (var1 c(10), var2 m)"
       *!* Open one file handle for each table created
       *!* Open a second file handle for each fpt file
       &make_cmd
       select_table="test"+ALLTRIM(STR(i))
       SELECT (select_table)
       index_cmd="index on var1 tag junk of test"+ALLTRIM(STR(i))
       *!* Open a third file handle for each index created
       &index_cmd
    NEXT
    					
  4. From the Command window, type "DO MAXFILES."
  5. Observe that the program will error out with the following error message:
    Too many files open
  6. Click Suspend
  7. From the Command window, type the following code:
    ? i
    ? i*3
    						
    Note that the value for i that is displayed is 683, and the value that is displayed for i*3 is 2049.

REFERENCES

For additional information about Microsoft Windows NT Server version 4.0, Terminal Server Edition, click the following article number to view the article in the Microsoft Knowledge Base:

190162 Terminal Server and the 2048 open file limitation


Modification Type:MajorLast Reviewed:2/2/2005
Keywords:KbClientServer kberrmsg kbprb KB219956 kbAudDeveloper