问题现象
WAS集群环境,管理会计-产品成本-实际成本处理-全成本计算:
全成本计算时,调整计算层次后,进行成本结转与计算,如下图,记录条数少时,可以计算成功,记录条数多少,计算出现报错:operating system stack overflow
问题分析
NCC版本: NC Cloud 2020.05
操作系统: Operating System: Cent0S Linux 7
WAS版本: Websphere 9.0.5.2
JAVA版本: java version "1.8.0_201"
nclog日志
$$callid=17162806598311382 $$thread=[WebContainer : 0] $$host= $$userid=1001S3100000000JNN4K $$ts=2024-05-21 16:40:38 $$debuglevel=ERROR $$msg=RuntimeException occurred, container will rollback the transaction
nc.vo.pubapp.pattern.exception.CarrierRuntimeException: operating system stack overflow
at nc.vo.pubapp.pattern.exception.ExceptionUtils.wrappException(ExceptionUtils.java:177)
at nc.bs.cm.carryover.saga.CarryoverSaga.calcIA(CarryoverSaga.java:283)
at nc.bs.cm.carryover.saga.ack.WbSagasConfirm.runNext(WbSagasConfirm.java:61)
at nc.bs.cm.carryover.saga.ack.WbSagasConfirm.successCall(WbSagasConfirm.java:34)
......
java.lang.StackOverflowError: operating system stack overflow
at java.io.UnixFileSystem.getLength(Native Method) at java.io.File.length(File.java:985)
at com.ibm.ejs.ras.RasHelper$14.run(RasHelper.java:1666)
at com.ibm.ejs.ras.RasHelper$14.run(RasHelper.java:1664)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:63)
at com.ibm.ejs.ras.RasHelper.getFileLength(RasHelper.java:1663)
at com.ibm.ejs.ras.WrappingFileOutputStream.incrementCount(WrappingFileOutputStream.java:556)
at com.ibm.ejs.ras.WrappingFileOutputStream.write(WrappingFileOutputStream.java:438)
at java.io.PrintStream.write(PrintStream.java:504) at java.io.FilterOutputStream.write(FilterOutputStream.java:108) at com.ibm.ejs.ras.SystemStream.write(SystemStream.java:313)
at com.ibm.ejs.ras.SystemOutStream.write(SystemOutStream.java:80)
......
WAS日志_SystemOut_XXX.log
Caused by: nc.vo.pubapp.pattern.exception.CarrierRuntimeException: operating system stack overflow
at nc.vo.pubapp.pattern.exception.ExceptionUtils.wrappException(ExceptionUtils.java:177)
at nc.bs.cm.carryover.saga.util.Invoker.invokeIA(Invoker.java:90)
at nc.bs.cm.carryover.saga.CarryoverSaga.calcIA(CarryoverSaga.java:281)
... 665 more
Caused by: nc.vo.pubapp.pattern.exception.CarrierRuntimeException: operating system stack overflow
at nc.vo.pubapp.pattern.exception.ExceptionUtils.wrappBusinessException(ExceptionUtils.java:103)
at nc.bs.cm.pc.pc0410.exception.TranExceptionContainer.wrappCostTranException(TranExceptionContainer.java:57)
at nc.bs.cm.carryover.saga.CarryoverSaga.tranCostData(CarryoverSaga.java:401)
at nc.bs.cm.carryover.saga.ack.ComputeIASagasConfirm.successCall(ComputeIASagasConfirm.java:35)
查看 -Xss 参数: Java thread stack size
Sets the stack size and increment for Java™ threads.
If you exceed the maximum Java thread stack size, java/lang/OutOfMemoryError message is reported.
Note: Java methods and native methods run on two different stacks and the VM handles switching between them for JNI calls. Each stack is sized using separate options; these options apply to the Java stack only.
Syntax
Setting | Effect | Default |
-Xiss<size> | Set initial Java thread stack size | 2 KB |
-Xss<size> | Set maximum Java thread stack size | 320 KB (32-bit); 1024 KB (64-bit) |
-Xssi<size> | Set Java thread stack size increment | 16 KB |
设置:-Xss到 -Xss2m、-Xss10m
管理会计-产品成本-实际成本处理-全成本计算仍然出现报错:
Caused by: nc.vo.pubapp.pattern.exception.CarrierRuntimeException: operating system stack overflow
查看 -Xmso 参数: the native stack size for operating system threads.
Sets the native stack size for operating system threads.
When a native method makes a call into the VM, the VM calculates whether the memory required for the call will exceed the -Xmso value. If so, a java/lang/StackOverflowError error is thrown.
Note: Java methods and native methods run on two different stacks and the VM handles switching between them for JNI calls. Each stack is sized using separate options; this option applies to the native stack only.
Syntax
Setting | Effect | Default |
Stack size for OS Threads (32-bit) -Xmso<size> | Sets the native stack size for operating system threads | 256KB |
Stack size for OS Threads (64-bit) | Sets the native stack size for operating system threads | Java 17版本及以上: 512 KB (256 KB on IBM Z®) Earlier Java versions: 256 KB |
解决方案
WAS管理控制台:
WebSphere Application Server-应用程序服务器-ncMem01-进程定义-Java虚拟机:
通用JVM参数: 增加参数并设置为: -Xss2m -Xmso512k
设置完后,重新启动WAS中间件,管理会计-产品成本-实际成本处理-全成本计算,业务计算正常完成。
WAS集群环境,nchome/bin/sysConfig.sh界面,部署-JVM页签 增加 参数并部署到WAS:
-Xss2m -Xmso512k