Skip to content
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

[BUG] flytekit-java tries to discover slf4j implementation through parent class loader #3051

Closed
2 tasks done
honnix opened this issue Nov 4, 2022 · 1 comment · Fixed by flyteorg/flytekit-java#145
Closed
2 tasks done
Labels
bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers

Comments

@honnix
Copy link
Member

honnix commented Nov 4, 2022

Describe the bug

slf4j uses class loader to discover its implementations at runtime. ChildFirstClassLoader in flytekit-java first discovers implementations locally and then delegate to its parent class loader. While this makes sense for many scenarios, it does not work for slf4j because mixing an implementation and API from different class loaders will certainly cause class loading problem. While in practice this does not necessarily cause problem because slf4j will choose the first discovered one that is from the child, if there is, but if there does not exist one in child, a class loading problem will occur.

Expected behavior

ChildFirstClassLoader does not try to discover slf4j implementations in its parent class loader.

Additional context to reproduce

jflyte uses slf4j-simple as the implementation, so creating a task module using another implementation will result in slf4j warning about multiple implementations. If the task module has slf4j-api bundled but no implementation, a class loading problem will occur when trying to assign an instance loaded by parent class loader to a class loaded by the child.

Screenshots

No response

Are you sure this issue hasn't been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes
@honnix honnix added bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers labels Nov 4, 2022
@honnix
Copy link
Member Author

honnix commented Nov 10, 2022

Closed by flyteorg/flytekit-java#145

@honnix honnix closed this as completed Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant