cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

./luaScriptResource hangs on thingworx.handler: Creating a new handler.

Re: ./luaScriptResource hangs on thingworx.handler: Creating a new handler.

If

-EMS and LSR are executed on a Linux env

-TLS is disabled

-a connection has established to ThingWorx platform using WSEMS

-there are no Errors logged in WSEMS and LSR logs,

-but the LSR hangs and the last fewlines of LSR look like this -

[TRACE] 2018-04-05 19:38:11,615 luaBindings:newRapClient: Found RAP at 10.0.2.15:8000
[TRACE] 2018-04-05 19:38:11,615 luaBindings: Got RAP timeout: 0
[TRACE] 2018-04-05 19:38:11,615 luaRapBindings: Self Signed certificates are enabled for the RAP conneciton.
[TRACE] 2018-04-05 19:38:11,615 luaRapBindings: Certificate validation is enabled for the RAP conneciton
[DEBUG] 2018-04-05 15:38:11,616 SDK: twTlsClient_Create: Initializing TLS Client

 

then it could be the bug reported with EMS 5.4.0. when run on Debian 9(stretch)/Ubuntu.

 

Workaround is to configure EMS and LSR to use TLS or to use a EMS version 5.3.4.

 

 

Re: ./luaScriptResource hangs on thingworx.handler: Creating a new handler.

I installed EMS 5.4.0 on Linux Centos7 and met the same problem, ssl is false in <http_server> segment.

- wsems started successfully

- lua started and hanged with below as last output, apparently it hanged...

-------------------------<Lua log>-----------------------

[INFO ] 2018-05-15 02:15:06,465 Edge540Thing: ------------------------------------------------
[INFO ] 2018-05-15 02:15:08,435 Edge540Thing: -- Starting script --------------------------
[INFO ] 2018-05-15 02:15:08,435 Edge540Thing: Registering core callback handler
[INFO ] 2018-05-15 02:15:08,435 Edge540Thing: Starting main loop
[INFO ] 2018-05-15 02:15:08,435 Edge540Thing: Calling lifecycle start listeners.
[INFO ] 2018-05-15 02:15:08,435 handlers.http: Opened
[INFO ] 2018-05-15 02:15:08,435 handlers.script: Opened
[INFO ] 2018-05-15 02:15:08,435 handlers.generator: Opened
[INFO ] 2018-05-15 02:15:08,435 shapes.propsubscribe: Initialized
[INFO ] 2018-05-15 02:15:08,436 thingworx.handler: Creating a new handler.

 

Then I  changed ssl to true in <http_server> segmen as below.Good news is that lua started successfully.

Bad news is that lua failed to connect with ems server thus no property update could be seen on Thingworx side.

And in lua log, I noticed there is a Http code 503 error.

-------------------------config.json-----------------------

"http_server" : {
        "host": "localhost",
        "port": 8000,
        "ssl" : true,
        "authenticate" : true,
        "user": "cui",
        "password": "ptc",
        "use_default_certificate" : true
    },

-------------------------config.lua-----------------------

scripts.rap_host = "localhost"
scripts.rap_port = "8000"
scripts.rap_ssl = true
scripts.rap_server_authenticate = true
scripts.rap_validate = false
scripts.rap_deny_selfsigned = false
scripts.rap_userid = "cui"
scripts.rap_password = "ptc"

-------------------------partial lua log-----------------------

[ERROR] 2018-05-15 01:59:44,144 HttpClient::processReq: Timeout while waiting for response from localhost.
[ERROR] 2018-05-15 01:59:44,144 luaBindings::httpPost★: Error POSTing to HTTP Server at localhost/Thingworx/Things/LocalEms/Services/AddEdgeThing
[INFO ] 2018-05-15 01:59:44,145 Edge540Thing: Error occured while accessing EMS. Checking isConnected.

[ERROR] 2018-05-15 02:00:14,153 HttpClient::processReq: Timeout while waiting for response from localhost.
[ERROR] 2018-05-15 02:00:14,153 luaBindings::httpGet★: Error GETing from HTTP server at localhost/Thingworx/Things/LocalEms/Properties/isConnected
[INFO ] 2018-05-15 02:00:14,153 Edge540Thing: EMS is available: false, online: false
[WARN ] 2018-05-15 02:00:14,153 Edge540Thing: Could not register with the MicroServer. ★code: 503, msg: Error attempting HTTP POST

 

Still not clear on below issues. Anyone has any clue??

1. why lua fails to start when not using SSL connection with ems server.

2. why lua fails to connect with ems server when using SSL connection.

Re: ./luaScriptResource hangs on thingworx.handler: Creating a new handler.

Below are personal testing result.

For Linux, ems<->lua and lua<->device must be set with SSL to work normally. While for windows, non SSL settting can work well.

・http_server/scripts.rap_xxx
・scripts.script_xx  

 

Seems to be a bug and will report to RnD later.

Re: ./luaScriptResource hangs on thingworx.handler: Creating a new handler.

could you please give me the link for ems 5.3.4, i can't find it anywhere.

Re: ./luaScriptResource hangs on thingworx.handler: Creating a new handler.

Hi,

Can you please post your files. I would try to get my system also running.