Date:  11/29/2001 06:15:06 PM Msg ID:  000183
From:  FoxWeb Support Thread:  000169
Subject:  Re: COM server problem
Oleg,

You seem to be referring to a different problem.  Dan's problem was that he could not modify a FoxPro class once it was used by FoxWeb until FoxWeb was restarted.  The solution to this problem is to make sure that:
1. The object is released (RELEASE OBJECT ObjectName).
2. The procedure containing the class is not locked (SET PROCEDURE TO).
3. The class is released (CLEAR CLASS ClassName).

Your particular problem seems to be related to a bug in either VFP or the XML control, which prevents resources from being cleared after DOMDocument objects are released.  One thing you can try is to set the variable FW_Restart to 1 in your script if you detect a problem.  This variable is normally used by the FoxWeb error handler and will cause the channel to be reset (but not restarted), after the request is finished executing.  The channel reset code executes the following commands and re-creates all internal FoxWeb objects:

CLEAR DLLS
SET PROCEDURE TO
SET LIBRARY TO
CLEAR ALL
CLOSE ALL
CLEAR PROGRAM

This should work in most cases.  If the VFP process must actually exit in order to completely clear the resources held by previously declared DOMDocument objects then the only way to achieve this is to include the QUIT command in your script.  If Restart Channels is enabled, the channel will be restarted immediately by the channel broker.  The only problem is that the request being served when the QUIT command took place will never complete.

FoxWeb Support Team
support@foxweb.com

Sent by Oleg Goncharuk on 11/29/2001 06:19:16 AM:
I had encountered exactly the same problem and CLEAR CLASS does not save the situation.

When running script containing multiple creation of MSXML2.DOMDocument objects response time of channel increases from 1000 msec to 8000 msec after 16 hours of testing (CLEAR CLASS used in FW_EXIT and all class instances assigned to local variables within script). VFP function SYS(1016) in FW_EXIT returns 470000 at the start of testing and 2800000 at the end.

Question:
Is it possible to restart current channel programmatically after returning response to caller when some condition is met? I believe, that would increase perfomance greatly. 

Also: When we are running 3 channels and server load is low (at night) Foxweb almost always presents rare callers with first channel (filled with garbage) when two others (empty) are asleep. Maybe it would be better to present each call with channel that was long unused?

/Oleg

Sent by FoxWeb Support on 11/27/2001 03:55:43 PM:
Classes are not released after being instanciated, unless you issue a CLEAR CLASS command:

    CLEAR CLASS ClassName

If you are instanciating a PUBLIC object in fw_enter.prg, you will need to destroy the object before clearing the class:

    SET PROCEDURE TO
    RELEASE ObjectName
    CLEAR CLASS ClassName

Alternatively, if you only modify your user defined clases rarely, you can re-start FoxWeb whenever you want to recompile.

FoxWeb Support Team
support@foxweb.com

Sent by Dan Mory on 11/27/2001 02:26:13 PM:
I am using the Microsoft XML parser to process XML requests in a Foxweb 2.0 script.  I am assigning the instance of the COM object to a property of a user-defined class using CREATEOBJECT("MSXML2.DOMDocument").  The class that contains the COM object is instantiated in the body of the script.  This appears to work fine, but it seems that the object is not getting released after the script is run, because when I recompile the script, it gives a "cannot create file" message because the .fxp file is still open.  Is there additional housekeeping that needs to be done in such a case?  Is there a better way to accomplish the same results?