Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-37594

SalLogHandler: reduce "coroutine not awaited" messages at shutdown

    XMLWordPrintable

    Details

    • Story Points:
      1
    • Sprint:
      TSSW Sprint - Jan 16 - Jan 30
    • Team:
      Telescope and Site
    • Urgent?:
      No

      Description

      The SalLogHandler is issues a large number "coroutine not awaited" messages after running unit tests. We think this is because logging is synchronous but SalLogHandler writes asynchronously, so it has to create a coroutine for each message it emits, and the fact that it uses asyncio.run_coroutine_threadsafe to do this, so that logging can be done from background threads.

      Try to fix this by keeping track of unfinished concurrent.futures.Futures returned by asyncio.run_coroutine_threadsafe and closing them in the close method of SalLogHandler.

        Attachments

          Activity

          rowen Russell Owen created issue -
          rowen Russell Owen made changes -
          Field Original Value New Value
          Status To Do [ 10001 ] In Progress [ 3 ]
          rowen Russell Owen made changes -
          Reviewers Wouter van Reeven [ wvreeven ]
          Status In Progress [ 3 ] In Review [ 10004 ]
          rowen Russell Owen made changes -
          Summary SalLogHandler: eliminate "coroutine not awaited" messages at shutdown SalLogHandler: reduce "coroutine not awaited" messages at shutdown
          rowen Russell Owen made changes -
          Description The SalLogHandler is prone to issuing "coroutine not awaited" messages at shutdown, because logging is synchronous but SalLogHandler writes asynchronously, so it has to create a coroutine for each message it emits.

          Fix by keeping track of those coroutines (actually concurrent.futures.Future, so threads can also log to SAL) closing unfinished ones at the end.
          The SalLogHandler is issues a large number "coroutine not awaited" messages after running unit tests. We think this is because logging is synchronous but SalLogHandler writes asynchronously, so it has to create a coroutine for each message it emits, and the fact that it uses asyncio.run_coroutine_threadsafe to do this, so that logging can be done from background threads.

          Try to fix this by keeping track of unfinished concurrent.futures.Futures returned by asyncio.run_coroutine_threadsafe and closing them in the {{close}} method of {{SalLogHandler}}.
          wvreeven Wouter van Reeven made changes -
          Status In Review [ 10004 ] Reviewed [ 10101 ]
          rowen Russell Owen made changes -
          Resolution Done [ 10000 ]
          Status Reviewed [ 10101 ] Done [ 10002 ]

            People

            Assignee:
            rowen Russell Owen
            Reporter:
            rowen Russell Owen
            Reviewers:
            Wouter van Reeven
            Watchers:
            Russell Owen, Wouter van Reeven
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Jenkins

                No builds found.