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

JBP does not honor '-XX:MaxDirectMemorySize=0' option #591

Closed
imod opened this issue May 5, 2018 · 5 comments
Closed

JBP does not honor '-XX:MaxDirectMemorySize=0' option #591

imod opened this issue May 5, 2018 · 5 comments
Assignees
Milestone

Comments

@imod
Copy link
Contributor

imod commented May 5, 2018

Because the new elasticsearch 'Java High Level REST Client' uses the 'direct buffer memory' and we have quite memory heavy search requests, we need to disable the direct memory calculation by the JBP and hand over the control back to the JVM. There is a more detailed description of the problem at [1].

So we tried to disable the calculated setting with -XX:MaxDirectMemorySize=0 and tried the following JAVA_OPTS:

-XX:+PrintFlagsFinal -XX:MaxDirectMemorySize=0 -Djava.security.egd=file:///dev/urandom

This will print all JVM flags with there actual used value and this reveals that it still uses the calculated value by the JBP (10M in this case):

2018-05-05T08:48:18.42+0200 [APP/PROC/WEB/0] OUT uintx MaxDirectMemorySize := 10485760 {product}

on the other hand, starting it with -XX:MaxDirectMemorySize=20M works fine:

2018-05-05T08:41:55.36+0200 [APP/PROC/WEB/0] OUT uintx MaxDirectMemorySize := 20971520 {product}

btw. setting it to -XX:MaxDirectMemorySize=0M (note the M after the 0) does not make any difference too.

...we currently use JBP https://github.com/cloudfoundry/java-buildpack#v4.10

As this is quite a blocker for us (we now face java.lang.OutOfMemoryError: Direct buffer memory), it would be great if the JBP would support setting MaxDirectMemorySize back to the default, which is 0.

[1] https://discuss.elastic.co/t/direct-buffer-memory-problems-with-resthighlevelclient/106647

@nebhale nebhale assigned nebhale and glyn and unassigned nebhale May 7, 2018
@nebhale nebhale added this to the v4.12 milestone May 7, 2018
@nebhale
Copy link
Member

nebhale commented May 7, 2018

/cc @glyn

@nebhale
Copy link
Member

nebhale commented May 7, 2018

I’m guessing that there might be some parsing problems, but even if this causes runtime issues, I think we should honor the setting of the value.

@glyn
Copy link
Contributor

glyn commented May 8, 2018

@nebhale Agreed. It's a simpler contract always to preserve user-specified values, regardless of whether these will work well.

@nebhale
Copy link
Member

nebhale commented May 8, 2018

@imod Memory Calculator v3.13.0.RELEASE is available to online buildpacks now and will go out in the next release of the buildpack.

@imod
Copy link
Contributor Author

imod commented May 8, 2018

@nebhale many thanks!

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

No branches or pull requests

3 participants