mqueue send error on ppc

bridged with qdn.public.qnxrtp.powerpc
Post Reply
Trev Brown

mqueue send error on ppc

Post by Trev Brown » Mon Nov 24, 2003 3:05 pm

Hi all,

I am new to QNX and have come up against a problem in the implementation/use
of POSIX message queues on a ppc platfrom. We are doing a timedsend to put
data into our queues and then a timedreceive to take data off the queues.
The idea being that we send data to the queue at regular intervals when it
is ready to send.

As said we then do a timedsend to read data off the queues. If any data is
in the queue to be read we read from the queue. If NO we back off for a
timedinterval before trying to read from the queues again. When this is
tried we get success at first but then plenty of "Didn't send to message
queue errors" acdcompanied by signal errors of type EINTR. Everything then
just grinds to a halt and our target crashes.

What is even more confusing is that on an x86 platform this works well with
no errors. Same code in each case.

Any idea what's happenning? Any advice would be very appreciated.



Thanks in advance,


Trev.

Trev Brown

Re: mqueue send error on ppc

Post by Trev Brown » Mon Nov 24, 2003 3:22 pm

Sorry, i meant that we do a timereceive to get messages of our queues.

"Trev Brown" <trevorb@ieee.org> wrote in message
news:bpt5i5$aib$1@inn.qnx.com...
Hi all,

I am new to QNX and have come up against a problem in the
implementation/use
of POSIX message queues on a ppc platfrom. We are doing a timedsend to put
data into our queues and then a timedreceive to take data off the queues.
The idea being that we send data to the queue at regular intervals when it
is ready to send.

As said we then do a timedsend to read data off the queues. If any data is
in the queue to be read we read from the queue. If NO we back off for a
timedinterval before trying to read from the queues again. When this is
tried we get success at first but then plenty of "Didn't send to message
queue errors" acdcompanied by signal errors of type EINTR. Everything
then
just grinds to a halt and our target crashes.

What is even more confusing is that on an x86 platform this works well
with
no errors. Same code in each case.

Any idea what's happenning? Any advice would be very appreciated.



Thanks in advance,


Trev.

Igor Kovalenko

Re: mqueue send error on ppc

Post by Igor Kovalenko » Mon Nov 24, 2003 4:41 pm

EINTR means a syscall was interrupted by an asynchronous signal.
Do you use any signals in the application (for timers, etc) ?

"Trev Brown" <trevorb@ieee.org> wrote in message
news:bpt5i5$aib$1@inn.qnx.com...
Hi all,

I am new to QNX and have come up against a problem in the
implementation/use
of POSIX message queues on a ppc platfrom. We are doing a timedsend to put
data into our queues and then a timedreceive to take data off the queues.
The idea being that we send data to the queue at regular intervals when it
is ready to send.

As said we then do a timedsend to read data off the queues. If any data is
in the queue to be read we read from the queue. If NO we back off for a
timedinterval before trying to read from the queues again. When this is
tried we get success at first but then plenty of "Didn't send to message
queue errors" acdcompanied by signal errors of type EINTR. Everything
then
just grinds to a halt and our target crashes.

What is even more confusing is that on an x86 platform this works well
with
no errors. Same code in each case.

Any idea what's happenning? Any advice would be very appreciated.



Thanks in advance,


Trev.

Trev Brown

Re: mqueue send error on ppc

Post by Trev Brown » Mon Nov 24, 2003 5:47 pm

Hi Igor,

No signals are used in the application. We are doing mq_timedsend with an
interval time of 5ms. Also to try and stop the signal we have masked out
all the signals we can, but the EINTR signal still occurs(we assume that
this is because this signal cannot be masked).

Any idea why we would get this signal on a timedsend? We have also
semaphore locked the timedsend function in our code.


Thanks,


Trev.
"Igor Kovalenko" <kovalenko@attbi.com> wrote in message
news:bptb7d$emb$1@inn.qnx.com...
EINTR means a syscall was interrupted by an asynchronous signal.
Do you use any signals in the application (for timers, etc) ?

"Trev Brown" <trevorb@ieee.org> wrote in message
news:bpt5i5$aib$1@inn.qnx.com...
Hi all,

