[
https://issues.apache.org/jira/browse/NIFI-3561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15898924#comment-15898924
]
ASF GitHub Bot commented on NIFI-3561:
--------------------------------------
GitHub user ijokarumawak opened a pull request:
https://github.com/apache/nifi/pull/1568
NIFI-3561: Fix WS port forwarding
Fixed service instance lookup to use local port so that it works when
it is accessed through port forwarding.
Thank you for submitting a contribution to Apache NiFi.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
### For all changes:
- [x] Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
- [x] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number
you are trying to resolve? Pay particular attention to the hyphen "-" character.
- [x] Has your PR been rebased against the latest commit within the target
branch (typically master)?
- [x] Is your initial contribution a single, squashed commit?
### For code changes:
- [ ] Have you ensured that the full suite of tests is executed via mvn
-Pcontrib-check clean install at the root nifi folder?
- [ ] Have you written or updated unit tests to verify your changes?
- [ ] If adding new dependencies to the code, are these dependencies
licensed in a way that is compatible for inclusion under [ASF
2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the LICENSE file, including the main
LICENSE file under nifi-assembly?
- [ ] If applicable, have you updated the NOTICE file, including the main
NOTICE file found under nifi-assembly?
- [ ] If adding new Properties, have you added .displayName in addition to
.name (programmatic access) for each of the new properties?
### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in
which it is rendered?
### Note:
Please ensure that once the PR is submitted, you check travis-ci for build
issues and submit an update to your PR as soon as possible.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ijokarumawak/nifi nifi-3561
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/nifi/pull/1568.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1568
----
commit 590f0e9d471d422228ea59c576b4f91c5d279022
Author: Koji Kawamura <[email protected]>
Date: 2017-03-07T08:08:47Z
NIFI-3561: Fix WS port forwarding
Fixed service instance lookup to use local port so that it works when
it is accessed through port forwarding.
----
> JettyWebSocketServer uses original requested port, instead of the forwarded
> port
> --------------------------------------------------------------------------------
>
> Key: NIFI-3561
> URL: https://issues.apache.org/jira/browse/NIFI-3561
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Affects Versions: 1.1.0
> Reporter: Edgar Orendain
> Assignee: Koji Kawamura
> Labels: jetty, websocket
>
> Situation:
> We have port forwarding set up in such a way where port 25000 is forwarded to
> port 15000. ListenWebSocket processor listens on this 15000 port.
> Requests that hit the JettyWebSocketServer are considered as attempting to
> connect to the original port (25000) rather than the forwarded port of 15000.
> The same was reproduced with different ports and on different forwarding
> layers (i.e. NAT and iptables). I've included a stack trace below.
> From Koji:
> -I think it's more of a Jetty side issue, after it upgrade HTTP connection to
> TCP, it still uses the original requested port (which is a port forwarding
> request to the real port) to find a request handler assigned to that port.-
> (updated) Excuse me, but I was wrong about this diagnose. It's a problem in
> NiFi JettyWebSocketServer I wrote. The ControllerService lookups server
> instance by a port number that the CS listens to. When a request made through
> port forwarding, a port passed by ServletUpgradeRequest is different than CS
> is bounded to. Then it fails to lookup a server instance. I will check if
> original port can be retrieved from a request, if not, I will add a
> configuration property to the CS to specify forwarding port numbers.
> java.lang.RuntimeException: No controller service is bound with port: 25000
> at
> org.apache.nifi.websocket.jetty.JettyWebSocketServer$JettyWebSocketServlet.createWebSocket(JettyWebSocketServer.java:134)
> ~[nifi-websocket-services-jetty-1.1.0.2.1.2.0-10.jar:1.1.0.2.1.2.0-10]
> at
> org.eclipse.jetty.websocket.server.WebSocketServerFactory.acceptWebSocket(WebSocketServerFactory.java:187)
> ~[websocket-server-9.3.13.v20161014.jar:9.3.13.v20161014]
> at
> org.eclipse.jetty.websocket.server.WebSocketServerFactory.acceptWebSocket(WebSocketServerFactory.java:172)
> ~[websocket-server-9.3.13.v20161014.jar:9.3.13.v20161014]
> at
> org.eclipse.jetty.websocket.servlet.WebSocketServlet.service(WebSocketServlet.java:155)
> ~[websocket-servlet-9.3.13.v20161014.jar:9.3.13.v20161014]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
> ~[javax.servlet-api-3.1.0.jar:3.1.0]
> at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845)
> ~[jetty-servlet-9.3.9.v20160517.jar:9.3.9.v20160517]
> at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
> [jetty-servlet-9.3.9.v20160517.jar:9.3.9.v20160517]
> at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1174)
> [jetty-server-9.3.9.v20160517.jar:9.3.9.v20160517]
> at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
> [jetty-servlet-9.3.9.v20160517.jar:9.3.9.v20160517]
> at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1106)
> [jetty-server-9.3.9.v20160517.jar:9.3.9.v20160517]
> at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
> [jetty-server-9.3.9.v20160517.jar:9.3.9.v20160517]
> at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
> [jetty-server-9.3.9.v20160517.jar:9.3.9.v20160517]
> at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
> [jetty-server-9.3.9.v20160517.jar:9.3.9.v20160517]
> at org.eclipse.jetty.server.Server.handle(Server.java:524)
> [jetty-server-9.3.9.v20160517.jar:9.3.9.v20160517]
> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
> [jetty-server-9.3.9.v20160517.jar:9.3.9.v20160517]
> at
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
> [jetty-server-9.3.9.v20160517.jar:9.3.9.v20160517]
> at
> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
> [jetty-io-9.3.9.v20160517.jar:9.3.9.v20160517]
> at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
> [jetty-io-9.3.9.v20160517.jar:9.3.9.v20160517]
> at
> org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
> [jetty-io-9.3.9.v20160517.jar:9.3.9.v20160517]
> at
> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
> [jetty-util-9.3.9.v20160517.jar:9.3.9.v20160517]
> at
> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
> [jetty-util-9.3.9.v20160517.jar:9.3.9.v20160517]
> at
> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
> [jetty-util-9.3.9.v20160517.jar:9.3.9.v20160517]
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
> [jetty-util-9.3.9.v20160517.jar:9.3.9.v20160517]
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
> [jetty-util-9.3.9.v20160517.jar:9.3.9.v20160517]
> at java.lang.Thread.run(Thread.java:745) [na:1.8.0_111]
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)