Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f245fa164b61df75f3ec00b3be67c4fa9a59a2fa
Ticket: b9bfaf5fdb2cb794475fa70121c88859a8fc8496
EAGAIN throw in reflected channel in blocking mode causes eof (data loss)
User & Date: sebres on 2016-07-11 19:22:00
Changes

  1. icomment:
    Example demo-code see in attachment "reflected channel - multi-threaded demo-test.tcl"
    <br><br>
    Here is formated result of the execution (see below):<br>
    <ol>
    <li>run - non-blocking - OK, just to indicate, that the return of EAGAIN works at all
    </li>
    <li>run - blocking and wait in worker - OK also (you see the main thread waits in read operation)
    </li>
    <li>run - blocking and no-wait in worker so EAGAIN (for example the wait there is not possible) - ERROR: the main thread gets eof (and stop read), but "** last content" still not available and no real eof in worker.
    </li>
    </ol>
    <pre style="font-size:85%">
    1468262804.306 | tid21E8 | =MTH | ================================================================================
     1468262804.307 | tid21E8 | =MTH | ==== Blocking: 0, Wait-in-worker: 0  ===================
     1468262804.307 | tid21E8 | =MTH | ================================================================================
     1468262804.325 | tid0FF0 | -WRK |  -- channel initialize rc69 ... read
     1468262804.326 | tid0FF0 | -WRK |  ++ channel wait-in-worker 1 blocking 0 eof 0 content {1st data}
     1468262804.326 | tid21E8 | =MTH | CREATED ... rc69
     1468262804.328 | tid0FF0 | -WRK |  -- channel blocking rc69 ... 0
     1468262804.328 | tid0FF0 | -WRK |  .. channel configure rc69 ... -wait-in-worker 1
     1468262804.328 | tid0FF0 | -WRK |  -&gt; channel read rc69 ... 4096
     1468262804.328 | tid0FF0 | -WRK |  &lt;- channel read rc69 ... 8
     1468262804.329 | tid21E8 | =MTH | !!BUF:1st data
     1468262804.329 | tid0FF0 | -WRK |  -&gt; channel read rc69 ... 4096
     1468262804.329 | tid0FF0 | -WRK |  &lt;- channel read rc69 ... EAGAIN
     1468262804.379 | tid0FF0 | -WRK |  -&gt; channel read rc69 ... 4096
     1468262804.379 | tid0FF0 | -WRK |  &lt;- channel read rc69 ... EAGAIN
     1468262804.429 | tid0FF0 | -WRK |  -&gt; channel read rc69 ... 4096
     1468262804.430 | tid0FF0 | -WRK |  &lt;- channel read rc69 ... EAGAIN
     1468262804.481 | tid0FF0 | -WRK |  -&gt; channel read rc69 ... 4096
     1468262804.482 | tid0FF0 | -WRK |  &lt;- channel read rc69 ... EAGAIN
     1468262804.534 | tid0FF0 | -WRK |  -&gt; channel read rc69 ... 4096
     1468262804.534 | tid0FF0 | -WRK |  &lt;- channel read rc69 ... EAGAIN
     1468262804.579 | tid0FF0 | -WRK |  ** last content ...
     1468262804.585 | tid0FF0 | -WRK |  -&gt; channel read rc69 ... 4096
     1468262804.585 | tid0FF0 | -WRK |  &lt;- channel read rc69 ... 10
     1468262804.585 | tid21E8 | =MTH | !!BUF:, 2nd data
     1468262804.636 | tid0FF0 | -WRK |  -&gt; channel read rc69 ... 4096
     1468262804.637 | tid0FF0 | -WRK |  &lt;- channel read rc69 ... 0 - EOF<b style="color:green">
     1468262804.687 | tid21E8 | =MTH | OK**READ:18--1st data, 2nd data</b>
     1468262804.687 | tid21E8 | =MTH | CLOSE ... rc69
     1468262804.688 | tid0FF0 | -WRK |  -- channel finalize rc69 ...
     1468262804.688 | tid0FF0 | -WRK |  -- channel wait-in-worker 1 blocking 0 eof 1 content {}
     1468262804.689 | tid21E8 | =MTH | ================================================================================
     1468262804.689 | tid21E8 | =MTH | ==== Blocking: 1, Wait-in-worker: 1  ===================
     1468262804.689 | tid21E8 | =MTH | ================================================================================
     1468262804.690 | tid0FF0 | -WRK |  -- channel initialize rc70 ... read
     1468262804.690 | tid0FF0 | -WRK |  ++ channel wait-in-worker 1 blocking 0 eof 0 content {1st data}
     1468262804.690 | tid21E8 | =MTH | CREATED ... rc70
     1468262804.691 | tid0FF0 | -WRK |  -- channel blocking rc70 ... 1
     1468262804.691 | tid0FF0 | -WRK |  .. channel configure rc70 ... -wait-in-worker 1
     1468262804.691 | tid0FF0 | -WRK |  -&gt; channel read rc70 ... 4096
     1468262804.691 | tid0FF0 | -WRK |  &lt;- channel read rc70 ... 8
     1468262804.692 | tid0FF0 | -WRK |  -&gt; channel read rc70 ... 4096
     1468262804.941 | tid0FF0 | -WRK |  ** last content ...
     1468262804.942 | tid0FF0 | -WRK |  &lt;- channel read rc70 ... 10
     1468262804.942 | tid0FF0 | -WRK |  -&gt; channel read rc70 ... 4096<b style="color:green">
     1468262804.942 | tid0FF0 | -WRK |  &lt;- channel read rc70 ... 0 - EOF
     1468262804.942 | tid21E8 | =MTH | !!BUF:1st data, 2nd data
     1468262804.942 | tid21E8 | =MTH | OK**READ:18--1st data, 2nd data</b>
     1468262804.943 | tid21E8 | =MTH | CLOSE ... rc70
     1468262804.943 | tid0FF0 | -WRK |  -- channel finalize rc70 ...
     1468262804.943 | tid0FF0 | -WRK |  -- channel wait-in-worker 1 blocking 1 eof 1 content {}
     1468262804.943 | tid21E8 | =MTH | ================================================================================
     1468262804.943 | tid21E8 | =MTH | ==== Blocking: 1, Wait-in-worker: 0  ===================
     1468262804.943 | tid21E8 | =MTH | ================================================================================
     1468262804.944 | tid0FF0 | -WRK |  -- channel initialize rc71 ... read
     1468262804.944 | tid0FF0 | -WRK |  ++ channel wait-in-worker 1 blocking 0 eof 0 content {1st data}
     1468262804.944 | tid21E8 | =MTH | CREATED ... rc71
     1468262804.945 | tid0FF0 | -WRK |  -- channel blocking rc71 ... 1
     1468262804.945 | tid0FF0 | -WRK |  .. channel configure rc71 ... -wait-in-worker 0
     1468262804.945 | tid0FF0 | -WRK |  -&gt; channel read rc71 ... 4096
     1468262804.945 | tid0FF0 | -WRK |  &lt;- channel read rc71 ... 8
     1468262804.946 | tid0FF0 | -WRK |  -&gt; channel read rc71 ... 4096<b style="color:red">
     1468262804.946 | tid0FF0 | -WRK |  &lt;- channel read rc71 ... EAGAIN
     1468262804.946 | tid21E8 | =MTH | !!BUF:1st data
     1468262804.947 | tid21E8 | =ERR | ERROR**READ:8--1st data</b>
     1468262804.947 | tid21E8 | =MTH | CLOSE ... rc71
     1468262804.948 | tid0FF0 | -WRK |  -- channel finalize rc71 ...
     1468262804.948 | tid0FF0 | -WRK |  -- channel wait-in-worker 0 blocking 1 eof 0 content {}
     1468262804.948 | tid21E8 | =MTH | ================================================================================
    </pre>
    
  2. login: "sebres"
  3. mimetype: "text/html"