I am new to QNX and have come up against a problem in the
implementation/use
of POSIX message queues on a ppc platfrom. We are doing a timedsend to
put
data into our queues and then a timedreceive to take data off the
queues.
The idea being that we send data to the queue at regular intervals when
it
is ready to send.

As said we then do a timedsend to read data off the queues. If any data
is
in the queue to be read we read from the queue. If NO we back off for a
timedinterval before trying to read from the queues again. When this is
tried we get success at first but then plenty of "Didn't send to message
queue errors" acdcompanied by signal errors of type EINTR. Everything
then
just grinds to a halt and our target crashes.

What is even more confusing is that on an x86 platform this works well
with
no errors. Same code in each case.

Any idea what's happenning? Any advice would be very appreciated.



Thanks in advance,


Trev.



David Gibbs

Re: mqueue send error on ppc

Post by David Gibbs » Mon Nov 24, 2003 9:51 pm

Trev Brown <trevorb@ieee.org> wrote:
Hi Igor,

No signals are used in the application. We are doing mq_timedsend with an
interval time of 5ms. Also to try and stop the signal we have masked out
all the signals we can, but the EINTR signal still occurs(we assume that
this is because this signal cannot be masked).

Any idea why we would get this signal on a timedsend? We have also
semaphore locked the timedsend function in our code.
Actually, that EINTR could be caused by your timeout as well.

mq_timedsend() is implemented by a kernel timeout, followed by
(essentially) a regular mq_send().

The the timeout happens, mqueue (the server) gets a pulse telling it the
client has tried to unblock, but not why (timeout, signal, thread
cancellation, etc.) -- so treats them all as a signal, and does a
MsgError( rcvid, EINTR ) causing you to get the EINTR even when you've
timed out.

This could definitely be confusing, and may be wrong behaviour.

-David
--
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Adam Mallory

Re: mqueue send error on ppc

Post by Adam Mallory » Mon Nov 24, 2003 9:52 pm

What version of QNX6 are you using?

-Adam

Trev Brown <trevorb@ieee.org> wrote in message
news:bptf10$h78$1@inn.qnx.com...
Hi Igor,

No signals are used in the application. We are doing mq_timedsend with an
interval time of 5ms. Also to try and stop the signal we have masked out
all the signals we can, but the EINTR signal still occurs(we assume that
this is because this signal cannot be masked).

Any idea why we would get this signal on a timedsend? We have also
semaphore locked the timedsend function in our code.


Thanks,


Trev.
"Igor Kovalenko" <kovalenko@attbi.com> wrote in message
news:bptb7d$emb$1@inn.qnx.com...
EINTR means a syscall was interrupted by an asynchronous signal.
Do you use any signals in the application (for timers, etc) ?

"Trev Brown" <trevorb@ieee.org> wrote in message
news:bpt5i5$aib$1@inn.qnx.com...
Hi all,

I am new to QNX and have come up against a problem in the
implementation/use
of POSIX message queues on a ppc platfrom. We are doing a timedsend to
put
data into our queues and then a timedreceive to take data off the
queues.
The idea being that we send data to the queue at regular intervals
when
it
is ready to send.

As said we then do a timedsend to read data off the queues. If any
data
is
in the queue to be read we read from the queue. If NO we back off for
a
timedinterval before trying to read from the queues again. When this
is
tried we get success at first but then plenty of "Didn't send to
message
queue errors" acdcompanied by signal errors of type EINTR. Everything
then
just grinds to a halt and our target crashes.

What is even more confusing is that on an x86 platform this works well
with
no errors. Same code in each case.

Any idea what's happenning? Any advice would be very appreciated.



Thanks in advance,


Trev.





Igor Kovalenko

Re: mqueue send error on ppc

Post by Igor Kovalenko » Tue Nov 25, 2003 8:34 am

I was also suspecting what David has said... just wanted to be sure you
don't have anything going with signals of your own.

You might try to wrap the call to mq_receive into a loop, checking the
return code/errno for EINTR. If the errno happens to be EINTR, just keep
spinning, otherwise bail out for real. This is a common way of dealing with
EINTR on systems that don't support SA_RESTART feature.

-- igor

"Trev Brown" <trevorb@ieee.org> wrote in message
news:bptf10$h78$1@inn.qnx.com...
Hi Igor,

