title: Starlette + asyncio.create_task() doesn't log error if task object is stored in instance variable
body: <p>Okay, this is very weird, but here goes -</p>
  
  <pre class="lang-py prettyprint-override"><code>import asyncio
  
  from starlette.applications import Starlette
  
  
  class MyTasks:
      def __init__(self):
          self.task = None
  
      async def main(self):
          self.task = asyncio.create_task(self.hello())
  
      async def hello(self):
          raise ValueError
  
  
  async def main():
      await MyTasks().main()
  
  
  app = Starlette(on_startup=[main])
  </code></pre>
  
  <hr>
  
  <pre><code>$ uvicorn test:app
  INFO:     Started server process [26622]
  INFO:     Waiting for application startup.
  INFO:     Application startup complete.
  INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
  </code></pre>
  
  <p>Hmm, no <code>ValueError</code> here...</p>
  
  <hr>
  
  <p>Now, remove the assignment to <code>self.task</code> in <code>MyTasks.main()</code>.</p>
  
  <pre class="lang-py prettyprint-override"><code>    async def main(self):
          asyncio.create_task(self.hello())
      ...
  </code></pre>
  
  <hr>
  
  <pre><code>$ uvicorn test:app
  INFO:     Started server process [29083]
  INFO:     Waiting for application startup.
  ERROR:    Task exception was never retrieved
  future: &lt;Task finished name='Task-3' coro=&lt;MyTasks.hello() done, defined at ./test.py:13&gt; exception=ValueError()&gt;
  Traceback (most recent call last):
    File "./test.py", line 14, in hello
      raise ValueError
  ValueError
  INFO:     Application startup complete.
  INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
  </code></pre>
  
  <p>... And voila.</p>
  
  <hr>
  
  <p>What's going on here? How does that assignment make or break the exception logging!?</p>