记一次Process.waitFor()的exit value返回137,247的问题

附:退出码说明.

Exit Code NumberMeaningExampleComments
1Catchall for general errorslet “var1 = 1/0”Miscellaneous errors, such as “divide by zero” and other impermissible operations
2Misuse of shell builtins (according to Bash documentation)empty_function() {}Missing keyword or command, or permission problem (and diff return code on a failed binary file comparison).
126Command invoked cannot execute/dev/nullPermission problem or command is not an executable
127“command not found”illegal_commandPossible problem with $PATH or a typo
128Invalid argument to exitexit 3.14159exit takes only integer args in the range 0 - 255 (see first footnote)
128+nFatal error signal “n”kill -9 $PPID of script$? returns 137 (128 + 9)
130Script terminated by Control-CCtl-CControl-C is fatal error signal 2, (130 = 128 + 2, see above)
255*Exit status out of rangeexit -1exit takes only integer args in the range 0 - 255

在这里插入图片描述

退出代码137(128 + 9)表示您的进程被(信号9)SIGKILL终止。
如果您没有手动停止脚本并仍然得到此错误代码,且脚本将被您的操作系统终止。在大多数情况下,这是由于过度使用内存造成的

附: linux退出码

Process Exit Codes

When invoking a unit process the service manager possibly fails to apply the execution parameters configured with the settings above. In that case the already created service process will exit with a non-zero exit code before the configured command line is executed. (Or in other words, the child process possibly exits with these error codes, after having been created by the fork(2) system call, but before the matching execve(2) system call is called.) Specifically, exit codes defined by the C library, by the LSB specification and by the systemd service manager itself are used.

The following basic service exit codes are defined by the C library.

Table 6. Basic C library exit codes

Exit CodeSymbolic NameDescription
0EXIT_SUCCESSGeneric success code.
1EXIT_FAILUREGeneric failure or unspecified error.

The following service exit codes are defined by the LSB specification.

Table 7. LSB service exit codes

Exit CodeSymbolic NameDescription
2EXIT_INVALIDARGUMENTInvalid or excess arguments.
3EXIT_NOTIMPLEMENTEDUnimplemented feature.
4EXIT_NOPERMISSIONThe user has insufficient privileges.
5EXIT_NOTINSTALLEDThe program is not installed.
6EXIT_NOTCONFIGUREDThe program is not configured.
7EXIT_NOTRUNNINGThe program is not running.

The LSB specification suggests that error codes 200 and above are reserved for implementations. Some of them are used by the service manager to indicate problems during process invocation:

Table 8. systemd-specific exit codes

