MsgPool Error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MsgPool Error

Jump to solution
610 Views
paulchadbourne
Contributor II

Hello everyone.  I am currently having an issue where when my code attempts to send a message to a task it sometimes generates an "Invalid Message" error in the Task Summary.  Now it does not happen every time.  Sometimes the code runs fine for a few seconds, sending messages just fine.  I currently have two tasks sending messages to a third task.  Both have experienced this invalid message error.  Now I can find in the MQX code where this Invalid Message Task Error is logged in the Task Summary.  This error is being generated specifically by an invalid message, not from trying to send a freed message or one already on a queue.  Also, when I run Check for Errors I also see that two tasks are reporting MsgPool errors saying that there are invalid messages in their pools.

I guess I have two questions.  First, does anyone have any idea why I am getting an invalid message error when performing a send?  This send is not complicated.  I allocate the message in the target task's pool, set the source and target in the message header, add some data, and then send the message.  Like I said this fails intermittently.  My second question is where are the MsgPool Errors I am seeing in Check for Errors logged in the MQX code?

Also it's worth mentioning that the MQX code that logs the Invalid Message error in the Task Summary does not log the error in Check for Errors.  Meaning when I put a breakpoint where the error is logged in Task Summary, the MsgPool Errors are already reported in Check for Errors.

I am running MQX v3.6 I believe.

Thanks the help and I hope I explained my issue clearly enough.

Paul

0 Kudos
1 Solution
387 Views
paulchadbourne
Contributor II

I believe I found what was causing my problem.  I was writing 254 bytes of data into an 80 byte array...  Hence I was overwriting God knows what and corrupting messages in the pool.  That's where the invalid message errors were coming from in Check for Errors.  I know I said above that I wasn't writing data to the message, but I messed up and was actually still writing data to one of the message.  So, that was my problem.  Classic blowing out of an array.  I guess I need to re-take "Introduction to Programming C".

I'm going to let my code run over-night before I call this fixed.

View solution in original post

0 Kudos
2 Replies
388 Views
paulchadbourne
Contributor II

I believe I found what was causing my problem.  I was writing 254 bytes of data into an 80 byte array...  Hence I was overwriting God knows what and corrupting messages in the pool.  That's where the invalid message errors were coming from in Check for Errors.  I know I said above that I wasn't writing data to the message, but I messed up and was actually still writing data to one of the message.  So, that was my problem.  Classic blowing out of an array.  I guess I need to re-take "Introduction to Programming C".

I'm going to let my code run over-night before I call this fixed.

0 Kudos
387 Views
paulchadbourne
Contributor II

Let me simplify my question.  Does anyone know where the error "MsgPool Error  Message # not valid, in pool #" is logged or generated in MQX?  I see this error when I run Check for Errors.  I am using the function _msg_alloc() to create the message in the task's message pool.  I actually stepped through _msg_alloc to see if there was a spot where an "invalid message" was declared, but I didn't see anything.  There are checks for an invalid pool, a NULL message, and "out of messages", but nothing specifically for an "invalid message".

0 Kudos