title: Problems with asyncio in 3.4.2 - it just terminates for some reason
body: <p>A newbie at python and spending many hours reading docs and other code I cannot seem to get the new <a href="https://docs.python.org/3/library/asyncio.html" rel="nofollow"><code>asyncio</code></a> module in Python 3.
  It keeps on terminating without a stack trace to give me a clue and should run forever but does not.</p>
  
  <p>The fundamental process concept I am trying to emulate is the following:</p>
  
  <p><em>read from port:</em>
  open port -> read data (variable length) -> place on queue1</p>
  
  <p><em>then process data:</em>
  get data from queue1 -> condition applies -> outcome put on queue2</p>
  
  <p><em>then write to port:</em>
  get data from queue2 and write to port</p>
  
  <p>loop around from top forever</p>
  
  <p>Note: The data on the in port is sporadic, variable length and several blocks may arrive out of 'sequence' thus I use <code>asyncio</code>. I understand <code>asyncio</code> will allow the case of a block arrives, then another prior to my app responding - i.e. the call <code>get_io_from_port()</code> facilitates multiple executions of the co-routine. This is why I have use the queues to ensure non-blocking of the <code>process_queue()</code></p>
  
  <p>My toy example code so far:</p>
  
  <pre><code>import queue
  import asyncio
  
  @asyncio.coroutine
  def process_queue(q1, q2):
      tmp = q1.Get()
      if tmp == 'ABCDEF':
          q2.put('12345')
      elif tmp == 'GHIJKL':
          q2.put =('67890')
      else:
          print('There is a data error')
  
  @asyncio.coroutine
  def put_io_to_port(writer, q2):
  
      if not q2.empty():
          try:
                  writer.write(q2.get())
  
          except IOError as e:
              print('OUT Port issue: ', e)
  
  @asyncio.coroutine
  def get_io_from_port(reader, q1):
  
      try:
          data_i = yield from reader.read(1200)
          q1.put(data_i)
  
      except IOError as e:
          print('IN Port issue: ', e)
  
  def main():
  
      q1 = queue()
      q2 = queue()
  
      loop = asyncio.get_event_loop()     # main loop declaration
      reader, writer = yield from asyncio.open_connection('192.168.1.103', 5555)
                  # high-level call open streams - read and write
  
      print('Start')
      tasks = [
          asyncio.async(get_io_from_port(reader,q1)),
          asyncio.async(process_queue(q1, q2)),
          asyncio.async(put_io_to_port(writer, q2)),]  # do these tasks - in this order
  
      loop.run_forever(tasks)     # loop through on main loop forever
      loop.close()
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>Also, as an aside - how does one debug this code - ie tracing? What techniques could be suggested? I am using Eclipse and PyDev but to no avail.</p>