Skip to content

Review plugin execution timeout #36

@tututumuru

Description

@tututumuru

Hi,

https://github.com/Visecy/Karuha/blob/master/karuha/plugin_server.py#L10

I noticed an interesting config value:

This value is in milliseconds (0.02 sec!), meaning the plugin is expected to respond instantly and trigger a deferred task.

If a user performs a heavy operation inside the plugin, it will lead to immediate execution interruption. Perhaps the execution of await ... new_and_wait() should be reconsidered.

Backend logs:

call failed python_chat_bot rpc error: code = DeadlineExceeded desc = context deadline exceeded

Chatbot logs (gRPC connection interrupted, task dies in the middle):

<Task pending name='HandleExceptions[/pbx.Plugin/]' coro=<_handle_exceptions() running at src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi:686> wait_for=<Future pending cb=[Protocol._on_waiter_completed(), Task.task_wakeup()] created at /usr/local/lib/python3.10/site-packages/asyncpg/connection.py:433> cb=[_add_callback_handler.<locals>.handle_callbacks()] created at /usr/local/lib/python3.10/asyncio/runners.py:44> took 0.103 seconds

This is not a bug, but I think it's worth mentioning (in comments).

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmodule:plugin_serverAny questions or suggestions about karuha.plugin_server module

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions