-
Notifications
You must be signed in to change notification settings - Fork 519
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
HDDS-3498. Shutdown datanode if address is already in use #7256
Changes from 15 commits
7d3ccfe
c9e88a2
9fd9d99
20f4470
4d16aa7
71588eb
58741b5
6017207
29400e5
164f1c0
83fbbbe
4a46f4d
4b4a582
6253cb1
d9536ab
3bb033d
0ac758e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
package org.apache.hadoop.ozone.container.common.transport.server; | ||
|
||
import java.io.IOException; | ||
import java.net.BindException; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
@@ -185,7 +186,16 @@ public HddsProtos.ReplicationType getServerType() { | |
@Override | ||
public void start() throws IOException { | ||
if (!isStarted) { | ||
server.start(); | ||
try { | ||
server.start(); | ||
} catch (IOException e) { | ||
LOG.error("Error while starting the server", e); | ||
if (e.getMessage().contains("Failed to bind to address")) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have any actual reason to start a service if we can't start a server? Shouldn't we just handle all IOException like that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we will handle all IOException like that we will end up with shutting down datanodes due to any network failures. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we identify how actual retryable exceptions looks like? Is netty throwing specifically only IOExceptions here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually it is better just handle correctly server.start part and shutdown everything here cause we can't start server. There is no point to live afterwards. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Discussed it with Daniil - we need to return to this code at some point in time to refactor it. |
||
throw new BindException(); | ||
myskov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} else { | ||
throw e; | ||
} | ||
} | ||
int realPort = server.getPort(); | ||
|
||
if (port == 0) { | ||
|
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.
Why you changed it to error?
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.
Thank you for the remark. I’ll change it back. I initially changed it at the beginning of working on the task.
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.
Done