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

Windows service uses incorrect value for MaxDirectMemorySize #48796

Closed
DaveCTurner opened this issue Nov 1, 2019 · 4 comments · Fixed by #49061
Closed

Windows service uses incorrect value for MaxDirectMemorySize #48796

DaveCTurner opened this issue Nov 1, 2019 · 4 comments · Fixed by #49061
Assignees
Labels
>bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team

Comments

@DaveCTurner
Copy link
Contributor

A user on the forums reported an issue with their 7.3.0 nodes hitting java.lang.OutOfMemoryError: Direct buffer memory frequently. The nodes were being run with -XX:MaxDirectMemorySize=536870912 despite a 6GB heap. It turned out the heap size was being set twice:

-XX:MaxDirectMemorySize=536870912 would be consistent with JvmErgonomics incorrectly picking up that the heap is 1GB rather than 6GB. I don't have a way to reproduce this to investigate further but this feels like a bug somewhere along the way.

@russcam
Copy link
Contributor

russcam commented Nov 1, 2019

Thanks for raising @DaveCTurner.

I think this issue should be opened on https://github.com/elastic/elasticsearch, as it looks like it relates to running the zip distribution as a Windows Service; looking at the screenshot. is looks to be using Apache Commons Daemon, which is what the zip distribution uses to run Elasticsearch as a Windows Service.

The MSI installation overwrites the heap values in jvm.options, so the default values are overridden.

@DaveCTurner DaveCTurner transferred this issue from elastic/windows-installers Nov 1, 2019
@DaveCTurner
Copy link
Contributor Author

Thanks @russcam, I've moved this to the main Elasticsearch repo.

@DaveCTurner DaveCTurner added :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts >bug labels Nov 1, 2019
@elasticmachine
Copy link
Collaborator

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

@williamrandolph williamrandolph self-assigned this Nov 12, 2019
@williamrandolph
Copy link
Contributor

It looks like the setup here is controlled by an invocation in bin\elasticsearch-service.bat. We're parsing Xmx and Xms values out of the java options string and feeding them into the Commons Daemon service setup, but we're not then removing those values from the options string, leading to the redundancy and potential for drift we see above.

Conceptually, the fix is simple — remove the Xmx/Xms settings from the options string after parsing them — but the work will be figuring out how to make that happen in a Windows batch script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team
Projects
None yet
5 participants