No signals are used in the application. We are doing mq_timedsend with an
interval time of 5ms. Also to try and stop the signal we have masked out
all the signals we can, but the EINTR signal still occurs(we assume that
this is because this signal cannot be masked).

Any idea why we would get this signal on a timedsend? We have also
semaphore locked the timedsend function in our code.


Thanks,


Trev.
"Igor Kovalenko" <kovalenko@attbi.com> wrote in message
news:bptb7d$emb$1@inn.qnx.com...
EINTR means a syscall was interrupted by an asynchronous signal.
Do you use any signals in the application (for timers, etc) ?

"Trev Brown" <trevorb@ieee.org> wrote in message
news:bpt5i5$aib$1@inn.qnx.com...
Hi all,

I am new to QNX and have come up against a problem in the
implementation/use
of POSIX message queues on a ppc platfrom. We are doing a timedsend to
put
data into our queues and then a timedreceive to take data off the
queues.
The idea being that we send data to the queue at regular intervals
when
it
is ready to send.

As said we then do a timedsend to read data off the queues. If any
data
is
in the queue to be read we read from the queue. If NO we back off for
a
timedinterval before trying to read from the queues again. When this
is
tried we get success at first but then plenty of "Didn't send to
message
queue errors" acdcompanied by signal errors of type EINTR. Everything
then
just grinds to a halt and our target crashes.

What is even more confusing is that on an x86 platform this works well
with
no errors. Same code in each case.

Any idea what's happenning? Any advice would be very appreciated.



Thanks in advance,


Trev.





Trev Brown

Re: mqueue send error on ppc

Post by Trev Brown » Tue Nov 25, 2003 10:24 am

Hi Igor,

Thank you for this advice. I will attempt to do as you have suggested and
will tell you of the results.

Best Regards,


Trev.

"Igor Kovalenko" <kovalenko@attbi.com> wrote in message
news:bpv334$kfq$1@inn.qnx.com...
I was also suspecting what David has said... just wanted to be sure you
don't have anything going with signals of your own.

You might try to wrap the call to mq_receive into a loop, checking the
return code/errno for EINTR. If the errno happens to be EINTR, just keep
spinning, otherwise bail out for real. This is a common way of dealing
with
EINTR on systems that don't support SA_RESTART feature.

-- igor

"Trev Brown" <trevorb@ieee.org> wrote in message
news:bptf10$h78$1@inn.qnx.com...
Hi Igor,

No signals are used in the application. We are doing mq_timedsend with
an
interval time of 5ms. Also to try and stop the signal we have masked
out
all the signals we can, but the EINTR signal still occurs(we assume that
this is because this signal cannot be masked).

Any idea why we would get this signal on a timedsend? We have also
semaphore locked the timedsend function in our code.


Thanks,


Trev.
"Igor Kovalenko" <kovalenko@attbi.com> wrote in message
news:bptb7d$emb$1@inn.qnx.com...
EINTR means a syscall was interrupted by an asynchronous signal.
Do you use any signals in the application (for timers, etc) ?

"Trev Brown" <trevorb@ieee.org> wrote in message
news:bpt5i5$aib$1@inn.qnx.com...
Hi all,

I am new to QNX and have come up against a problem in the
implementation/use
of POSIX message queues on a ppc platfrom. We are doing a timedsend
to
put
data into our queues and then a timedreceive to take data off the
queues.
The idea being that we send data to the queue at regular intervals
when
it
is ready to send.

As said we then do a timedsend to read data off the queues. If any
data
is
in the queue to be read we read from the queue. If NO we back off
for
a
timedinterval before trying to read from the queues again. When this
is
tried we get success at first but then plenty of "Didn't send to
message
queue errors" acdcompanied by signal errors of type EINTR.
Everything
then
just grinds to a halt and our target crashes.

What is even more confusing is that on an x86 platform this works
well
with
no errors. Same code in each case.

Any idea what's happenning? Any advice would be very appreciated.



Thanks in advance,


Trev.







Trev Brown

Re: mqueue send error on ppc

Post by Trev Brown » Tue Nov 25, 2003 10:29 am

Hi Adam,

I am using QNX 6.2.1 Patch B.


"Adam Mallory" <amallory@qnx.com> wrote in message
news:bptubt$ann$1@nntp.qnx.com...
What version of QNX6 are you using?

-Adam

