-
Notifications
You must be signed in to change notification settings - Fork 780
Proxy time-outs #3184
Comments
For all completeness, nginx is running on the same host as OH, and the upstream URL work fine when used directly in a browser Mental self-note: check if related to openhab/openhab-distro#423 |
Can you test without nginx? |
@maggu2810 Did a quick check without nginx and the outcome is the same. So it is not nginx related. I will try to attach a debugger |
@watou @maggu2810 I am really wondering if the above issue is introduced by #2753?
This goes well beyond my understanding of the underlying Jetty proxy classes, so I leave it up to you guys to figure out what is going on. |
For completeness, I have tried to load an image coming from another type of appliance : same result.... |
@maggu2810 were you able to reproduce the problem? |
@kgoderis I edit your two posts, so the logs are marked as pre-formatted text -- much better to read. I haven't tried to reproduce the problem, yet. |
@maggu2810 The installation I tried it on is a plain-vanilla "Ubuntu apt-get" installation, adjusted for my own configs and with nginx. |
@kgoderis Sorry, but I don't know how I can setup a demo configuration to reproduce the problem. |
@kaikreuzer @maggu2810 I spend the last week investigating the issue, it was quite an adventure, and I made some progress but no resolution whatsoever. The problem is impossible to replicate. I installed a fresh new Ubuntu in a VM, and installed the latest SNAPSHOT OH2, and everything runs quite OK. Then I made sure that my own environment was identical to this running version (even dit literal file content comparisons between the 2 instances). That is , same SNAPSHOT, same JVM, same configs for OH2 (apart for bindings). Still my own environment was not proxying. I nailed the issue to the SocketAddressResolver at https://github.com/eclipse/jetty.project/blob/jetty-9.2.19.v20160908/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java#L533 not being able to "resolve" the host address. This SocketAddressResolver does nothing more than creating a SocketAddress but it goes through an Executor and Jetty's own QueuedThreadPool implementation (https://github.com/eclipse/jetty.project/blob/jetty-9.2.19.v20160908/jetty-util/src/main/java/org/eclipse/jetty/util/SocketAddressResolver.java#L133) . In short, the ThreadPool or the Executor of that SocketAddressResolver is not working. If I modify the ESH Proxy to use only BlockingProxyServlet everything works. If I create my own version of the SocketAddressResolver everything works (see below). So, for some @#$#% reason, the Executor/QTP is failing. Do you know of anything that could influence the functioning of Executors in the runtime? I mean, they are running fine for other bindings/places where they are used, but not here.
I noticed that we are using jetty.util 9.2.19, it seems a bit dated (e.g. 9.4.x is available). For some reason in Eclipse the TP always resolves to 9.2.12, and in that version the SocketAddressResolver has a different signature. |
@maggu2810 @kaikreuzer I did the following test: I installed the latest snapshot (#889) on the machine that has proxying issues by merely downloading the .zip from cloudbees. Installed it, no modification whatsoever, and I put in demo mode after startup: proxying is not working for the demo.sitemap "multimedia" items Is there anything that possibly could be influencing the JVM threading functionality? I presume that even with jetty it is mapping Threads to underlying system/OS threads, no? This is by far the weirdest problem I have ever encountered with OH2/ESH |
@maggu2810 @kaikreuzer Found it! The culprit is https://github.com/eclipse/smarthome/blob/3ae5d7b1b284f2bde6199bfe8dad950fd38cae39/bundles/ui/org.eclipse.smarthome.ui/src/main/java/org/eclipse/smarthome/ui/internal/proxy/ProxyServletService.java#L71 in combination with org.eclipse.jetty.client.http.HttpClientTransportOverHTTP creating exactly Math.max(1, Runtime.getRuntime().availableProcessors() / 2) selector threads, the QueuedThreadPool maximum of 8 threads are filled up with the 8 selectors on my 8-Core/16-Thread Xeon-based server, thereby not allowing anymore threads to be created to handle HTTP connections themselves. It explains why an exact copy of the environment is perfectly running on a Virtual Machine with for example 2 virtual Cores. Now, when I add "org.eclipse.smarthome.proxy:maxThreads=16" to for example runtime.cfg this does not seem to have any effect. How can I change the Map<String, Object> config that is passed onto the ProxyServletService's activate() method? |
… at least the double of the number of selector threads that are created by the HttpClient, so that the QueuedThreadPool is not clogged with blocking “selector” threads Signed-off-by: Karel Goderis <karel.goderis@me.com>
…uble of the number of selector threads that are created by the HttpClient, so that the QueuedThreadPool is not clogged with blocking “selector” threads (#3311) Signed-off-by: Karel Goderis <karel.goderis@me.com>
Congrats on figuring out that issue! Your servers clearly have too many cores :-D
I would expect this to work like this. |
I was fed up with the serial port troubles so I decided to squash it with a lot of firepower. I must thus be the first one to go 8-core on OH 😲
…Sent from my iPhone
On 26 Apr 2017, at 15:04, Kai Kreuzer ***@***.***> wrote:
Congrats on figuring out that issue! Your servers clearly have too many cores :-D
How can I change the Map<String, Object> config that is passed onto the ProxyServletService's activate() method?
I would expect this to work like this.
Maybe this line needs to be changed to have name="org.eclipse.smarthome.proxy (i.e. remove the "ui.") and maybe also add a configuration-policy="optional" to it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Congrats @kgoderis 👍 |
I assume this is fixed by #3311 now |
I am not sure whether this is related to #2734, but I recently moved to a new linux-based OH2 runtime environment, and suddenly, proxied images are not longer displayed, and in fact, time out. I think this is related to OH2/ESH and not nginx in front of OH2, but this is what I get in the OH logs (never mind the exact URL, I have 6 or so images that fail to load):
, and then in the nginx logs:
anyone any idea what is going on? I literally copied over the configs from my old server to the new ones, so it puzzles me even more.
The text was updated successfully, but these errors were encountered: