0

I have webjob queue trigger which is responding to queue message and it works fine. However sometimes we push messages manually in queue and if there is manual mistake which causes DecoderFallBackException. But the strange behavior is that looks like webjob keeps trying unlimited times and our AI logs are creating a mess. I tried restarting webjob to see if it clears any internal cache but doesn’t help. only thing which helps is deleting queue

Ideally any exception beyond deque count should move message to poison queue.

1 Answers1

0

I've tried to reproduce your issue on my side, but it works well. First I create a backend demo to insert invalid byte message in queue that could cause DecoderFallBackException

            Encoding ae = Encoding.GetEncoding(
              "us-ascii",
              new EncoderExceptionFallback(),
              new DecoderExceptionFallback());
            string inputString = "XYZ";
            byte[] encodedBytes = new byte[ae.GetByteCount(inputString)];
            ae.GetBytes(inputString, 0, inputString.Length,
                                       encodedBytes, 0);
            //make the byte invalid 
            encodedBytes[0] = 0xFF;
            encodedBytes[2] = 0xFF;

            CloudQueueMessage message = new CloudQueueMessage(encodedBytes);
            queue.AddMessage(message);

Web Job code:

        public static void ProcessQueueMessage([QueueTrigger("queue")] string message, TextWriter log)
        {
            log.WriteLine(message);
        }

After 5 times the exception occurs, the message is moved to 'queue-poison'. This is the expected behavior. Check here for details:

maxDequeueCount 5   The number of times to try processing a message before moving it to the poison queue.

You may check if you accidently set "maxDequeueCount" to bigger value. If not, please provide your webjob code and how you find DecoderFallBackException for us to investigate.

Tom Luo
  • 602
  • 3
  • 10