Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - select does not unblock when iofunc_notify_trigger invoked from a relatively low priority thread: (3 Items)
   
select does not unblock when iofunc_notify_trigger invoked from a relatively low priority thread  
Observed in QNX 6.5.0 running on in house hardware with EP9301 Cirrus logic SoC.

The problem described here involved two threads ( a Server and Client) with threads as mentioned below

A server with two threads
   Thread 1 running resource manger message loop to handle request from client process at priority 11
   Thread 2 runs periodically (every 2 seconds) and populates data in a queue and notifies the client by calling 
iofunc_notify_trigger()

A client with single thread running at priority 11
   This thread runs a loop to read data from server when data is available. This thread blocks on a select call while 
waiting for server to produce the data for reading.


Problem:
======
   When the client process is started, the select() returns immediately as long as data is available on server queue and
 the client is able to read the data.
   When the server queue is empty, the client thread blocks on select().
   At this point, the server Thread 2 add data to server queue and notify the client by calling iofunc_notify_trigger().

   The client thread gets unblocked and it again blocks on select() after reading the available data.
   
   Now, the next iofunc_notify_trigger() from server Thread 2 does not unblock the client thread from select() and it 
continue to wait on SigWaitInfo state.
   (NOTE: The call to IOFUNC_NOTIFY_INPUT_CHECK(notifylist,1,0) just before the iofunc_notify_trigger() returned true)
   All subsequent check to IOFUNC_NOTIFY_INPUT_CHECK(notifylist,1,0) returns false.
   At this point the server is waiting for client to arm using IO_NOTIFY client message and the client it waiting for 
server to notify_trigger.

Observations:
=========
    1) If I change the server Thread 2 priority to 11 or more then the problem does not occur. 
        I tried with different priorities for client thread and server Thread 2, it works only when the server Thread 2 
priority is greater than or equal to the client thread priority.
    
    2) If I add timeout to select(), the client gets unblocked after timeout and it is able to detect the data 
availability on next select call and read the data successfully.  
       After reading all available accumulated data it goes to blocked state and the problem happens again.

Question:
======
I could not find any mention about the expected priority for a thread  invoking iofunc_notify_trigger (or 
MsgDeliverEvent) method in the QNX documentation.
How does the priority of the thread invoking the iofunc_notify_trigger() method cause select to block indefinitely?
If priority is the problem, how does it getting unblocked for the first time?
Re: select does not unblock when iofunc_notify_trigger invoked from a relatively low priority thread  
Hi,

I'm not sure this question can be easily answered unless you provide a little test case. What makes me wonder though is 
that you mention that your thread is blocked in the state of SigWaitInfo. Is this really the state a thread goes into 
when blocking on a select() call? 

Regards,

- Malte

Re: select does not unblock when iofunc_notify_trigger invoked from a relatively low priority thread  
Sigwaitinfo is normal.

Sent from my BlackBerry 10 smartphone on the Rogers network.
  Original Message
From: Malte Mundt
Sent: Wednesday, April 1, 2015 5:52 AM
To: momentics-community
Reply To: momentics-community@community.qnx.com
Subject: Re: select does not unblock when iofunc_notify_trigger invoked from a relatively low priority thread


Hi,

I'm not sure this question can be easily answered unless you provide a little test case. What makes me wonder though is 
that you mention that your thread is blocked in the state of SigWaitInfo. Is this really the state a thread goes into 
when blocking on a select() call?

Regards,

- Malte





_______________________________________________

QNX Momentics Community Support
http://community.qnx.com/sf/go/post113660
To cancel your subscription to this discussion, please e-mail momentics-community-unsubscribe@community.qnx.com