Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

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
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login
10 REPLIES 10

avatar
@Kevin Vasko

Can you give me the output of ps -ef | grep hiveserver2 ?

avatar
Expert Contributor

hive 24964 0.2 1.7 2094636 566148 ? Sl 17:03 0:56 /usr/lib/jvm/ja va-1.7.0-openjdk-1.7.0.91.x86_64/bin/java -Xmx1024m -Dhdp.version=2.3.2.0-2950 - Djava.net.preferIPv4Stack=true -Dhdp.version=2.3.2.0-2950 -Dhadoop.log.dir=/var/ log/hadoop/hive -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=/usr/hdp/2.3.2.0- 2950/hadoop -Dhadoop.id.str=hive -Dhadoop.root.logger=INFO,console -Djava.librar y.path=:/usr/hdp/current/hadoop-client/lib/native/Linux-amd64-64:/usr/hdp/2.3.2. 0-2950/hadoop/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.prefe rIPv4Stack=true -Xmx1024m -XX:MaxPermSize=512m -Dhadoop.security.logger=INFO,Nul lAppender org.apache.hadoop.util.RunJar /usr/hdp/2.3.2.0-2950/hive/lib/hive-serv ice-1.2.1.2.3.2.0-2950.jar org.apache.hive.service.server.HiveServer2 --hiveconf hive.aux.jars.path=file:///usr/hdp/current/hive-webhcat/share/hcatalog/hive-hca talog-core.jar -hiveconf hive.metastore.uris= -hiveconf hive.log.file=hiveserve r2.log -hiveconf hive.log.dir=/var/log/hive

So I can see that it is set at 1024m, however it is set to some really large value.

http://imgur.com/3oXfpPj

avatar

Xmx1024m means it's just 1 GB, please increase it to 4 or 6 or 8 GB based on available Memory.

Go to Ambari -Hive-search for heap (hive.heapsize) and update the value to 8192 and then re-start affected services.

avatar
Expert Contributor

@Divakar AnnapureddyCorrect but if you look at my comments i posted a picture and it shows, it is changed to 12GB in the UI. The services have been restarted (complete server has been restarted).

avatar

your GUI is showing around 12 GB but it's not showing in your ps -ef script. it means your 12 GB doesn't take an effect..

May be ambari issue or some hard coded value is not allowing to update.

I would recommend to increase 6 GB or 8 GB instead of 12GB, 12 GB is very high number.

avatar
Expert Contributor

The configuration of hive.heapsize does not exist in my hive-site.xml for some reason and whenever I add it to the file it keeps getting overwritten.

avatar

yes, we have to make changes through Ambari only if your cluster managed by Ambari. Ambari will overwrite the changes if we make any changes at command level.

nothing to do with hive-site.xml , we have to check in hive-env.sh

avatar
Expert Contributor

what do I need to set in hive-env.sh? It seems that anything I touch it gets overwritten. This has to be a bug in ambari where it won't save the hive.heapsize value. How can I get it to persist?

avatar
Expert Contributor
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login