0

I am facing below OutOfMemoryError: Java heap space error while running my pipeline. I have also tried to increase heap space to 4Gb but still getting same error.

 Caused by:
2023-07-24T10:16:10.8047611Z                     java.lang.OutOfMemoryError: Java heap space
2023-07-24T10:16:10.8047931Z                         at java.base/java.util.HashMap.newNode(HashMap.java:1901)
2023-07-24T10:16:10.8048271Z                         at java.base/java.util.HashMap.putVal(HashMap.java:629)
2023-07-24T10:16:10.8048622Z                         at java.base/java.util.HashMap.putMapEntries(HashMap.java:514)
2023-07-24T10:16:10.8048969Z                         at java.base/java.util.HashMap.<init>(HashMap.java:484)

Now, I am trying to capture heap dump to identify memory leak and root cause of out of memory issue.

Can someone please help me to capture heap dump ?

SeleniumUser
  • 4,065
  • 2
  • 7
  • 30
  • Hi, I added an answer to the question, i appreciate if you accept and upvote it if it address the solution otherwise feel free to leave comment, i will be glad if i could help – Lunatic Jul 24 '23 at 19:06
  • Please consider looking at the solutions here: https://stackoverflow.com/questions/60509976/javascript-heap-out-of-memory-on-azure-build. Also consider running your pipeline manually (e.g. using the Azure extension in VS Code) so you can troubleshoot memory *BEFORE* the OOM crash occurs. – paulsm4 Jul 24 '23 at 21:20

1 Answers1

0

How to capture heap dump while running azure pipeline ?

One practice is to using jmap command-line tool on running the pipeline to capture a heap dump in binary format and save it to a file (heapdumpreport.bin). Replace the PID with the process ID of your Java application, the sas-token, name-of-your-container and storage-account-name tags with proper values.

- script: |
    jmap -dump:format=b,file=heapdumpreport.bin <PID>
    azcopy copy heapdumpreport.bin "https://<storage-account-name>.blob.core.windows.net/<name-of-your-container>/heapdumpreport.bin?sas-token"
  displayName: 'Heap Dump Report'

Which this script we used azcopy command to upload the heap dump into your storage account using an SAS token.

Lunatic
  • 1,519
  • 8
  • 24