【问题标题】:Wildfly 10 to Wildfly 16 : EJB Scheduler stuck, Not able to undeploy/disable deployments and need to kill serverWildfly 10 到 Wildfly 16:EJB 调度程序卡住,无法取消部署/禁用部署,需要终止服务器
【发布时间】:2020-04-06 23:16:48
【问题描述】:

我们有常规 Filemover 服务,该服务已安排好,文件从一个位置移动到另一个位置。

我们正在从 Wildfly 10 迁移到 Wildfly 16,并在 Wildfly 16 中面临这个问题。

在 Wildfly 16 中,它给出了奇怪的行为,即当计时器卡住并且我们禁用或取消部署可部署然后服务器组卡住并且我们只需要杀死并重新启动时:

当 Timer 卡住以下警告时:

2019-12-13 14:00:00,000 WARN  [org.jboss.as.ejb3.timer] (EJB default - 10) WFLYEJB0043: 
A previous execution of timer [id=51e7977a-722a-4b20-9db1-f3534b2e3cff 

timedObjectId=filemover-1.5-SNAPSHOT-wildfly10.filemover-1.5-SNAPSHOT-wildfly10.FileMover 
auto-timer?:true 
persistent?:false 
timerService=org.jboss.as.ejb3.timerservice.TimerServiceImpl@2ac49ed5 
initialExpiration=null 
intervalDuration(in milli sec)=0 
nextExpiration=Fri Dec 13 14:00:00 CET 2019 
timerState=IN_TIMEOUT 
info=null] 
is still in progress, 
skipping this overlapping scheduled execution at: Fri Dec 13 14:00:00 CET 2019.

然后我点击 Wildfly UI 中的禁用或取消部署,该进程无限期卡住。

Error: There is or more management operations running longer than expected, it may negatively impact the performance of the server. Check the Management Operations view to display the active operations.

取消部署或禁用后日志显示以下消息:

2019-12-13 14:05:13,225 INFO  [org.jboss.modcluster] (ServerService Thread Pool -- 15) MODCLUSTER000021: All pending requests drained from default-host:/filemover-1.5-SNAPSHOT-wildfly10 in 0.0 seconds
2019-12-13 14:05:13,227 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 15) WFLYUT0022: Unregistered web context: '/filemover-1.5-SNAPSHOT-wildfly10' from server 'default-server'
2019-12-13 14:06:00,003 ERROR [org.jboss.as.ejb3.timer] (EJB default - 4) WFLYEJB0020: Error invoking timeout for timer: [id=4416f1bb-1d5a-4992-bfa5-b7d635136f4e timedObjectId=filemover-1.5-SNAPSHOT-wildfly10.filemover-1.5-SNAPSHOT-wildfly10.FileMover auto-timer?:true persistent?:false timerService=org.jboss.as.ejb3.timerservice.TimerServiceImpl@2ac49ed5 initialExpiration=null intervalDuration(in milli sec)=0 nextExpiration=Fri Dec 13 14:08:00 CET 2019 timerState=IN_TIMEOUT info=null]: org.jboss.as.ejb3.component.EJBComponentUnavailableException: WFLYEJB0421: Invocation cannot proceed as component is shutting down
        at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:59)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
        at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
        at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:60)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
        at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:438)
        at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:618)
        at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:57)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:53)
        at org.jboss.as.ejb3.timerservice.TimedObjectInvokerImpl.callTimeout(TimedObjectInvokerImpl.java:99)
        at org.jboss.as.ejb3.timerservice.CalendarTimerTask.invokeBeanMethod(CalendarTimerTask.java:64)
        at org.jboss.as.ejb3.timerservice.CalendarTimerTask.callTimeout(CalendarTimerTask.java:53)
        at org.jboss.as.ejb3.timerservice.TimerTask.run(TimerTask.java:181)
        at org.jboss.as.ejb3.timerservice.TimerServiceImpl$Task$1.run(TimerServiceImpl.java:1302)
        at org.wildfly.extension.requestcontroller.RequestController$QueuedTask$1.run(RequestController.java:494)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
        at org.jboss.threads.JBossThread.run(JBossThread.java:485)

几秒到几分钟后出现以下错误:

2019-12-13 14:10:13,218 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 90) WFLYCTL0348: Timeout after [300] seconds waiting for service container stability. Operation will roll back. Step that first updated the service container was 'undeploy' at address '[("deployment" => "filemover-1.5-SNAPSHOT-wildfly10.war")]'

2019-12-13 14:10:18,218 INFO  [org.jboss.as.protocol] (ServerService Thread Pool -- 93) WFLYPRT0057:  cancelled task by interrupting thread Thread[ServerService Thread Pool -- 90,5,ServerService ThreadGroup]

2019-12-13 14:10:23,219 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 90) WFLYCTL0190: Step handler org.jboss.as.server.deployment.DeploymentHandlerUtil$5@13139499 for operation undeploy at address [("deployment" => "filemover-1.5-SNAPSHOT-wildfly10.war")] failed handling operation rollback -- java.lang.IllegalStateException: WFLYCTL0345: Timeout after 5 seconds waiting for existing service service jboss.deployment.unit."filemover-1.5-SNAPSHOT-wildfly10.war".contents to be removed so a new instance can be installed.: java.lang.IllegalStateException: WFLYCTL0345: Timeout after 5 seconds waiting for existing service service jboss.deployment.unit."filemover-1.5-SNAPSHOT-wildfly10.war".contents to be removed so a new instance can be installed.
        at org.jboss.as.controller.OperationContextImpl.installService(OperationContextImpl.java:2033)
        at org.jboss.as.controller.OperationContextImpl.access$600(OperationContextImpl.java:133)
        at org.jboss.as.controller.OperationContextImpl$2$1.installService(OperationContextImpl.java:762)
        at org.jboss.as.controller.OperationContextImpl$ContextServiceBuilder.install(OperationContextImpl.java:2171)
        at org.jboss.msc.service.DelegatingServiceBuilder.install(DelegatingServiceBuilder.java:104)
        at org.jboss.as.server.deployment.ContentServitor.addService(ContentServitor.java:48)
        at org.jboss.as.server.deployment.DeploymentHandlerUtil.doDeploy(DeploymentHandlerUtil.java:196)
        at org.jboss.as.server.deployment.DeploymentHandlerUtil$5$1.handleResult(DeploymentHandlerUtil.java:388)
        at org.jboss.as.controller.AbstractOperationContext$Step.invokeResultHandler(AbstractOperationContext.java:1533)
        at org.jboss.as.controller.AbstractOperationContext$Step.handleResult(AbstractOperationContext.java:1515)
        at org.jboss.as.controller.AbstractOperationContext$Step.finalizeInternal(AbstractOperationContext.java:1472)
        at org.jboss.as.controller.AbstractOperationContext$Step.finalizeStep(AbstractOperationContext.java:1445)
        at org.jboss.as.controller.AbstractOperationContext$Step.access$400(AbstractOperationContext.java:1319)
        at org.jboss.as.controller.AbstractOperationContext.executeResultHandlerPhase(AbstractOperationContext.java:876)
        at org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:726)
        at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:467)
        at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1412)
        at org.jboss.as.controller.ModelControllerImpl.internalExecute(ModelControllerImpl.java:423)
        at org.jboss.as.controller.ModelControllerImpl.lambda$execute$1(ModelControllerImpl.java:243)
        at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:289)
        at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:255)
        at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:243)
        at org.jboss.as.controller.remote.TransactionalProtocolOperationHandler.internalExecute(TransactionalProtocolOperationHandler.java:269)
        at org.jboss.as.controller.remote.TransactionalProtocolOperationHandler$ExecuteRequestHandler.doExecute(TransactionalProtocolOperationHandler.java:201)
        at org.jboss.as.controller.remote.TransactionalProtocolOperationHandler$ExecuteRequestHandler$1.run(TransactionalProtocolOperationHandler.java:148)
        at org.jboss.as.controller.remote.TransactionalProtocolOperationHandler$ExecuteRequestHandler$1.run(TransactionalProtocolOperationHandler.java:144)
        at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:289)
        at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:255)
        at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:198)
        at org.jboss.as.controller.remote.TransactionalProtocolOperationHandler$ExecuteRequestHandler$2$1.get(TransactionalProtocolOperationHandler.java:172)
        at org.jboss.as.controller.remote.TransactionalProtocolOperationHandler$ExecuteRequestHandler$2$1.get(TransactionalProtocolOperationHandler.java:163)
        at org.jboss.as.controller.remote.TransactionalProtocolOperationHandler$Execution$1.execute(TransactionalProtocolOperationHandler.java:677)
        at org.jboss.as.controller.remote.TransactionalProtocolOperationHandler$ExecuteRequestHandler$2.execute(TransactionalProtocolOperationHandler.java:177)
        at org.jboss.as.protocol.mgmt.ManagementRequestContextImpl$1.doExecute(ManagementRequestContextImpl.java:70)
        at org.jboss.as.protocol.mgmt.ManagementRequestContextImpl$AsyncTaskRunner.run(ManagementRequestContextImpl.java:160)
        at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
        at java.lang.Thread.run(Thread.java:745)
        at org.jboss.threads.JBossThread.run(JBossThread.java:485)

2019-12-13 14:10:23,220 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 90) WFLYCTL0027: Operation was interrupted before service container stability could be reached. Process should be restarted. Step that first updated the service container was 'undeploy' at address '[("deployment" => "filemover-1.5-SNAPSHOT-wildfly10.war")]'

在那个计时器被卡住并且顶部的警告持续很长时间之后。

代码(已经根据搜索找到的建议):

@Stateless
public class FileMover {
    @Schedule(hour = "*", minute = "*/15", persistent = false)
    public void startJob() {
}

任何人都可以建议如何解决此问题或给出解决此问题的任何方向吗?

  • Wildfly 10 中不存在该问题,即当计时器卡住时,取消部署或禁用没有问题。
  • 我在运行时删除了 data/timerservice 文件夹中的计时器,但没有修复
  • 当可部署不存在时,我已删除计时器并重新启动系统,但仍然出现此问题。
  • 这也是其他各种项目的问题。
  • 在这个项目中,发现出现异常,即邮件未发送,程序正常结束,下次异常再次出现,但这次卡住了。这个问题存在于另一个项目中,无一例外。

【问题讨论】:

  • 只有在知道原因的情况下才能给出解决方案。您还没有找到原因,所以此时所有选项仍然在桌面上 - 包括您的 Wildfly 16 版本中存在需要向开发人员报告的问题。您是否尝试过降级一个版本(我假设 Wildfly 15 存在)以查看问题是否也发生在那里?您是否创建了一个带有计时器的小示例程序,以查看是否可以以最小的方式重现问题?
  • 同一程序在 10 上运行良好。此时无法考虑降级。当进程抛出异常并停止或在其他调度程序进程中花费很长时间时,会发生这种情况。但是取消部署或禁用不起作用。不确定在这里找到什么根本原因?让我检查更多用例。

标签: java wildfly wildfly-10 wildfly-16 ejbscheduler


【解决方案1】:

试试看这段代码是否做得更好......

import javax.ejb.*;

@Singleton
@Startup
public class MyScheduler {

    @Resource
    private TimerService timerService;

    private Timer timer;

    @PostConstruct
    private void init() {
        TimerConfig timerConfig = new TimerConfig(null, false);
        ScheduleExpression se = new ScheduleExpression().hour("*").minute("*/15");
        timer = timerService.createCalendarTimer(se, timerConfig);                           
}

    @PreDestroy
    private void shutdown() {
        timer.cancel();
    }

}

【讨论】:

  • 感谢您的回复。我肯定会从您的 sn-p 中添加一些代码,但根本问题是其他问题,因为它是由公司的 Wildfly 配置人员修复的,我在回答中提到了这一点。
【解决方案2】:

与公司的 Wildfly 配置人员交谈,这纯粹是 Wildfly 服务器邮箱设置中与迁移相关的问题,其中未添加收件人,因此 Wildfly 似乎忙于寻找收件人。

添加收件人后,调度程序工作正常,取消部署/禁用应用程序没有任何问题。

【讨论】:

  • 如果我在 docker 上运行服务器,我应该在哪里配置电子邮件收件人?
猜你喜欢
  • 2017-02-03
  • 2017-08-24
  • 2017-03-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多