sendHttpGetRequest issue [solved]

Hi,

Due to unknown reason one of my rules stopped working, it involves a sendHttpGetRequest, when using it directly in a local browser, all works fine and it returns the expected string but in the rule I see a timeout in the log file:

2018-10-17 15:30:20.497 [ERROR] [.smarthome.model.script.actions.HTTP] - Fatal transport error: java.util.concurrent.TimeoutException

2018-10-17 15:30:20.504 [INFO ] [smarthome.model.script.rule callerID] - name lastnumber: null

2018-10-17 15:30:20.510 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'callerID': cannot invoke method public java.lang.String java.lang.String.replaceAll(java.lang.String,java.lang.String) on null

The script is straight forward :

sendHttpPutRequest("http://192.168.2.22/openhab/cid_add2db.php?number=" + cidNumber.state)
Thread::sleep(1000)
var String tempName = sendHttpGetRequest("http://192.168.2.22/openhab/cid_lastnumber.php",5000)

The putRequest stores a number in the database (works, confirmed), but the getRequest generates a timeout but not when running in a browser.

Any thoughts please?

BTW The script always use to work but perhaps an update stopped it but cannot remember when this happened.

-ben

Did you try increasing the time out?

Yes I did, same issue.
Also replaced sendHttpGetRequest using CURL, same result.

It looks like it is a PHP programming problem, when I comment out some sql statements and echo a simple text, all works well.
As soon as it does a sql-query there is a timeout, except when running from a browser or using curl from the command line …

It turned out that calling from openhab it took very long time to execute the SQL statement (inside PHP code) while from cmdline or browser it was much quicker.
Changed SQL statement and now MUCH faster …

-ben

I have the same problem. How did you change SQL statement?