Trev Brown <trevorb@ieee.org> wrote in message
news:bptf10$h78$1@inn.qnx.com...
Hi Igor,

No signals are used in the application. We are doing mq_timedsend with
an
interval time of 5ms. Also to try and stop the signal we have masked
out
all the signals we can, but the EINTR signal still occurs(we assume that
this is because this signal cannot be masked).

Any idea why we would get this signal on a timedsend? We have also
semaphore locked the timedsend function in our code.


Thanks,


Trev.
"Igor Kovalenko" <kovalenko@attbi.com> wrote in message
news:bptb7d$emb$1@inn.qnx.com...
EINTR means a syscall was interrupted by an asynchronous signal.
Do you use any signals in the application (for timers, etc) ?

"Trev Brown" <trevorb@ieee.org> wrote in message
news:bpt5i5$aib$1@inn.qnx.com...
Hi all,

I am new to QNX and have come up against a problem in the
implementation/use
of POSIX message queues on a ppc platfrom. We are doing a timedsend
to
put
data into our queues and then a timedreceive to take data off the
queues.
The idea being that we send data to the queue at regular intervals
when
it
is ready to send.

As said we then do a timedsend to read data off the queues. If any
data
is
in the queue to be read we read from the queue. If NO we back off
for
a
timedinterval before trying to read from the queues again. When this
is
tried we get success at first but then plenty of "Didn't send to
message
queue errors" acdcompanied by signal errors of type EINTR.
Everything
then
just grinds to a halt and our target crashes.

What is even more confusing is that on an x86 platform this works
well
with
no errors. Same code in each case.

Any idea what's happenning? Any advice would be very appreciated.



Thanks in advance,


Trev.







Trev Brown

Re: mqueue send error on ppc

Post by Trev Brown » Tue Nov 25, 2003 10:30 am

Hi Davis,

Yes, this could be the answer. I will attempt to examine the queue
attributes to see if we are exhausting queue resources. I'll let you know
the results.

Best Regards,

Trev.

"David Gibbs" <dagibbs@qnx.com> wrote in message
news:bptug9$9j4$3@nntp.qnx.com...
Trev Brown <trevorb@ieee.org> wrote:
Hi Igor,

No signals are used in the application. We are doing mq_timedsend with
an
interval time of 5ms. Also to try and stop the signal we have masked
out
all the signals we can, but the EINTR signal still occurs(we assume that
this is because this signal cannot be masked).

Any idea why we would get this signal on a timedsend? We have also
semaphore locked the timedsend function in our code.

Actually, that EINTR could be caused by your timeout as well.

mq_timedsend() is implemented by a kernel timeout, followed by
(essentially) a regular mq_send().

The the timeout happens, mqueue (the server) gets a pulse telling it the
client has tried to unblock, but not why (timeout, signal, thread
cancellation, etc.) -- so treats them all as a signal, and does a
MsgError( rcvid, EINTR ) causing you to get the EINTR even when you've
timed out.

This could definitely be confusing, and may be wrong behaviour.

-David
--
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Trev Brown

Re: mqueue send error on ppc

Post by Trev Brown » Tue Nov 25, 2003 1:05 pm

Hi Igor,

Ok, I've tried as you suggested. We still get the same problems and after
examining the mq_attr structure we can see our queues are getting filled up
very quickly. Do you think that the EINTR could cause this happen?

Thanks,

Trev.

"Trev Brown" <trevorb@ieee.org> wrote in message
news:bpvaau$q9l$1@inn.qnx.com...
Hi Igor,

Thank you for this advice. I will attempt to do as you have suggested and
will tell you of the results.

Best Regards,


Trev.

"Igor Kovalenko" <kovalenko@attbi.com> wrote in message
news:bpv334$kfq$1@inn.qnx.com...
I was also suspecting what David has said... just wanted to be sure you
don't have anything going with signals of your own.

You might try to wrap the call to mq_receive into a loop, checking the
return code/errno for EINTR. If the errno happens to be EINTR, just keep
spinning, otherwise bail out for real. This is a common way of dealing
with
EINTR on systems that don't support SA_RESTART feature.

-- igor

"Trev Brown" <trevorb@ieee.org> wrote in message
news:bptf10$h78$1@inn.qnx.com...
Hi Igor,

