{"action":"created","issue":{"url":"https://api.github.com/repos/openhab/openhab/issues/4835","repository_url":"https://api.github.com/repos/openhab/openhab","labels_url":"https://api.github.com/repos/openhab/openhab/issues/4835/labels{/name}","comments_url":"https://api.github.com/repos/openhab/openhab/issues/4835/comments","events_url":"https://api.github.com/repos/openhab/openhab/issues/4835/events","html_url":"https://github.com/openhab/openhab/issues/4835","id":192100414,"number":4835,"title":"[http] timeout setting for \"sendHttpGetRequest\"","user":{"login":"binderth","id":9037329,"avatar_url":"https://avatars.githubusercontent.com/u/9037329?v=3","gravatar_id":"","url":"https://api.github.com/users/binderth","html_url":"https://github.com/binderth","followers_url":"https://api.github.com/users/binderth/followers","following_url":"https://api.github.com/users/binderth/following{/other_user}","gists_url":"https://api.github.com/users/binderth/gists{/gist_id}","starred_url":"https://api.github.com/users/binderth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/binderth/subscriptions","organizations_url":"https://api.github.com/users/binderth/orgs","repos_url":"https://api.github.com/users/binderth/repos","events_url":"https://api.github.com/users/binderth/events{/privacy}","received_events_url":"https://api.github.com/users/binderth/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-11-28T19:50:10Z","updated_at":"2016-11-29T10:34:15Z","closed_at":"2016-11-28T20:45:35Z","body":"## Expected Behavior\r\nIn the config-file (here http.cfg, openHAB2) you can define the timeout for http-binding:\r\n```\r\n# timeout in milliseconds for the http requests (optional, defaults to 5000)\r\ntimeout=20000\r\n```\r\nThis timeout should be applied to every function/method of the binding, in my case also for `sendHttpGetRequest`.\r\n\r\n## Current Behavior\r\nCurrent Behaviour is, the timeout doesn't apply to the `sendHttpGetRequest` call.\r\nI use the function in a rule:\r\n```\r\n\tpostUpdate(Nuki_EG_door_locked, OFF) \r\n\tsendHttpGetRequest(\"http://192.168.xx.xx:8080/lockaction?token=xx&nukiid=xx&action=3\")\r\n```\r\nat first, the item is changed, then the http-request ist sent (in this case a Nuki Smartlock, which holds the latch open for 5secs).\r\nThis is the result in the logfile:\r\n```\r\n2016-11-28 12:13:16.530 [INFO ] [.eclipse.smarthome.model.script.Nuki] - Der Zustand von Nuki wurde geändert: ON\r\n2016-11-28 12:13:21.523 [ERROR] [.smarthome.model.script.actions.HTTP] - Fatal transport error: {}\r\njava.io.IOException: java.util.concurrent.TimeoutException\r\n\tat org.eclipse.smarthome.io.net.http.HttpUtil.executeUrl(HttpUtil.java:236)\r\n\tat org.eclipse.smarthome.io.net.http.HttpUtil.executeUrl(HttpUtil.java:130)\r\n\tat org.eclipse.smarthome.io.net.http.HttpUtil.executeUrl(HttpUtil.java:86)\r\n\tat org.eclipse.smarthome.io.net.http.HttpUtil.executeUrl(HttpUtil.java:65)\r\n\tat org.eclipse.smarthome.model.script.actions.HTTP.sendHttpGetRequest(HTTP.java:40)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_111]\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_111]\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_111]\r\n\tat java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_111]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1085)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1060)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1046)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:991)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:114)[127:org.eclipse.smarthome.model.script:0.9.0.201611191809]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:901)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:864)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:223)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:446)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:227)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:459)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:243)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:446)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:227)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:463)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:243)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:446)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:227)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:189)[143:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]\r\n\tat org.eclipse.smarthome.model.script.runtime.internal.engine.ScriptImpl.execute(ScriptImpl.java:77)[128:org.eclipse.smarthome.model.script.runtime:0.9.0.201611191809]\r\n\tat org.eclipse.smarthome.model.script.engine.ScriptExecutionThread.run(ScriptExecutionThread.java:42)[127:org.eclipse.smarthome.model.script:0.9.0.201611191809]\r\nCaused by: java.util.concurrent.TimeoutException\r\n\tat org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:109)\r\n\tat org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:655)\r\n\tat org.eclipse.smarthome.io.net.http.HttpUtil.executeUrl(HttpUtil.java:219)\r\n\t... 35 more\r\n```\r\nFrom my point of view, there's a timeout after 5secs, if I didn't configure something different...\r\n\r\n## Possible Solution\r\n1. apply the timeout of the config-file to all functions and methods within the binding\r\n2. put in more arguments for those functions, which could be used freely, like `sendHttpGetRequest` and enable different timeouts depending on Code\r\n3. both! :)\r\n\r\n## Steps to Reproduce (for bugs)\r\n<!--- Provide a link to a live example, or an unambiguous set of steps to -->\r\n<!--- reproduce this bug. Include code to reproduce, if relevant -->\r\n1. define timeout >5000ms in config\r\n2. use `sendHttpGetRequest` on a page loading longer than 5000ms\r\n3. see timeout in log\r\n\r\n## Context\r\nIn my case it's nothing broken, as the Nuki Smartlock is receiving the signals and behaving like intended. But there's ugly ERRORs in the logfile. In the Long run, I'd like to have an error-free log, so I can have notifications if there are any with an logfile-analyzer.\r\nSo, I could make a workaround using e.g. curl with `executeCommandLine`, so there's no more ERRORs in the logfile, but if there would be some problem with the Nuki-Call, it's a bit more complicated to get the answer (INFO or ERROR) in the openhab.log - if at all. I must check the system logs for ERRORs of curl also.\r\nPlus, I could parse the answer of the requested URL  (in this case the Nuki Smartlock) for a success statement (in this case the answer is JSON and also tells me if the batteries are running low, which could then be updating an item, telling me to change them... ;) )\r\n\r\n## Your Environment\r\n* Version used: openHAB2, http-binding 1.9\r\n* Environment name and version (e.g. Chrome 39, node.js 5.4, Java 8, ...): JAVA8\r\n* Operating System and version (desktop or mobile, Windows 10, Raspbian Jessie, ...): Rasbian Jessie (openHAB2 Image starter)\r\n"},"comment":{"url":"https://api.github.com/repos/openhab/openhab/issues/comments/263534772","html_url":"https://github.com/openhab/openhab/issues/4835#issuecomment-263534772","issue_url":"https://api.github.com/repos/openhab/openhab/issues/4835","id":263534772,"user":{"login":"kaikreuzer","id":3244965,"avatar_url":"https://avatars.githubusercontent.com/u/3244965?v=3","gravatar_id":"","url":"https://api.github.com/users/kaikreuzer","html_url":"https://github.com/kaikreuzer","followers_url":"https://api.github.com/users/kaikreuzer/followers","following_url":"https://api.github.com/users/kaikreuzer/following{/other_user}","gists_url":"https://api.github.com/users/kaikreuzer/gists{/gist_id}","starred_url":"https://api.github.com/users/kaikreuzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaikreuzer/subscriptions","organizations_url":"https://api.github.com/users/kaikreuzer/orgs","repos_url":"https://api.github.com/users/kaikreuzer/repos","events_url":"https://api.github.com/users/kaikreuzer/events{/privacy}","received_events_url":"https://api.github.com/users/kaikreuzer/received_events","type":"User","site_admin":false},"created_at":"2016-11-29T10:34:15Z","updated_at":"2016-11-29T10:34:15Z","body":"> sorry if this question is stupid: but which class is used, if invoked from within e.g. an openHAB rule?\r\n\r\nNot stupid at all! The one in openhab-core (which IS part of openHAB 2) is only for backward compatibility reasons, since a couple of openHAB 1 bindings are using this class (in the org.openhab namespace), so it was not possible to remove it, but it had to be kept as part of the (optional) compatibility layer.\r\n\r\nThe HTTP class in eclipse/smarthome is indeed the one that is used when you create scripts and rules, so this is indeed the right one to adapt for your use case."}}
{"actor":{"display_login":"kaikreuzer"}}