Error 17

We have been using SmartFTP library version 1.5 for several years now. We recently upgraded to version 2 because of a random crashing error in 1.5. Version 2.0 fixed the crashing error, but now we have a new issue. On rare occassions, we get an Error 17 - ftpErrorLicense. This will continue to happen until our application is restarted. The code to initialize the license key has not changed from 1.5. The code we use to write the licence key is show below and we only call this once at the start of our application.

Any suggestions on what this may be?

Thanks,
Graham

sfFTPLib::IGlobalPtr pGlobal; 



if (SUCCEEDED(pGlobal.CreateInstance(__uuidof(sfFTPLib::Global)))) 

{ 

    // Load the licence file into the DLL 

    if (pGlobal->LoadLicenseKeyData(_szLicence)) 

    { 

        m_bCreated = TRUE; 

    } 

    else 

    { 

        AfxMessageBox(_T("Failed to load FTP license key data."), MB_ICONERROR); 

    } 

} 

else 

{ 

    AfxMessageBox(_T("FTP not found."), MB_ICONERROR); 

}

The licence key for version 2.0 is 400133629

I should also have mentioned that the LoadLicenseKeyData succeeds, but when we try to connect we get the error 17.

Can you provide a sample which reproduces the problem?

There is no reliable way to reproduce the problem. During our testing we have seen the issue about 5 times - out of probably hundreds of times which we've ran our application. It was not isolated to one machine.

Even though the chances of this happening are slim, we don't know how this will affect customers, so are holding off releasing an update to the software which includes the latest ftp lib until we know more.

I can send you the C++ class I use that wraps your library, but I can't send sample code that you can run that triggers the error.

Graham

Ultimately we need a way to reproduce it.

Try to enable logging:
pGlobal->LogFile = _T("c:\\temp\\sfFTPLib.log");

If the license key fails to load, additional debug information is written to the .log file.

The logging has been enabled since we first discovered the issue. The log is empty other than one line that shows the version of the library.

Have you ever tried to put the LoadLicenseKeyData() function into a loop with 1M iterations?

No I haven't. We have not seen LoadLicenseKeyData() fail. That has always succeeded and we just get error 17 when we try to connect to an ftp server.

I assume that you are calling LoadLicenseKeyData() just once and not for every new connection. If this is the case, did you try to reproduce the problem by repetitively calling Connect()? E.g. from different threads.

Correct. I only call it once at the start of the program. Repeatedly calling Connect() does not cause the issue.

We have had this issue on 5 different machines. However, it has only ever happened once for each machine. It may be that it only ever happened the first time the application was run with the new ftp lib, but we can't be sure of that. I wonder if there is anything different about the first time the library is used that is different than the subsequent times that could cause LoadLicenseKeyData to succeed but still cause Error 17?

We are currently testing with Virtual Machines to see if we can reproduce the issue.

To your question: No it's stateless and hence there is nothing different.

Do you see there being any side effects if we called LoadLicenseKeyData before each time we Connect?

Yes. You should only call it once.

I've just had the issue again. I have our application running on a virtual machine (XP virtual machine within Microsoft Virtual PC hosted on Windows 7 64 bit). The app was running without issue. The virtual machine was then hinernated. 6 days later (today) I restarted the virtual machine. Our app is still running, but now as soon as I try to connect I get Error 17.

Is there some timeout in the license key due to inactivity possibly?

Graham

Only line in the log is

SmartFTP FTP Library 2.0.101.0

There is no timeout or anything like that. How do you set the log file? Can you post the lines from the code?

HRESULT hr = m_ftp.CreateInstance(__uuidof(sfFTPLib::FTPConnectionMTA)); 

if (SUCCEEDED(hr)) 

{ 

    m_bInitialised = TRUE; 



    // Perform basic initialisation 

    m_ftp->UseMessageLoop = VARIANT_FALSE; 

    m_ftp->Protocol = sfFTPLib::ftpProtocolNormal; 

    m_ftp->Passive = CAppPrefsIP::bGetPassiveFTP() ? VARIANT_TRUE : VARIANT_FALSE; 

    m_ftp->Async = VARIANT_FALSE;// Not asynchronous 

    m_ftp->Proxy->Type = sfFTPLib::ftpProxyTypeNone; 

    m_ftp->HidePassword = VARIANT_TRUE; 

    m_ftp->LogFile->File = _T("C:\\FTPLOG.TXT"); 



    // Set timeout 

    m_ftp->Timeout = nGetRegistryInt (REG_SECTION_GENERAL, _T("FTPTimeout"), 30, FALSE);// 30 second timeout 

}

You need to enable the global log as of my previous post:
>Try to enable logging:
>pGlobal->LogFile = _T("c:\\temp\\sfFTPLib.log");