" Java Runtime的内存不足"从Perl-CGI到apache

时间:2016-10-17 09:10:10

标签: apache centos cgi apache-drill

我正在尝试从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位)。

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

1 个答案:

答案 0 :(得分:1)

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

中的日志

运行以下命令

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

sudo restorecon -r -v /usr