Skip to main content
1-Visitor
March 10, 2014
Question

File transfers with custom certificate fails - [Reason: service-unavailable, message: Could not resolve host and path]

  • March 10, 2014
  • 6 replies
  • 3212 views

Hi again,


We're getting an error when we try to transfer files (both from and to a Thing) now we're using our own custom TLS certificate. Normal connectivity works fine now, properties are synchronized between the server and Things, so thanks for that. 

But file transfers (using the SOCKS protocol) fail. We get the following error in the Application log:



2014-03-10 13:38:11.3060100 id: e9f65f84-7aac-48e0-8acc-c924971d7711 edge FileTransfer validation failed, retrying retry: 1, delay: 1000 msecs: Error occurred during Freeway request: Transaction sid:freeway:9f17000a18864ff4915857b8ebec3c74, element:req, to:console_channel@thingworx.com, thing:FileTransferEdgeThing, host:, port:-1, path:/Things/FileTransferEdgeThing/Services/ValidateFileTransfer, timeout:120000, Error from Edge [<b>Reason: service-unavailable, message: Could not resolve host and path]</b><br></div><div><hr></div><div><br></div><div>After 10 retries, the File Transfer fails with this error:</div><div><hr></div><div>2014-03-10 13:38:21.4400100  (see error log details) [message: id: e9f65f84-7aac-48e0-8acc-c924971d7711 FileTransfer validation attempts failed retries: 10]



When I check with Wireshark, I can see that the file (or at least some encrypted data with the same size as the file, 972,245 bytes) is actually sent through the SOCKS protocol, but then these errors show up, and the file transfer directory on the Thing is empty. 


We're using an internal development server on the same network, so no port forwarding or anything like that occurs.


I've uploaded the log files to our repository (logs.zip). Do you have an idea about what might cause this problem? 


Thanks



    6 replies

    5-Regular Member
    March 10, 2014

    Hi Stefan,

    Can you verify that the Script Resource is running and visible to the EMS? You can do so by executing the GetEdgeThings() Service of your console_channel Channel.


    Thanks,

    Adam



    sbeckers1-VisitorAuthor
    1-Visitor
    March 10, 2014

    If I call that service, the results are:


    port

    host

    name

    path

    keepalive

    proto

    80

    localhost

    CONSOLE

    \/ConnectivityM2MService\/Thingworx

    60000

    http

    80

    localhost

    Instrument003_OldSBC

    \/ConnectivityM2MService\/Thingworx

    60000

    http


    Is that what it should be?



    5-Regular Member
    March 10, 2014

    From the logs you provided, the validate call is trying to access /Things/FileTransferEdgeThing/Services/ValidateFileTransfer​, but it's not being returned when you execute GetEdgeThings(). I assume you're transferring the file to the CONSOLE Edge Thing? If that is the case, you need to go to the Configuration section of your Edge Enhanced Thing and set the File Transfer Edge Thing to "CONSOLE".

    Let me know if this resolve your issue.

    sbeckers1-VisitorAuthor
    1-Visitor
    March 10, 2014

    Apparently, there's no such Thing as 'FileTransferEdgeThing', is that possible? File transfers used to work without setting File Transfer Edge Thing to 'CONSOLE' (i.e. the Thing's name). Anyway, if I set it to 'CONSOLE', the transfer still fails. I uploaded the the logs of this again (log2.zip) in case they can help.

    5-Regular Member
    March 10, 2014

    Thanks, Stefan. Would you be able to provide the EMS and Script Resource logs as well? You can redirect the output to a file or simply copy and paste the logs from the command line. Be sure to run the EMS & Script Resource in TRACE mode.


    Thanks,

    Adam



    sbeckers1-VisitorAuthor
    1-Visitor
    March 17, 2014

    Is that the .evtx-file? If so, I've uploaded it (log.evtx). I've also tried again not using a custom certificate, and then the file transfer succeeds. I've uploaded the server logs again (log3.zip). 


    In the Application Log at 2014-03-11 09:10:52.1880100 to 2014-03-11 09:10:52.2970100, the /Things/FileTransferEdgeThing/Services/ValidateFileTransfer call succeeds, because I used the original Thingworx XMPP certificate. At 2014-03-11 08:58:09.5590100, I'm using our certificate and the same call fails. </div><div style="margin: 0px; padding: 0px;"><br style="margin: 0px; padding: 0px;"></div><div style="margin: 0px; padding: 0px;">Setting File Transfer Edge Thing to 'CONSOLE' instead of 'FileTransferEdgeThing' causes the transfer to fail in both cases (at 2014-03-11 09:00:14.6160100) with an error code (HTTP?) 400.




    But now we've also discovered another problem. If the connectivity settings on the Thing (config.lua) are changed, the Thingworx services have to be restarted (EMS & luaScriptResource). The EMS services can be restarted without a problem, but the luaScriptResource service won't stop (in services.msc, even after waiting 10 minutes). This also only happens when we use a custom certificate.



    sbeckers1-VisitorAuthor
    1-Visitor
    March 11, 2014

    Is that the .evtx-file? If so, I've uploaded it (log.evtx). I've also tried again not using a custom certificate, and then the file transfer succeeds. I've uploaded the server logs again (log3.zip). 


    In the Application Log at 2014-03-11 09:10:52.1880100 to 2014-03-11 09:10:52.2970100, the /Things/FileTransferEdgeThing/Services/ValidateFileTransfer call succeeds, because I used the original Thingworx XMPP certificate. At 2014-03-11 08:58:09.5590100, I'm using our certificate and the same call fails. </div><div><br></div><div>Setting File Transfer Edge Thing to 'CONSOLE' instead of 'FileTransferEdgeThing' causes the transfer to fail in both cases (at 2014-03-11 09:00:14.6160100) with an error code (HTTP?) 400.




    But now we've also discovered another problem. If the connectivity settings on the Thing (config.lua) are changed, the Thingworx services have to be restarted (EMS & luaScriptResource). The EMS services can be restarted without a problem, but the luaScriptResource service won't stop (in services.msc, even after waiting 10 minutes). This also only happens when we use a custom certificate.



    5-Regular Member
    March 17, 2014

    Hi Stefan,

    Can you provide the output of the twems and Lua Script Resource when you attempt this file transfer with your custom certificate? You can do this by redirecting the output from those programs to a file or you can simply copy and paste the output from the command-line.


    Thanks,

    Adam



    sbeckers1-VisitorAuthor
    1-Visitor
    March 17, 2014

    Hi Adam,

    Ok, when I run Lua Script Resource from the command line, it crashes after 2 seconds, with the error "Fatal : Search only allowed on sorted string lists", in a Message Box. I've upload the logs (twfail.txt &amp; luafail.txt), and the root certificate specified by agent.cert_file (Thingworx.crt). It looks like the error occurs when the crt file is opened/parsed, at least that's the last line in the Lua log file. 


    Thanks



    5-Regular Member
    March 18, 2014

    Stefan,

    We're testing a possible fix. I'll keep you updated with our progress.


    Thanks,

    Adam



    sbeckers1-VisitorAuthor
    1-Visitor
    March 18, 2014

    Ok, thanks