I am trying to execute apache drill sql as below from perl-CGI
my $result = `export _JAVA_OPTIONS="-Xms1024M -Xmx1024M";/opt/mapr/drill/drill-1.6.0/bin/sqlline -u "jdbc:drill:drillbit=172.16.50.16" --showHeader=false --silent <<EOF
$query
EOF`;
But i am getting the below error when i try to browse:
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 2555904 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /tmp/hs_err_pid16431.log
cat /tmp/hs_err_pid16431.log
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 2555904 bytes for committing reserved memory.
# Possible reasons:
# The system is out of physical RAM or swap space
# In 32 bit mode, the process size limit was hit
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Use 64 bit Java on a 64 bit OS
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
# Out of Memory Error (os_linux.cpp:2638), pid=16431, tid=0x00007f61fae76700
#
# JRE version: (8.0_101-b13) (build )
# Java VM: OpenJDK 64-Bit Server VM (25.101-b13 mixed mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
--------------- T H R E A D ---------------
Current thread (0x00007f61f4011800): JavaThread "Unknown thread" [_thread_in_vm, id=16467, stack(0x00007f61fad76000,0x00007f61fae77000)]
--------------- P R O C E S S ---------------
Any idea what could be wrong? Or how to tell java heap memory size from perl-CGI?
Even the java version used by both is same (64bit).
The command works fine when run through command line.
It's a selinux issue. Selinux doesn't allow java process to execute memory allocation commands. Check logs in /etc/httpd/logs/ssl_error_log
Run below commands
sudo semodule -i /usr/share/selinux/targeted/java.pp.bz2
sudo restorecon -r -v /usr