Link to home
Start Free TrialLog in
Avatar of Taurus
Taurus

asked on

CFtpConnection::GetFile causes problem.

I am experiencing a problem in an app.  where I use CFtpConnection::GetFile.  The problem is that the files once touched by GetFile and retrieved won't then delete.  That means not via FTP, not via local network access, and only sometimes when deleting from the local NT Server (4.0 SP5 IIS 4.0)itself.  I am getting an access denied msg in all cases.  Some of the files won't delete ever, short of rebooting.  

When logged on locally as Administrator and I try to take ownership of the file in ?, I get another access denied msg.  Note administrator on this server is a member of the admin group and this group is given change ownership priviledges.   Anyway, Its got me stumped as to why something isn't releasing these file(s).  

Any useful suggestions are greatly appreciated!
Avatar of mikeblas
mikeblas

Unfortunately, this is a bug in IIS. Last time I asked about it, they said they'd fix it in SP5, but I guess they haven't.

The problem is that IIS maps a view of the file to send it. It takes a long time for that view to fall out of IIS' cache, and the file remains locked throughout that time.

..B ekiM
Avatar of Taurus

ASKER

How long does it take for the file to fall out of the cache?  I have 3 files created over a day ago.  They are still in the ftp dir. and cannot be removed unless I re-boot.  When attempting to take ownership of the files I receive an access denied msg (logged on as admin w/ admin group having change owner permissions).  

Further putting this all in to question is that the ftp part of the app. was working!  I tested it on many occasions.  What has changed recently: 1) the Server was upgraded from a P75 NT 4.0 SP3 & IIS 4 to PII 266 NT 4.0 SP 5 & IIS 4.  2) The upgraded server's proxy software was re-loaded 3) The machine I develop the app. on changed from NT workstation to W98 re-installing VC 5.0 and SP3.  

With the exception of 1) none should be relevant.

ASKER CERTIFIED SOLUTION
Avatar of mikeblas
mikeblas

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Taurus

ASKER

I uploaded SP6 (avail. since Oct. 28th) and the problem seems to have gone away again so perhaps you are correct in the first place partially.  I know that it was working with SP3 so I guess it unfixed itself?  

Per my question about uncaching the machine has 128MB of ram and isn't very busy.  The files that were "accessed denied" didn't ever appear to be accessible even after a couple of days.  

I looked at each of the KB Articles you mentioned. Q182626 was one I already dealt with.  The MS suggested work around for that one wasn't at all bullet proof and I had to do a few hours of extra work to get around it safely (after figuring what the problem was -- several more hours).  Per the other two KB articles -- Not exactly my problem but close.  This leaves me wondering if IIS can be relied upon at all?  What does MS use in its products that use ftp and does MS use IIS for its sites?

I'll close this question following your response.
Avatar of Taurus

ASKER

I thought I'd post the psuedocode for ugly work-around I had to impliment per KB article -- Q182626 "Access Is Denied When Attempting to Put Files on FTP Server"

Create 5 STL string  sets to hold  filenames(pseudo code):

Enumerated_Set //holds the file names from the non-local directory
Downloaded_Set//holds the file names of files successfully downloaded
ToDelete_Set//holds the file names of files to be deleted
Deleted_Set// holds the file names of files that the remove function returned a success flag for, but that are not yet deleted
VerifiedDeleted_Set//holds the names of files that are verified to be deleted when re-enumerating the files in the ftp directory.

Re-entrant about every 5 seconds
 |
 V
Clear Enumerated_Set
Clear VerifiedDeleted_Set
Enumerate ftp directory and add returned  filenames to Enumerated_Set
 |
 V
For each filename in Deleted_Set// first iteration thru this set should be empty
{
   If filename is not in Enumerated_Set
   {
       //its not there so IIS must have deleted it!
       Add filename to VerifiedDeleted_Set
   }
}

For each filename in VerifiedDeleted_Set//first iteration thru this set should be empty
{
   Delete filename from Deleted_Set
   Delete filename from DownLoaded_Set
}
 |
 V
For each filename in Enumerated_Set
{
   If filename is not in Downloaded_Set//if its in this set its already been downloaded
   {
       success = GetFile(filename)//download
   }
   If(success)
   {
       Add Filename to Downloaded_Set
       Add Filename to ToDelete_Set
   }
}
 |
 V
For each filename in ToDelete_Set
{
   success = Remove(Filename)
    If(success)
   {
       Add to Deleted_Set
   }
}
For each filename in Deleted_Set
{
   If ToDelete_Set is not empty
   {
       Delete filename from ToDelete_Set
   }
}
 |
 V
           Return
Avatar of Taurus

ASKER

My above psuedo code is for enumerating, then downloading, then deleting the files on a ftp site.  

The KB article Q182626 describes the problem for uploading rather than downloading files.  However the problem that the IIS FTP server caches the file handles and won't delete the file immediately when commanded is essentially the same issue.
> the machine has 128MB of ram and isn't very busy.
 > The files that were "accessed denied" didn't ever
 > appear to be accessible even after a couple of days.  

Indeed, in such a situation, the file would be cached nearly forever. With little activity on the machine, there's little reason for the server to push the file out of memory.

..B ekiM