How to retrieve heapdump in PCF using SMB

456 views Asked by At

I need to -XXHeapdumoOutofmemory and -XXHeapdumoFilepath option in PCF manifest yml to create heapdump on OutOfMemory . I understand I can use SMB or NFS in vm args but how to retrieve the heapdump file when app goes OutOfMemory and not accessible.

Kindly help.

1

There are 1 answers

0
Daniel Mikusa On

I need to -XXHeapdumoOutofmemory and -XXHeapdumoFilepath option in PCF manifest yml to create heapdump on OutOfMemory

You don't need to set these options. The Java buildpack will take care of this for you. By default, it installs a jvmkill agent which will automatically do this.

https://github.com/cloudfoundry/java-buildpack/blob/main/docs/jre-open_jdk_jre.md#jvmkill

In addition, the jvmkill agent is smart enough that if you bind a SMB or NFS volume service to your application, it will automatically save the heap dumps to that location. From the doc link above...

If a Volume Service with the string heap-dump in its name or tag is bound to the application, terminal heap dumps will be written with the pattern <CONTAINER_DIR>/<SPACE_NAME>-<SPACE_ID[0,8]>/<APPLICATION_NAME>-<APPLICATION_ID[0,8]>/<INSTANCE_INDEX>--<INSTANCE_ID[0,8]>.hprof

The key is that you name the bound volume service appropriately, i.e. the name must contain the string heap-dump.

You may also do the same thing with non-terminal heap dumps using the Java Memory Agent that the Java buildpack can install for you upon request.

I understand I can use SMB or NFS in vm args but how to retrieve the heapdump file when app goes OutOfMemory and not accessible.

To retrieve the heap dumps you need to somehow access the file server. I say "somehow" because it entirely depends on what you are allowed to do in your environment.

  1. You may be permitted to mount the SMB/NFS volume directly to your PC. You could then access the files directly.
  2. You may be able to retrieve the files through some other protocol like HTTP or FTP or SFTP.
  3. You may be able to mount the SMB or NFS volume to another application, perhaps using the static file buildpack, to serve up the files for you.
  4. You may need to request the files from an administrator with access.

Your best best is to talk with the admin for your SMB or NFS server. He or she can inform you about the options that are available to you in your environment.