I guess I am not the only one that has installed NAV 2016 running the Job Queue.  If the Job Queue is running a job that causes error you are likely to start the debugger on the service tier running the Job Queue and start with a Debug Next.

DebugNext2

You can expect a break point with an error similar to this one.

Error

Well, not what you where hoping for.  Not the job you where planning to debug, right.  Well, you try again and get the same error, never getting to the error you wanted to debug in the first place.  And why is that?

Microsoft decided to utilize the TryFunction in the Job Queue

TryFunction

So, each time JobQueueEntry.FINDFIRST fails the debugger breaks.  So I asked Microsoft, why change this from being an normal function containing EXIT(JobQueueEntry.FINDFIRST).  The response was:

“We wrapped the FINDFIRST in a TRY-function because we regularly got (dead-)lock errors when we had multiple queues running at the same time, and this fix has virtually eliminated that problem. And since we cannot have return values from try-functions, we would have to pass on a boolean VAR parameter to indicate if it was found or not.”

Ok, so there is a reason, and a good one.

So I started a little ping pong with Microsoft and we agreed that this should be fixed.  A new local function was added to Codeunit 448 and the TryFunction was modified.  The previous call to a TryFunction was modified to call the new local function instead.

448Modification

So, both problems fixed; (dead-)lock not causing the Job Queue to stop and we are not getting troublesome break points in the debugger.

Attached are Delta, FOB and TXT versions for this fix.

COD448

 

 

4 thoughts on “Impossible to debug the Job Queue in NAV 2016?

  1. This is a very good article, and I came across the same issue.

    However, I still don’t understand how Try function can help with a deadlock? Or does it help in a way that it still deadlocks, gets killed, but process continues?

    1. in previous version the job queue stopped in case of a deadlock. Now it will just tick on…

    2. Geovanny says:

      Excellent, thank you for digging into it.
      Will this be an update to future 2016 updates or 2017 standard?

      Geovanny

      1. It i already fixed from Microsoft in 2016. From 2017 the Job Queue is using Task Scheduler so this is not an issue there.

Leave a Reply

%d bloggers like this: