Skip to content

Conversation

@pgomulka
Copy link
Contributor

@pgomulka pgomulka commented Apr 21, 2023

currently when Elasticsearch starts up there are warnings on the console

SLF4J: No SLF4J providers were found. SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details. SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier. SLF4J: Ignoring binding found at [jar:file:/Users/chegar/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-slf4j-impl/2.19.0/1a0c9615ba9fd5b96db8c1136afbef4394286e93/log4j-slf4j-impl-2.19.0.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See https://www.slf4j.org/codes.html#ignoredBindings for an explanation. 

this is emitted twice
1 - when repository-azure module is loaded
2 - when transport-netty-4 module is loaded (transitively via xpack-security)

This commits adds a slf4j-nop to fix that warning

however this is unclear to my why they started in the first place.
might be related to #93714
and #93878

@pgomulka pgomulka added >bug :Core/Infra/Logging Log management and logging utilities v8.8.0 labels Apr 21, 2023
@pgomulka pgomulka self-assigned this Apr 21, 2023
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Apr 21, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

dependencies {
api project(":libs:elasticsearch-ssl-config")

api "org.slf4j:slf4j-nop:2.0.6" // netty is using slf4j-api.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

netty is using slf4j-api as an optional dependency. That dependency is being 'injected' via xpack-security dependency (how??)

stacktrace when slf4j is being used

bind:178, LoggerFactory (org.slf4j) performInitialization:170, LoggerFactory (org.slf4j) getProvider:455, LoggerFactory (org.slf4j) getILoggerFactory:441, LoggerFactory (org.slf4j) <init>:42, Slf4JLoggerFactory (io.netty.util.internal.logging) <clinit>:63, Slf4JLoggerFactory$NopInstanceHolder (io.netty.util.internal.logging) getInstanceWithNopCheck:59, Slf4JLoggerFactory (io.netty.util.internal.logging) useSlf4JLoggerFactory:62, InternalLoggerFactory (io.netty.util.internal.logging) newDefaultFactory:42, InternalLoggerFactory (io.netty.util.internal.logging) getDefaultFactory:111, InternalLoggerFactory (io.netty.util.internal.logging) getInstance:134, InternalLoggerFactory (io.netty.util.internal.logging) getInstance:127, InternalLoggerFactory (io.netty.util.internal.logging) <clinit>:81, PlatformDependent (io.netty.util.internal) <init>:34, ConstantPool (io.netty.util) <init>:36, ChannelOption$1 (io.netty.channel) <clinit>:36, ChannelOption (io.netty.channel) <clinit>:92, Netty4Transport (org.elasticsearch.transport.netty4) lambda$getTransports$27:1571, Security (org.elasticsearch.xpack.security) get:-1, Security$$Lambda$4841/0x0000000801c14b08 (org.elasticsearch.xpack.security) <init>:815, Node (org.elasticsearch.node) <init>:327, Node (org.elasticsearch.node) <init>:216, Elasticsearch$2 (org.elasticsearch.bootstrap) initPhase3:216, Elasticsearch (org.elasticsearch.bootstrap) main:67, Elasticsearch (org.elasticsearch.bootstrap) 
Copy link
Contributor Author

@pgomulka pgomulka Apr 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That dependency is being 'injected' via xpack-security dependency (how??)

if this is the case then x-pack-securitys api "org.apache.logging.log4j:log4j-slf4j-impl:${versions.log4j}" dependency can also influence other modules? Like ingest-attachmenet which is explicitly trying not to use it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x-pack-security actually contains a second copy of transport-netty4, which it builds the security http/s implementations on top of. Although transport-netty4 still exists as a module, it is never loaded because x-pack-security overrides the transport implementation settings. So the version of transport-netty4 that needs fixing is just that in x-pack-security, where the nop dep can be a runtime dependency.

@elasticsearchmachine
Copy link
Collaborator

Hi @pgomulka, I've created a changelog YAML for you.

@gmarouli gmarouli added v8.9.0 and removed v8.8.0 labels Apr 26, 2023
Copy link
Contributor

@ChrisHegarty ChrisHegarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pgomulka pgomulka merged commit 257d633 into elastic:main May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Core/Infra/Logging Log management and logging utilities Team:Core/Infra Meta label for core/infra team v8.9.0

5 participants