faust-streaming / mode

Python AsyncIO Services
https://faust-streaming.github.io/mode/
Other
42 stars 16 forks source link

Error closing application #54

Open cmartmos opened 9 months ago

cmartmos commented 9 months ago

Checklist

Expected behavior

No error expected

Actual behavior

RuntimeWarning: coroutine 'sleep' was never awaited (mode/services.py:849)

Full traceback

...
[2023-09-27 14:23:25,835] [13671] [INFO] [^Worker]: Gathering service tasks... 
[2023-09-27 14:23:25,836] [13671] [INFO] [^Worker]: Gathering all futures... 
[2023-09-27 14:23:26,848] [13671] [INFO] [^---ProducerBuffer]: Terminating cancelled task: <coroutine object ProducerBuffer._handle_pending at 0x7fa8f5063610> 
[2023-09-27 14:23:26,851] [13671] [INFO] [^--Consumer]: Terminating cancelled task: <coroutine object Consumer._commit_handler at 0x7fa8f50633e0> 
[2023-09-27 14:23:26,852] [13671] [INFO] [^--Monitor]: Terminating cancelled task: <coroutine object Monitor._sampler at 0x7fa8f5062dc0> 
[2023-09-27 14:23:26,852] [13671] [INFO] [^--Consumer]: Terminating cancelled task: <coroutine object Consumer._commit_livelock_detector at 0x7fa8f4f74350> 
[2023-09-27 14:23:27,854] [13671] [INFO] [^Worker]: Closing event loop 
[2023-09-27 14:23:27,992] [13671] [INFO] [^---AIOKafkaConsumerThread]: Cancelled task <coroutine object ServiceThread._keepalive2 at 0x7fa8f4f744a0>: Event loop is closed 
/venv/proto/lib/python3.10/site-packages/mode/services.py:849: RuntimeWarning: coroutine 'sleep' was never awaited
  self.log.info("Cancelled task %r: %s", task, exc)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Versions

wbarnha commented 9 months ago

Do you have any code for us so we can reproduce this?

cmartmos commented 9 months ago

The issue arises because of unexpected application crashes and then the event loop raises the given error while closing

wbarnha commented 3 months ago

Hard to say what happened here. https://github.com/faust-streaming/mode/blob/5260fa15a9482a216b74253d90a3c80ef9dc4e92/mode/services.py#L841-L854 Based on this log statement, I presume you're using Faust:

[2023-09-27 14:23:26,848] [13671] [INFO] [^---ProducerBuffer]: Terminating cancelled task: <coroutine object ProducerBuffer._handle_pending at 0x7fa8f5063610> 

I wonder if this is moreso a Faust bug than a Mode bug.

wbarnha commented 3 months ago

Oh, wait, it's not. Let me dig into it more.