Exit CodeSymbolic NameDescription
200EXIT_CHDIRChanging to the requested working directory failed. See WorkingDirectory= above.
201EXIT_NICEFailed to set up process scheduling priority (nice level). See Nice= above.
202EXIT_FDSFailed to close unwanted file descriptors, or to adjust passed file descriptors.
203EXIT_EXECThe actual process execution failed (specifically, the execve(2) system call). Most likely this is caused by a missing or non-accessible executable file.
204EXIT_MEMORYFailed to perform an action due to memory shortage.
205EXIT_LIMITSFailed to adjust resource limits. See LimitCPU= and related settings above.
206EXIT_OOM_ADJUSTFailed to adjust the OOM setting. See OOMScoreAdjust= above.
207EXIT_SIGNAL_MASKFailed to set process signal mask.
208EXIT_STDINFailed to set up standard input. See StandardInput= above.
209EXIT_STDOUTFailed to set up standard output. See StandardOutput= above.
210EXIT_CHROOTFailed to change root directory (chroot(2)). See RootDirectory=/RootImage= above.
211EXIT_IOPRIOFailed to set up IO scheduling priority. See IOSchedulingClass=/IOSchedulingPriority= above.
212EXIT_TIMERSLACKFailed to set up timer slack. See TimerSlackNSec= above.
213EXIT_SECUREBITSFailed to set process secure bits. See SecureBits= above.
214EXIT_SETSCHEDULERFailed to set up CPU scheduling. See CPUSchedulingPolicy=/CPUSchedulingPriority= above.
215EXIT_CPUAFFINITYFailed to set up CPU affinity. See CPUAffinity= above.
216EXIT_GROUPFailed to determine or change group credentials. See Group=/SupplementaryGroups= above.
217EXIT_USERFailed to determine or change user credentials, or to set up user namespacing. See User=/PrivateUsers= above.
218EXIT_CAPABILITIESFailed to drop capabilities, or apply ambient capabilities. See CapabilityBoundingSet=/AmbientCapabilities= above.
219EXIT_CGROUPSetting up the service control group failed.
220EXIT_SETSIDFailed to create new process session.
221EXIT_CONFIRMExecution has been cancelled by the user. See the systemd.confirm_spawn= kernel command line setting on kernel-command-line(7) for details.
222EXIT_STDERRFailed to set up standard error output. See StandardError= above.
224EXIT_PAMFailed to set up PAM session. See PAMName= above.
225EXIT_NETWORKFailed to set up network namespacing. See PrivateNetwork= above.
226EXIT_NAMESPACEFailed to set up mount, UTS, or IPC namespacing. See ReadOnlyPaths=, ProtectHostname=, PrivateIPC=, and related settings above.
227EXIT_NO_NEW_PRIVILEGESFailed to disable new privileges. See NoNewPrivileges=yes above.
228EXIT_SECCOMPFailed to apply system call filters. See SystemCallFilter= and related settings above.
229EXIT_SELINUX_CONTEXTDetermining or changing SELinux context failed. See SELinuxContext= above.
230EXIT_PERSONALITYFailed to set up an execution domain (personality). See Personality= above.
231EXIT_APPARMOR_PROFILEFailed to prepare changing AppArmor profile. See AppArmorProfile= above.
232EXIT_ADDRESS_FAMILIESFailed to restrict address families. See RestrictAddressFamilies= above.
233EXIT_RUNTIME_DIRECTORYSetting up runtime directory failed. See RuntimeDirectory= and related settings above.
235EXIT_CHOWNFailed to adjust socket ownership. Used for socket units only.
236EXIT_SMACK_PROCESS_LABELFailed to set SMACK label. See SmackProcessLabel= above.
237EXIT_KEYRINGFailed to set up kernel keyring.
238EXIT_STATE_DIRECTORYFailed to set up unit’s state directory. See StateDirectory= above.
239EXIT_CACHE_DIRECTORYFailed to set up unit’s cache directory. See CacheDirectory= above.
240EXIT_LOGS_DIRECTORYFailed to set up unit’s logging directory. See LogsDirectory= above.
241EXIT_CONFIGURATION_DIRECTORYFailed to set up unit’s configuration directory. See ConfigurationDirectory= above.
242EXIT_NUMA_POLICYFailed to set up unit’s NUMA memory policy. See NUMAPolicy= and NUMAMask= above.
243EXIT_CREDENTIALSFailed to set up unit’s credentials. See LoadCredential= and SetCredential= above.

Finally, the BSD operating systems define a set of exit codes, typically defined on Linux systems too:

Table 9. BSD exit codes

Exit CodeSymbolic NameDescription
64EX_USAGECommand line usage error
65EX_DATAERRData format error
66EX_NOINPUTCannot open input
67EX_NOUSERAddressee unknown
68EX_NOHOSTHost name unknown
69EX_UNAVAILABLEService unavailable
70EX_SOFTWAREinternal software error
71EX_OSERRSystem error (e.g., can’t fork)
72EX_OSFILECritical OS file missing
73EX_CANTCREATCan’t create (user) output file
74EX_IOERRInput/output error
75EX_TEMPFAILTemporary failure; user is invited to retry
76EX_PROTOCOLRemote error in protocol
77EX_NOPERMPermission denied
78EX_CONFIGConfiguration error

综合资料查找判断,exit value 137 为内存不足导致的系统自动kill脚本的执行. exit value 247未查找到足够资料,根据查找的资料基本判断业务内存问题. 调整pod的分配的内存后,脚本顺利执行,未再出现异常.

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值