Releasing table from memory

Topics: Developer Forum, User Forum
Nov 27, 2011 at 11:16 AM

Hi All,

does exist some trick how remotely release the table from the momery on the server? I need make "modify structure" of table with exclusive access. Have got only ftp access on remote server.

My first idea was add to main.prog "RUN iisreset /restart" but it works on my develop PC not on the server.

Unfortunatelly I haven't got admin rights on the server. Any hints?

Coordinator
Nov 27, 2011 at 2:07 PM

Are you closing the tables after "USE'ing them in your vfp code?

Is your web app running in an App Pool?  Usually, Administrators will give users the ability to 'Re-Cycle App Pool' as they do at GoDaddy.  This isolates the restarting to your application only and not the whole web server.

I don't know of any tricks other than that and if I did it would probably fall into the realm of illegal hacking...

Nov 27, 2011 at 3:21 PM

You're right - I don't close the tables. Can you please tell me if the table is needed to close after every oProp.Action or only when user logout?

Looking into you code in main.prg and it seems you use "USE tablename" in all cases of oProp.Action? I thought that datasession is created when user login. Is datasession per web session or per sended HTML command?

When user closes the explorer and session closes - does table still open?

Sorry for that question - I understand FoxPro but not much understand threads.

Coordinator
Nov 27, 2011 at 3:32 PM
Edited Nov 27, 2011 at 3:34 PM

The table would need to close after every web request -  a very short time.  So, you could close the tables after the HTML is returned in main.prg.  

If it's not a busy site, that could fix it.  However, there's a chance someone else could come in and open the table and lock it preventing exclusive access.  If that's the case, what you need is some sort of 'maintenance mode' that returns a 'site is undergoing maintenance' page to users while you change the table or do other things requiring exclusive access to tables.  This hasn't been programmed by me yet but should be very doable..

Coordinator
Dec 6, 2011 at 7:53 AM

To follow up with this, 

I would suggest you use the 'USE IN alias' to close individual tables you're 
modifying rather than a blanket CLOSE DATA stement that may affect other things.

Once you're done modifying the table, I would strongly suggest leaving it open instead of closing it each time. Performance will be greatly enhanced if you leave it open.
Dec 6, 2011 at 5:59 PM

Has to be closed the table after all individual user web operations (update, append record)? Because even if I placed the "USE IN alias" in all procedures in the main.prg, after the user operation the table stay be opened and subsequent alter of table isn’t possible.

Not much understand your note - I need modify the structure of table very rarely (e.g. per month). But need possibility close the table and use it exclusive for alter when I access to IIS remotely.... I understand that every closing of table make performance worse.

Coordinator
Dec 6, 2011 at 8:10 PM

Did you try putting the Close Data or "USE in alias" in main.prg ??

Dec 8, 2011 at 7:53 AM

Yes, I did.

I am triing to reproduce this issue on my development computer but unsuccessfully. When I open the web page with "action=sessionlist" on live IIS server, the table stay pernamently opened. Same operation on my development computer didn't leave the table opened. It seems that doesn't matter on "USE in alias". I will do other troubleshooting.

Coordinator
Dec 10, 2011 at 1:49 PM
Edited Dec 10, 2011 at 3:09 PM
    * now we'll return the HTML output to the browser
    close data
    RETURN lcHTMLout

In main.prg, this works for me like a charm every time!  I replaced customer.dbf/cdx several times at GoDaddy. 

Now if the site is very,very busy, then it's likely to get used again by the next request coming in.  If you're in charge of IIS, then you just have to stop the Web Application in IIS manager...

-------

For an idea for a maintenance routine on a very,very busy site (possibly remotely hosted), you could comment out the default behaviour in the CASE statement in main.prg, CLOSE DATA, and just throw up a page that says the site is in MAINTENANCE MODE.  When finished, go back into main.prg and uncomment the default behavior for normal running.  You could get fancier and have a page for Administrators that checks Maintenance Mode ON or OFF which updates a DBF setting that is always checked in main.prg.

But I'll leave that to you or somebody else.....