-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Move IfConfig.logIfNecessary call into bootstrap #22455
Conversation
b24b1d6
to
3b54406
Compare
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.
I left one comment about catching an exception that I think is no longer needed.
|
||
private static final Logger logger = Loggers.getLogger(IfConfig.class); | ||
private static final String INDENT = " "; | ||
|
||
/** log interface configuration at debug level, if its enabled */ | ||
static void logIfNecessary() { | ||
public static void logIfNecessary() { | ||
if (logger.isDebugEnabled()) { | ||
try { |
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.
I was curious about this try
block and I note that it currently catches SecurityException
which should not be needed anymore with this change. Can we remove it now?
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.
I removed catching SecurityException
. I think we still need the try and catch for 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.
I agree on the IOException
.
This is related to elastic#22116. A logIfNecessary() call makes a call to NetworkInterface.getInterfaceAddresses() requiring SocketPermission connect privileges. By moving this to bootstrap the logging call can be made before installing the SecurityManager.
3b54406
to
56acd43
Compare
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.
LGTM.
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.
LGTM
This is related to #22116. A logIfNecessary() call makes a call to
NetworkInterface.getInterfaceAddresses() which requires SocketPermission connect
privileges. By moving this to bootstrap the logging call can be made before
installing the SecurityManager.
As a note:
IFConfig and its method need to be made public in order for this to work. Another option would be to move the class into a different package - but that would cause issues as it depends on package private methods in NetworkUtils.