我面临着一种奇怪的行为,其中一些参数是Weblogic的。
我有一个J2EE批次,该批次在Weblogic服务器中超过10分钟执行,这会导致例外
com.ibm.jbatch.container.exception.batchcontainerruntimeexception:
java.lang.interruptedException
经过进行了一些调查,我发现属性MaxstuckThreadTime设置为600秒(默认值),并且属性stuckthreadCount设置为25(过去为0,没有任何问题)。
如果我很好地理解,这意味着,当且仅当至少25个线程繁忙时,服务器才会失败,因为超过600秒。
但是我在服务器上同时同时运行了10个线程。
我对DEV环境进行了一些测试,一旦我有一个线程卡住(在10分钟内忙碌,启动了互动的例外),就是预期的行为吗?
我无权修改生产价值。
因此,通过通过这种错误欢迎任何想法。
在文档中,我发现:
StuckThreadCount = The number of stuck threads after which the server is transitioned into FAILED state.
MaxStuckThreadTime = Sets the value of the MaxStuckThreadTime attribute.
因此,从我的角度来看,只有在两个条件是字段中,才能出现间断的示例,但是我的印象是只有一个粘线足以使批次插入。
AM-I正确,如果我说只有在StuckThreadCount与0不同的情况下考虑MaxStuckThreadTime?
预先感谢您的帮助
编辑:
我试图在此处实施该建议,但直到现在却没有成功。
因此,在我的weblogic-ejb-jar.xml中,我添加了以下代码:
<work-manager>
<name>BatchWorkManager</name>
<ignore-stuck-threads>true</ignore-stuck-threads>
</work-manager>
<managed-executor-service>
<name>batch-job-executor</name>
<dispatch-policy>BatchWorkManager</dispatch-policy>
<long-running-priority>10</long-running-priority>
</managed-executor-service>
在我的批处理中,我添加了
@Resource(name = "BatchWorkManager")
WorkManager myMW;
的调用
@override
public String Process()引发异常{
myWM.schedule(new MyWork("MyBatchName"));
return BatchStatus.COMPLETED.toString();
}
几分钟后(在MaxStuckThreadTime参数中定义),将作业放置在状态失败。
如果我调试代码,我会看到工人的价值:
stuckThreadActions = null name =“无卡螺纹动作!”
stuckthreads = {bitset@36226}“ {}”
似乎,工人管理器已正确设置(没有粘线操作!是我想要的)。
所以,我仍然不明白,为什么批次失败...
欢迎任何帮助。
有关信息,我收到的Statcktrace:
###&lt; 4月21日,2022年,12:40:00,793 pm Cest&gt; &lt; com.ibm.jbatch.container.impl.batchletstepcontrollererimpl&gt; gt;
&lt; [stuck] executeThread:'0'for列队:
'weblogic.kernel.default(自我调整)'&gt; &lt;&gt;
&lt; 33EF2B10-13CC-45BE-BF47-E06DAF40042C-0000003B&gt; gt; &lt; 1650537600793&gt;
&lt; [严重值:16] [RID:0:1] [partition-id:0] [partition-name:
域]&gt; &lt;抓取例外执行步骤:
com.ibm.jbatch.container.exception.batchcontainerruntimeException:
java.lang.interruptedException at
com.ibm.jbatch.container.impl.partitionedstepcontrollerimpl.executeandwaitforcompletion(partitionedStepControllerimpl.java:407)
在
com.ibm.jbatch.container.impl.partitionedstepcontrollererimpl.invokecorestep(partitionededstepcontrollererimpl.java:297)
在
com.ibm.jbatch.container.impl.basestepcontrollerimpl.execute(basestepcontrollerimpl.java:144)
在
com.ibm.jbatch.container.impl.executiontransitioner.doexecutionloop(executionTransitioner.java:112)
在
com.ibm.jbatch.container.impl.jobthreadrootcontrollerimpl.originateExecutionOnthread(jobthreadrootcontrollerimpl.java:110)
在
com.ibm.jbatch.container.util.batchworkunit.run(batchworkunit.java:80)
在
java.util.concurrent.executors $ runnableDapter.call(executors.java:511)
在weblogic.work.concurrent.taskwrapper.call(taskwrapper.java:151)
在
weblogic.work.concurrent.future.abstractfutureimpl.runtask(AbstractFutureImpl.java:391)
在
weblogic.work.concurrent.future.abstractfutureimpl.dorun(AbstractFutureImpl.java:436)
在
weblogic.work.concurrent.future.managedfutureimpl.run(mandedfutureimpl.java:28)
在
weblogic.invocation.componentInvocationContextManager._runas(ComponentInvocationContextManager.java:348)
在
weblogic.invocation.componentInvocationContextManager.runas(ComponentInvocationContextManager.java:333)
在
weblogic.work.livepartitionutility.dorunworkundercontext(livepartitionutility.java:54)
在
weblogic.work.partitionutility.runworkundercontext(partitionutility.java:41)
在
weblogic.work.selftuningworkmanagerimpl.runworkundercontext(selftuningworkmanagerimpl.java:640)
在weblogic.work.executethread.execute(executethread.java:406)at
weblogic.work.executethread.run(executethread.java:346)由以下原因引起
java.lang.interruptedException at
java.util.concurrent.locks.abstractqueuedsynchronizer $ conditionObject.ReportInterruptAfterWait(Abstractquequeuedsynchronizer.java:2014)
在
java.util.concurrent.locks.abstractqueedsynchronizer $ pentighobject.await(Abstractquequeuedsynchronizer.java:2048)
在
java.util.concurrent.linkedblockingqueue.take(linkedblockingqueue.java:442)
在
com.ibm.jbatch.container.impl.partitionedstepcontrollerimpl.executeandwaitforcompletion(partitionedStepControllerimpl.java:402)
... 17更多
I'm facing a strange behaviour with some parameters in weblogic.
I have a J2EE batch which is executed during more than 10 minutes in a weblogic server which cause an exception like
com.ibm.jbatch.container.exception.BatchContainerRuntimeException:
java.lang.InterruptedException
After some investigation, I found that the property MaxStuckThreadTime is set to 600 seconds (default value) and the property StuckThreadCount is set to 25 (was 0 in the past without any issue).
If I understand well, this means, the server should fail if and only if at least 25 threads are busy since more than 600seconds.
But I have maximum 10 threads running at the same time on the server.
I made some test on my dev environement and as soon as I have one thread stuck (busy during 10 minutes, the interruped exception is launched), is-it the expected behaviour?
I don't have the right to modify those value on production.
So, any idea is welcome to by pass this kind of error.
In the documentation, I found :
StuckThreadCount = The number of stuck threads after which the server is transitioned into FAILED state.
MaxStuckThreadTime = Sets the value of the MaxStuckThreadTime attribute.
So, in my point of view, the interupted excpetion, should only appears if the 2 conditions are field-in, but i have the impression that only one stuck thread is enough to interupt the batch.
Am-i correct if I say that the MaxStuckThreadTime is only taken into account if the StuckThreadCount is different than 0?
Thanks in advance for your help
edit :
I tried to implement the proposal here under but until now, without success.
So, in my weblogic-ejb-jar.xml, I've added the following code :
<work-manager>
<name>BatchWorkManager</name>
<ignore-stuck-threads>true</ignore-stuck-threads>
</work-manager>
<managed-executor-service>
<name>batch-job-executor</name>
<dispatch-policy>BatchWorkManager</dispatch-policy>
<long-running-priority>10</long-running-priority>
</managed-executor-service>
and in my batch, I added
@Resource(name = "BatchWorkManager")
WorkManager myMW;
and the call to my batch like this
@Override
public String process() throws Exception {
myWM.schedule(new MyWork("MyBatchName"));
return BatchStatus.COMPLETED.toString();
}
After a few minutes (defined in the MaxStuckThreadTime parameter), the job is put on status failed.
If I debug the code, I see the value of the workmanager :
stuckThreadActions = null name = "NO STUCK THREAD ACTIONS !"
stuckThreads = {BitSet@36226} "{}"
It seems, the workmanager is correctly setup (NO STUCK THREAD ACTIONS ! is what I want).
So, I still don't understand, why the batch is failing ...
Any help is welcome.
For information, the statcktrace I receive :
###<Apr 21, 2022, 12:40:00,793 PM CEST> <com.ibm.jbatch.container.impl.BatchletStepControllerImpl>
<[STUCK] ExecuteThread: '0' for queue:
'weblogic.kernel.Default (self-tuning)'> <>
<33ef2b10-13cc-45be-bf47-e06daf40042c-0000003b> <1650537600793>
<[severity-value: 16] [rid: 0:1] [partition-id: 0] [partition-name:
DOMAIN] > <Caught exception executing step:
com.ibm.jbatch.container.exception.BatchContainerRuntimeException:
java.lang.InterruptedException at
com.ibm.jbatch.container.impl.PartitionedStepControllerImpl.executeAndWaitForCompletion(PartitionedStepControllerImpl.java:407)
at
com.ibm.jbatch.container.impl.PartitionedStepControllerImpl.invokeCoreStep(PartitionedStepControllerImpl.java:297)
at
com.ibm.jbatch.container.impl.BaseStepControllerImpl.execute(BaseStepControllerImpl.java:144)
at
com.ibm.jbatch.container.impl.ExecutionTransitioner.doExecutionLoop(ExecutionTransitioner.java:112)
at
com.ibm.jbatch.container.impl.JobThreadRootControllerImpl.originateExecutionOnThread(JobThreadRootControllerImpl.java:110)
at
com.ibm.jbatch.container.util.BatchWorkUnit.run(BatchWorkUnit.java:80)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at weblogic.work.concurrent.TaskWrapper.call(TaskWrapper.java:151)
at
weblogic.work.concurrent.future.AbstractFutureImpl.runTask(AbstractFutureImpl.java:391)
at
weblogic.work.concurrent.future.AbstractFutureImpl.doRun(AbstractFutureImpl.java:436)
at
weblogic.work.concurrent.future.ManagedFutureImpl.run(ManagedFutureImpl.java:28)
at
weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
at
weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
at
weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
at
weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
at
weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406) at
weblogic.work.ExecuteThread.run(ExecuteThread.java:346) Caused by:
java.lang.InterruptedException at
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2014)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2048)
at
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at
com.ibm.jbatch.container.impl.PartitionedStepControllerImpl.executeAndWaitForCompletion(PartitionedStepControllerImpl.java:402)
... 17 more
发布评论
评论(1)
您可以配置一个新的工作经理,以运行批处理作业并配置被忽略的固定线程,或将批处理作业启动作为长期运行的请求。
可以通过WebLogic控制台或为每个已部署的应用程序在本地使用工作管理器进行配置。要在应用程序中定义工作经理,您可以在包装在部署中包装的Weblogic.xml(或EAR文件的同等文件)中进行配置。例如,我在我的weblogic.xml文件中使用此功能来定义一个忽略catuck threads的工作经理...
我在我的web.xml中引用了托管执行服务的工作...
在我的Web应用程序中,我可以访问该服务任务执行人如下...
在使用该工作经理启动批处理作业时,WebLogic忽略了任何卡住的线程,即使对于长期运行的任务,服务器也表现出健康。
对此的增强是将批处理作业启动为
长期运行任务
。我认为这会导致Weblogic为任务创建一个新线程,而不是从工作管理器线程池中拿出线程。另外,Weblogic不会将分配给长期运行任务的线程被卡住。要启动一项长期运行的任务,您需要将LongRunning_Hint设置为启动的托管任务中的true。有关更多详细信息,请参见以下内容...
https://docs.oracle.com/javaee/7/api/javax/enterprise/concurrent/ManagedExecutorService.html
https://blogs.oracle .com/weblogicserver/post/concurrency-utilities-support-in-weblogic-server-1221-part-one-managedexecutorservice
You could configure a new work manager for running the batch job and configure stuck threads to be ignored, or launch the batch job as a long running request.
A work manager can be configured globally via the weblogic console, or locally for each deployed application. To define a work manager in an application, you can configure it in the weblogic.xml (or equivalent for ear files) packaged up with your deployment. For example, i have this in my weblogic.xml file to define a work manager that ignores stuck threads...
I reference that managed-executor-service in my web.xml...
In my web application, I can then access that task executor as follows...
When launching a batch job using that work manager, any stuck threads are ignored by weblogic and the servers show as healthy even for long running tasks.
An enhancement to this is to have the batch job launched as a
long running task
. I think this will cause weblogic to create a new thread for the task instead of taking a thread from the work manager thread pool. Also weblogic won't consider a thread assigned to a long running task as being stuck.To launch a long running task, you need to set the LONGRUNNING_HINT to true in the ManagedTask that is launched. For more details see the following...
https://docs.oracle.com/javaee/7/api/javax/enterprise/concurrent/ManagedTask.html#LONGRUNNING_HINT
https://docs.oracle.com/javaee/7/api/javax/enterprise/concurrent/ManagedExecutorService.html
https://blogs.oracle.com/weblogicserver/post/concurrency-utilities-support-in-weblogic-server-1221-part-one-managedexecutorservice