New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZEPPELIN-3040. Allow to specify portRange for interpreter process thrift service #2661
Conversation
@Leemoonsoo @jongyoul @prabhjyotsingh Could you help review it ? Thanks |
throws IOException { | ||
|
||
TServerSocket tSocket = null; | ||
// ':' is the default value which means no constraints on the portRange | ||
if (portRange == null || portRange.equals(":")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if portRange
== ""
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recently, I'm using StringUtils.isBlank
which check null, empty and whitespaces only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -39,7 +39,7 @@ | |||
private DevInterpreter interpreter = null; | |||
private InterpreterOutput out; | |||
public ZeppelinDevServer(int port) throws TException, IOException { | |||
super(null, port); | |||
super(null, port, ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe default to ":" like in other cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
callbackHost = RemoteInterpreterUtils.findAvailableHostAddress(); | ||
callbackPort = RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces(); | ||
} catch (IOException e1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
catch TTransportException?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TTransportException is wrapped in IOException, so there it is enough to catch IOException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not from what I can see, which is why I asked:
https://github.com/apache/thrift/blob/master/lib/javame/src/org/apache/thrift/transport/TTransportException.java
edit: or you mean IOException has an inner TTransportException?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I mean the code in try catch block has wrapped TTransportException in IOException.
tSocket = RemoteInterpreterUtils.createTServerSocket(callbackPortRange);
callbackPort = tSocket.getServerSocket().getLocalPort();
callbackHost = RemoteInterpreterUtils.findAvailableHostAddress();
@@ -86,7 +87,7 @@ public RemoteInterpreterManagedProcess( | |||
|
|||
@Override | |||
public String getHost() { | |||
return "localhost"; | |||
return host; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could return null then (the initial value)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, getHost is used by the client of RemoteInterpreterManagedProcess for querying where this process is launched. And I think in semantic perspective it is right to return null when the process has not been launched.
ea9b6e2
to
a87c425
Compare
Thanks @felixcheung , will merge if no more comments |
…ift service This PR is trying to add new configuration `zeppelin.interpreter.portRange` which control the portRange of interpreter process. This is required by some users for security reason. [Improvement | Feature ] * [ ] - Task * https://issues.apache.org/jira/browse/ZEPPELIN-3040 Manually test. Set zeppelin.interpreter.portRange and launch python interpreter, verify it is in the proper portRange. * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Jeff Zhang <zjffdu@apache.org> Closes apache#2661 from zjffdu/ZEPPELIN-3040 and squashes the following commits: a87c425 [Jeff Zhang] address comments 7e885bd [Jeff Zhang] ZEPPELIN-3040. Allow to specify portRange for interpreter process thrift service
…ift service This PR is trying to add new configuration `zeppelin.interpreter.portRange` which control the portRange of interpreter process. This is required by some users for security reason. [Improvement | Feature ] * [ ] - Task * https://issues.apache.org/jira/browse/ZEPPELIN-3040 Manually test. Set zeppelin.interpreter.portRange and launch python interpreter, verify it is in the proper portRange. * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Jeff Zhang <zjffdu@apache.org> Closes apache#2661 from zjffdu/ZEPPELIN-3040 and squashes the following commits: a87c425 [Jeff Zhang] address comments 7e885bd [Jeff Zhang] ZEPPELIN-3040. Allow to specify portRange for interpreter process thrift service
What is this PR for?
This PR is trying to add new configuration
zeppelin.interpreter.portRange
which control the portRange of interpreter process. This is required by some users for security reason.What type of PR is it?
[Improvement | Feature ]
Todos
What is the Jira issue?
How should this be tested?
Manually test. Set zeppelin.interpreter.portRange and launch python interpreter, verify it is in the proper portRange.
Screenshots (if appropriate)
Questions: