Support Questions

Find answers, ask questions, and share your expertise

Hive query OutOfMemoryError: Java heap space

avatar
Expert Contributor

I am issuing a command that is executing about 1500 xpaths on a single XML file (it is about 10MB in size).

I am getting the error in the title. I have tried increasing just about every configuration setting I know related to Hive/Tez's java heap space.

e.g. https://community.hortonworks.com/questions/5780/hive-on-tez-query-map-output-outofmemoryerror-java....

Nothing seems to work. I restart the server after every configuration change.

I also went and changed hive-env.sh to -Xmx8g and it still doesn't seem to fix the issue. I ran -verbose:gc and see that the gc stops at ~1000MB. Why wouldn't that go on up to 8G if I changed -Xmx to be 8g?

Is there anyway to tell if it is the client breaking and needing more heap or the map jobs?

1 ACCEPTED SOLUTION

avatar
Expert Contributor

@Kevin Vasko Hi Kevin, can you export the below in hive-env.sh file from Ambari then restart the affected components :

---

export HADOOP_CLIENT_OPTS="-Xmx6144m"

---

Then run the below command on the node where HS2 is running as hive user, to check the heap size (MaxHeapSize):

# jmap -heap <PID-of-HS2>

Thanks !

View solution in original post

10 REPLIES 10

avatar
New Contributor

I have faced same issue .Please increase the memory before running the hive query .But if you are not able to do grep on xml then you have to split your file on the basis of tags by using gawk.

set mapreduce.map.memory.mb=9000;

set mapreduce.map.java.opts=-Xmx7200m;

set mapreduce.reduce.memory.mb=9000;

set mapreduce.reduce.java.opts=-Xmx7200m;