Guest

Preview Tool

Cisco Bug: CSCvj14651 - Provide more informative trap messages for sftp transfer reporting failures

Last Modified

Jul 02, 2018

Products (1)

  • Cisco Mobility Services Engine

Known Affected Releases

10.0.0 10.1.0

Description (partial)

Symptom:
As per description, a com.jcraft.jsch.ChannelSftp.rename operation. 

I'm looking through the code for this class here: https://github.com/is/jsch/blob/master/src/com/jcraft/jsch/ChannelSftp.java with the rename function at 1448. 

Instead of throwing an exception with no info, qns should print the rename's src and destination. This would help a lot in troubleshooting this problem. It wasn't until I found the code and read through it that I discovered the conditions of the alert, and went to the remote server and found a file from March 20th already in place (after turning on sftp verbose logging). 

It seems the qns-1 process is transferring the file with an sftp put to .[cdr-filename].tmp, and then doing a rename(.[cdr-filename].tmp, [cdr-filename]). This latter throws an alert.

In addition to printing the source and destination, CPS could optionally check if the file already exists using the method:  
    public SftpATTRS stat(String path) throws SftpException{
on line 1718, and print an error. 

I note there is this attribute:
  public static final int OVERWRITE=0;

However, the attribute is not being used in the local sendRENAME function. I suppose one could also make a patch to the open source Jsch project to allow this, and make it an option within policy builder, but that would be a lot of work. Alternatively, you could have an option to remove the file if it already exists

To recap, my suggestions are:
1) When a rename exception occurs, print the source and destination filenames. This should cover a variety of exceptions (permission issue, file already exists, etc)
2) Carry out a stat() call prior to the rename to see if the file exists, and print an exception
3) Possibly, if motivated, provide an operation to remove the existing file if it already exists on the server (doing a stat then rm)

Conditions:
An exception could occur under a number of conditions, for instance from http://www.tutorialspoint.com/unix_system_calls/rename.htm or from a network issue, or a local permission issue. We're just looking to print something useful other than dump a stack trace.
Bug details contain sensitive information and therefore require a Cisco.com account to be viewed.

Bug Details Include

  • Full Description (including symptoms, conditions and workarounds)
  • Status
  • Severity
  • Known Fixed Releases
  • Related Community Discussions
  • Number of Related Support Cases
Bug information is viewable for customers and partners who have a service contract. Registered users can view up to 200 bugs per month without a service contract.