Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>By putting extra steps, and debugging outputs we figure out that there is a problem with the aio driver on our linux (<strong>5.3 Carthage, 2.6.18-128.el5</strong>)</p> <p>Solution we applied (I'm putting it in just in case someone runs in the the same problem) is this:<br/> <em>(We count elapsed seconds for a call outselves.)</em></p> <p>1) If we see an error returned from <code>io_getevents()</code> we report it. DONE.</p> <p>2) If we see 0 jobs finished and elapsed seconds we count ourselves went above expected one we report an error. DONE. Otherwise we continue (we do not change timeout on <code>io_getevents()</code>)</p> <p>3) If some jobs are finished, we analyze their <code>res</code> for an error (negative value), and if there was any failing job we report it. DONE.</p> <p>4) If there are some remaining jobs, we reset timer (yes, we will again wait 'expected' time) and continue.</p> <p>With this method we will report an error if <code>io_getevents()</code> reported an error or any of the jobs reported an error. In the worst case scenario, when each job returns ok after whole T-epsilon wait time, the whole process will take N * T time to complete.</p> <p>I hope someone will find it useful.<br/> Blessings,<br/> Greg.</p> <p>Example:</p> <pre><code>struct timespec tmCountStart ; unsigned seconds_delay = SECONDS_DELAY ; clock_gettime( CLOCK_REALTIME, &amp;tmCountStart ) ; while ( num_remaining_jobs &gt; 0 ) { struct timespec ts = { seconds_delay, 0 } ; struct io_event events[ num_remaining_jobs ] ; long ec ; do { ec = io_getevents( ctx, num_remaining_jobs, num_remaining_jobs, &amp;events[ 0 ], &amp;ts ) ; } while( ec == -EINTR ) ; if ( ec &lt; 0 ) throw exception reporting error ec. cancel all remaining jobs else if ( ec == 0 ) { const double elapsed = count elapsed seconds from tmCountStart seconds_delay = SECONDS_DELAY - static_cast&lt; unsigned &gt;( elapsed ) ; if ( seconds_delay &gt; SECONDS_DELAY ) throw exception reporting timeout. cancel all remaining jobs } else // we got some jobs back. may not all of them { for ( int i = 0 ; i &lt; ec ; i++ ) if (( int64_t )events[ i ].res &lt; 0 ) throw exception reporting failing job. cancel all remaining jobs. num_remaining_jobs -= ec ; if ( num_remaining_jobs &gt; 0 ) { clock_gettime( CLOCK_REALTIME, &amp;tmCountStart ) ; // reset timer. seconds_delay = SECONDS_DELAY ; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload