Problems with Job Queue Entries and Task Scheduler in Business Central 14.0 OnPremise - C/AL

MarOliMarOli Member Posts: 3
Hi everyone,

In our team we are facing an issue with "Job Queue Entry" and "Task Scheduler": Every process enqueued in the "Job Queue Entry" is executed only once even if it's scheduled to execute more than once. The first time it runs only when the service associated with the task scheduler is starting or restarting.

Here is an example of my workflow to better explain the situation:
(Initial situation - Service 1: client enabled and task scheduler disabled + Service 2: client disabled and task scheduler enabled)
- I create a "Job Queue Entry" record to run a custom codeunit (50k range) scheduled every day and every minute.
- I set the record status to "Ready" but the row is not executed. I also checked in the "scheduled task" table the existance of the task row.
- So i restarted the service 2.
- The enqued process is executed and rescheduled a minute later (as planned). I checked again the "scheduled task" table.
- The process doesn't executes anymore unless i restart again the service 2.

Things you might ask me:
- Are the services in the same server? Yes. In this server there are more than 2 BC services, even linked with other databases that run every "Job Queue Entry" without problem.
- Is the task service configured correctly? Yes. Enabling the client in the service 2 works fine.
- Is the codeunit running correctly by developer? Yes. This is a test codeunit that just create a log record in a table. (We don't have license problem in this object)
- Have you tried to recreate the service? Yes.
- Have you tried scheduling other jobs or other codeunits? Yes.
- Have you customized some code in the MS objects? No.
- Have you tried to edit some field in the "Job Queue Entries"? Yes, but none changed the behavior.

Anyone has some advice?
Thanks

Answers

  • irasoelbaksirasoelbaks Netherlands, theMember Posts: 80
    I remember we also had problems in some CU's regarding the task scheduler.

    Did you try the latest CU?
    Did you check the event viewer on the machine where the Nst is running with Task Scheduler enabled?
    Did you try to disable the Task scheduler everywhere and then use a dedicated Nst only with Task Scheduler enabled?
    Something else to try: attach debugger to it to trace the AL code
  • MarOliMarOli Member Posts: 3
    Hi @irasoelbaks
    We can't try the latest CU because we are in production environment, but maybe we will copy this db and try to test these processes in a isolated environment.
    In the server the event viewer doesn't show anything usefull about it.
    The task scheduler and the client are already working in two dedicated services.
    I've tried to attach a debug session to the task scheduler service but i can't see any other session starts. (By the way our code is running still in C\AL).
  • irasoelbaksirasoelbaks Netherlands, theMember Posts: 80
    @MarOli: maybe this also helps: attach the debugger to the TaskScheduler instance (very important) (which executes your JobQueue code). A debug next should now 'break' your C/AL Code execution, else a breakpoint should also trigger the debugger.
  • MarOliMarOli Member Posts: 3
    Hi @irasoelbaks i also tried this but the "Debug Next" break my C\AL code only in my current session and doesn't start any other
  • irasoelbaksirasoelbaks Netherlands, theMember Posts: 80
    Split these two sessions. You start a client session via Nst X. Connect debugger to Nst Y and let Nst Y do the task scheduling. Just to be sure also add a breakpoint. This should work in my opinion.
Sign In or Register to comment.