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

RANGER-4943: Error in ElasticSearchAuditDestination shutting down RestHighLevelClient client #397

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FerArribas14
Copy link

@FerArribas14 FerArribas14 commented Sep 27, 2024

Error in ElasticSearchAuditDestination shutting down RestHighLevelClient client

What changes were proposed in this pull request?

RANGER-4943: Error in ElasticSearchAuditDestination shutting down RestHighLevelClient client
Error encountered -> ElasticSearchAccessAuditsServiceTest -> ERROR org.apache.ranger.audit.provider.BaseAuditHandler – Error sending message to ElasticSearch java.lang.RuntimeException: Cannot execute request; I/O reactor status: STOPPED.

Details:

Error in using a try-with-resources block in ElasticSearchAuditDestination because it closes the ElasticSearch client prematurely. In a try-with-resources block, any resource that implements the AutoCloseable interface will automatically close at the end of the block, which may cause the ElasticSearch client to close before its use is complete. To avoid this problem, we remove the try-with-resources usage for the ElasticSearch client because it already explicitly closes the client when it is no longer needed, specifically in RestHighLevelClient which implements Closeable's close method.

How was this patch tested?

By running ./build_ranger_using_docker.sh and unit test ElasticSearchAccessAuditsServiceTest

ExampleDoc DocsElastic AuditsApacheRanger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant