接收邮件时执行的Java崩溃 我想做什么

接收邮件时执行的Java崩溃 我想做什么,java,linux,spring-boot,sh,postfix-mta,Java,Linux,Spring Boot,Sh,Postfix Mta,我想在收到电子邮件时运行jar。 我编写了如下配置文件 /etc/别名 mail: mailuser,| "/bin/bash /tmp/mailtest/mailtrigger.sh" /tmp/mailtest/mailtrigger.sh #/bin/bash echo start>>/tmp/mailtest/stdout.log java-jar/tmp/mailtest/example.jar echo end>>/tmp/mailtest/stdout.log

我想在收到电子邮件时运行jar。 我编写了如下配置文件

/etc/别名

mail: mailuser,| "/bin/bash /tmp/mailtest/mailtrigger.sh"
/tmp/mailtest/mailtrigger.sh

#/bin/bash
echo start>>/tmp/mailtest/stdout.log
java-jar/tmp/mailtest/example.jar
echo end>>/tmp/mailtest/stdout.log
从CLI运行效果很好 从CLI运行
bash-mailtrigger.sh
可以正常工作

/tmp/mailtest/stdout.log

start
success
end
start
end
# 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
#   The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
#   JVM is running with Unscaled Compressed Oops mode in which the Java heap is
#     placed in the first 4GB address space. The Java Heap base address is the
#     maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
#     to set the Java Heap base and to place the Java Heap above 4GB virtual address.
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (os_linux.cpp:2753), pid=28040, tid=0x00007fca156d3700
#
# JRE version:  (8.0_212-b04) (build )
# Java VM: OpenJDK 64-Bit Server VM (25.212-b04 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
#
从电子邮件运行时崩溃 当命令
mail-s测试mail@example.local
执行后,它将变为以下内容

/tmp/mailtest/stdout.log

start
success
end
start
end
# 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
#   The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
#   JVM is running with Unscaled Compressed Oops mode in which the Java heap is
#     placed in the first 4GB address space. The Java Heap base address is the
#     maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
#     to set the Java Heap base and to place the Java Heap above 4GB virtual address.
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (os_linux.cpp:2753), pid=28040, tid=0x00007fca156d3700
#
# JRE version:  (8.0_212-b04) (build )
# Java VM: OpenJDK 64-Bit Server VM (25.212-b04 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
#
电子邮件已正确接收,sh正在运行。但是,将输出以下错误文件

/tmp/mailtest/stdout.log

start
success
end
start
end
# 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
#   The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
#   JVM is running with Unscaled Compressed Oops mode in which the Java heap is
#     placed in the first 4GB address space. The Java Heap base address is the
#     maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
#     to set the Java Heap base and to place the Java Heap above 4GB virtual address.
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (os_linux.cpp:2753), pid=28040, tid=0x00007fca156d3700
#
# JRE version:  (8.0_212-b04) (build )
# Java VM: OpenJDK 64-Bit Server VM (25.212-b04 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
#
tmp/hs\u err\u pid32575.log

start
success
end
start
end
# 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
#   The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
#   JVM is running with Unscaled Compressed Oops mode in which the Java heap is
#     placed in the first 4GB address space. The Java Heap base address is the
#     maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
#     to set the Java Heap base and to place the Java Heap above 4GB virtual address.
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (os_linux.cpp:2753), pid=28040, tid=0x00007fca156d3700
#
# JRE version:  (8.0_212-b04) (build )
# Java VM: OpenJDK 64-Bit Server VM (25.212-b04 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
#
记忆似乎足够了 我认为这已经足够了,因为即使从CLI执行,内存也不不足。 我将写以下内容以防万一

vmstat

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  0  50176 807536      0 391192    0    0     1     2   39   35  4  3 93  0  0
不仅jar,java版本也不起作用 按如下方式重写sh文件也会崩溃

/tmp/mailtest/mailtrigger.sh

#/bin/bash
echo start>>/tmp/mailtest/stdout.log
#java-jar/tmp/mailtest/example.jar
java版本
echo end>>/tmp/mailtest/stdout.log
当然,它会从CLI中成功

 java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.212-b04, mixed mode)
其他资料 如果没有足够的信息,我很抱歉。 我将补充必要的信息

有麻烦了。帮助我。请。

原因是塞利努克斯。 我临时将SELINUX更改为Permissive,结果成功。 多谢各位