Question Lawrence Davis · Feb 6, 2019

Business Service Delete Error

While processing large HL7 files via ftp the Business Service errors when trying to deleting the file.  All the messages process fine just the delete step errors.  Is there is setting that would help this?

Comments

Eduard Lebedyuk · Feb 6, 2019

Two ways to solve this error:

  • Change permissions for the OS user you use to connect to the FTP so the user can delete (write permission) files
  • Set service setting DeleteFromServer to 0
0
Lawrence Davis  Feb 6, 2019 to Eduard Lebedyuk

We would want the Business Service to delete the file, which it can do just fine if the file is smaller.  I have tried a file in the KB; file is deleted no error.  Same process tried a file 34 megs and the delete error happens.  It seems like it might be trying to delete the file before the Business Service or Business operation has finished processing the messages so it see the file as being is use.  If so that is true, is there a way to slow down the delete process to give time for the give time for processing to finish.

0
Eduard Lebedyuk  Feb 6, 2019 to Lawrence Davis

Are you using EnsLib.FTP.InboundAdapter?

Deletion happens after file is processed.

What error are you getting?

File size absolutely should not affect deletion result.

0
Lawrence Davis  Feb 12, 2019 to Eduard Lebedyuk

Yes, I am using EnsLib.FTP.InboundAdapter.

Error doesn't say much "ERROR <Ens>ErrGeneral: Failed to delete 'testfile.dat'
from FTP server after successful processing - :"

0
Peter Pozerski · Dec 22, 2023

Have had a similar problem.  Likely the issue is your FTP server needs to increase its timeout settings.  
 

You could try extending the FTP adapter and overriding the delete method as follows:

Method delete(pFilename As %String, pFileDir As %String) As %Boolean
{
Set tSC=..setFilePath(pFileDir,.tOldDir) If $$$ISERR(tSC) $$$LOGSTATUS(tSC) Quit 0 }
Set tOK=$S(..%isSFTP:..FTP.DeleteSSH(pFilename),1:..FTP.Delete(pFilename))

if 'tOK

{

if ..Connected set tSC=..Disconnect(1)
Set tSC=..Connect(..ConnectTimeout,1)
Set tOK=$S(..%isSFTP:..FTP.DeleteSSH(pFilename),1:..FTP.Delete(pFilename))

}
Do:'tOK ..disconnectOnNetErr(,1)
If ..Connected Set tSC=..restoreFilePath(tOldDir) If $$$ISERR(tSC) $$$LOGSTATUS(tSC) Quit 0 }
Quit tOK
}

If tOK returns an error, you failed to delete.  this change will disconnect from the server, reconnect and delete again.  As the most likely issue is you are not connected this will work around your ftp server's timeout.  
The other option is to update your FTP server to have a larger timeout window.

0