No signals are used in the application. We are doing mq_timedsend
with
an
interval time of 5ms. Also to try and stop the signal we have masked
out
all the signals we can, but the EINTR signal still occurs(we assume
that
this is because this signal cannot be masked).

Any idea why we would get this signal on a timedsend? We have also
semaphore locked the timedsend function in our code.


Thanks,


Trev.
"Igor Kovalenko" <kovalenko@attbi.com> wrote in message
news:bptb7d$emb$1@inn.qnx.com...
EINTR means a syscall was interrupted by an asynchronous signal.
Do you use any signals in the application (for timers, etc) ?

"Trev Brown" <trevorb@ieee.org> wrote in message
news:bpt5i5$aib$1@inn.qnx.com...
Hi all,

I am new to QNX and have come up against a problem in the
implementation/use
of POSIX message queues on a ppc platfrom. We are doing a
timedsend
to
put
data into our queues and then a timedreceive to take data off the
queues.
The idea being that we send data to the queue at regular intervals
when
it
is ready to send.

As said we then do a timedsend to read data off the queues. If any
data
is
in the queue to be read we read from the queue. If NO we back off
for
a
timedinterval before trying to read from the queues again. When
this
is
tried we get success at first but then plenty of "Didn't send to
message
queue errors" acdcompanied by signal errors of type EINTR.
Everything
then
just grinds to a halt and our target crashes.

What is even more confusing is that on an x86 platform this works
well
with
no errors. Same code in each case.

Any idea what's happenning? Any advice would be very appreciated.



Thanks in advance,


Trev.









Trev Brown

Re: mqueue send error on ppc

Post by Trev Brown » Tue Nov 25, 2003 5:00 pm

Hi Igor,

Another thing we have just spotted. The mq_receive does not seem to fail.
I have some code which will printf to stdout whenever a mq_receive occurs,
but this does not ever happen. the errors only seem to occur on
mq_timedsend.

This is really puzzling. We have now tried to linit the number of threads
in the system to reduce the number of queues we use but the problem is still
there.

Please can you give me any further thoughts you may have regarding this
problem.


Thanks,

Trev.


"Igor Kovalenko" <kovalenko@attbi.com> wrote in message
news:bpv334$kfq$1@inn.qnx.com...
I was also suspecting what David has said... just wanted to be sure you
don't have anything going with signals of your own.

You might try to wrap the call to mq_receive into a loop, checking the
return code/errno for EINTR. If the errno happens to be EINTR, just keep
spinning, otherwise bail out for real. This is a common way of dealing
with
EINTR on systems that don't support SA_RESTART feature.

-- igor

"Trev Brown" <trevorb@ieee.org> wrote in message
news:bptf10$h78$1@inn.qnx.com...
Hi Igor,

No signals are used in the application. We are doing mq_timedsend with
an
interval time of 5ms. Also to try and stop the signal we have masked
out
all the signals we can, but the EINTR signal still occurs(we assume that
this is because this signal cannot be masked).

Any idea why we would get this signal on a timedsend? We have also
semaphore locked the timedsend function in our code.


Thanks,


Trev.
"Igor Kovalenko" <kovalenko@attbi.com> wrote in message
news:bptb7d$emb$1@inn.qnx.com...
EINTR means a syscall was interrupted by an asynchronous signal.
Do you use any signals in the application (for timers, etc) ?

"Trev Brown" <trevorb@ieee.org> wrote in message
news:bpt5i5$aib$1@inn.qnx.com...
Hi all,

I am new to QNX and have come up against a problem in the
implementation/use
of POSIX message queues on a ppc platfrom. We are doing a timedsend
to
put
data into our queues and then a timedreceive to take data off the
queues.
The idea being that we send data to the queue at regular intervals
when
it
is ready to send.

As said we then do a timedsend to read data off the queues. If any
data
is
in the queue to be read we read from the queue. If NO we back off
for
a
timedinterval before trying to read from the queues again. When this
is
tried we get success at first but then plenty of "Didn't send to
message
queue errors" acdcompanied by signal errors of type EINTR.
Everything
then
just grinds to a halt and our target crashes.

What is even more confusing is that on an x86 platform this works
well
with
no errors. Same code in each case.

Any idea what's happenning? Any advice would be very appreciated.



Thanks in advance,


Trev.







Post Reply

Return to “qdn.public.qnxrtp.powerpc”