Skip to main content
Participant
October 18, 2021
Question

Getting Keep Alive error while connecting to FTP server cfom CF18.

  • October 18, 2021
  • 2 replies
  • 269 views

Hi All,

Our Prod environment hosted on CF18 connects to a FTP server to place some files through a schedule job. The client complains that they getting multiple keep alive requests per second which is causing a big drain on their resources. We initially thought some error with the job and restarted the job which was scheduled for the next morning. We din't get any keep alive erros until the next moring but once the job run we got the error again. We also tried moving the codebase to a new CF instance but that din't help either. Have checked for the FTP connections and they are indeed closing. At a loss as to what is happening. Any insights would be very helpful.

 

Thanks,

Abhi.

    This topic has been closed for replies.

    2 replies

    BKBK
    Community Expert
    Community Expert
    October 21, 2021

    At this point I only have questions, as I don't yet understand your process. My understanding is:

     

    1.  Your Coldfusion application runs a scheduled task. The task connects to an FTP server, placing files there.
    2.  The client's application is located on a separate server and is independent of your application. The client connects to the same FTP server and interacts with the files you placed there. It is during such interactions that the client experiences keep-alive issues.
    3.  There is no overlap between the time windows in which you upload the files and the client interacts with them.

     

    Do I understand the process correctly?

     

    Could you share the FTP code that you use?

    Charlie Arehart
    Community Expert
    Community Expert
    October 19, 2021

    I haven't heard of that before, but cfftp is not among the more commonly used tags, so we may not hear of such an issue often. And different ftp servers can have different settings that could influence a situation like this. That said, there are a few things I'd offer:

     

    First, are you by any chance setting the CONNECTION attribute for the cfftp to be a name that starts with "session." or "application."? It may not be obvious but that becomes a variable (like the NAME on a cfquery), which could be used to refer to the connection in a cfdump, for example. And CF has a perhaps-unexpected behavior--though it's documented--where an ftp connection remains open even after the request ends, if that connection name starts with "session." or "application.". That MAY lead to the keep-alive issue you indicate. For more on that, see the docs (search for "keep" on the page) :

     

    https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-f/cfftp-opening-and-closing-secure-ftp-server-connections.html

     

    If that's not it, two more things :

    • You say in the subject there is an error, but to be clear there's no error message, right? Perhaps you regard the keep-alive behavior as "erroneous", but it may just be "unexpected"
    • And you say that the folks running the ftp server complain that it's "a big drain on resources". I wonder if that's really so. I mean, again they may be concerned that it's "unexpected", but I'd be surprised that even many keep-alive requests per second would alone would cause a "big drain"

     

    I appreciate those last two points could come off as off-putting. I offer them simply in case the first point I raised is not the answer/solution. Please let us know, either way. 

    /Charlie (troubleshooter, carehart. org)
    Participant
    October 20, 2021

    Hi Charlie, 

    Thanks a lot for the help. I did check the connection variables and none of them are of the application or session scope. I am attaching the snapshot of the requests the client is recieving on their FTP server. 

    And sorry to put it as "big drain on resources" which is a bit overboard, but that is how the client has been complaining about it. Thank you again for all the help.

    Charlie Arehart
    Community Expert
    Community Expert
    October 21, 2021

    Thanks for the clarifications. The messages being several per second certainly would be disconcerting. Here are more things to consider:

    • What are the attributes of your cfftp (other than username, password, and server)? Have you tried any alternatives for those attributes?
    • Also, let's narrow things down. You say this is a scheduled task that does a cfftp. What if you just do the open action, alone. Does that create these requests on their end? I realize that will take effort to coordinate with them. Track the time you do it, then tell them that time, and ask them to look in their logs. (You'll need to make sure you coordinate between your time and the server time.)
    • What about when you add whatever next CFFTP operation (from the request called via the scheduled task)? We need to figure out WHAT part of the CFFTP operation causes the problem.
    • You say the problem continues after the task is done. Do you have any monitor on CF that tells you whether the CF request is still running, after the task? It's possible. Similarly, the page you are calling (in the task) may be doing a cfthread to run the cfttp,  in which case it's running disconnected from the request itself. The CF PMT and FusionReactor monitors can watch cfthread operations.

     

    I appreciate you may have hoped someone may just have "the answer" for you. Some problems are just too subtle to readily see "the answer", though once we find it we may smack our heads for not thinking of it sooner.

    /Charlie (troubleshooter, carehart. org)