"insufficient memory for the Java Runtime" 从 Perl-CGI 通过 apache

"insufficient memory for the Java Runtime" from Perl-CGI through apache

我正在尝试从 perl-CGI

执行 apache drill sql,如下所示
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`;

但是当我尝试浏览时出现以下错误:

# 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  ---------------

知道哪里出了问题吗?或者如何从 perl-CGI 中判断 java 堆内存大小?

甚至两者使用的 java 版本也是相同的(64 位)。

当通过命令行 运行 时,该命令工作正常。

这是一个 selinux 问题。 Selinux 不允许 java 进程执行内存分配命令。检查 /etc/httpd/logs/ssl_error_log

中的日志

运行 命令下方

sudo semodule -i /usr/share/selinux/targeted/java.pp.bz2

sudo restorecon -r -v /usr