Skip to content

RuntimeError: There is no current event loop in thread 'MainThread'. #6

Closed

Description

@lambdaofgod

When I run lmql run on your joke example, or using lml playground I get that RuntimeError.

BTW thanks for a great initiative.

Activity

  1. lambdaofgod commented on Apr 7, 2023

    @lambdaofgod
    Author

    Error details when running lml run with a file:

    Exception ignored in: <function AsyncOpenAIAPI.__del__ at 0x7faf6116aa70>
    Traceback (most recent call last):
      File "/home/kuba/Projects/forks/lmql/src/lmql/runtime/bopenai/batched_openai.py", line 553, in __del__
      File "/etc/conda/envs/lmql/lib/python3.10/asyncio/events.py", line 656, in get_event_loop
    RuntimeError: There is no current event loop in thread 'MainThread'.
    
    
  2. lbeurerkellner commented on Apr 7, 2023

    @lbeurerkellner
    Collaborator

    Thanks for reporting this. Does the query otherwise finish execution, or does it not execute at all?

  3. lambdaofgod commented on Apr 7, 2023

    @lambdaofgod
    Author

    Query finishes. In app the problem is that every next call does not work.

  4. lbeurerkellner commented on Apr 7, 2023

    @lbeurerkellner
    Collaborator

    I think I have observed this before on Linux systems specifically. This is very likely a asyncio clean-up issue. I will investigate this.

    When you say "next call", what exactly do you mean? Once the query finishes, lmql run should have terminated, right?

  5. lambdaofgod commented on Apr 7, 2023

    @lambdaofgod
    Author

    I mean in web app.

  6. lbeurerkellner commented on Apr 7, 2023

    @lbeurerkellner
    Collaborator

    Okay, thank. I will investigate further and report back here. If you run locally, the playground will actually re-run a new lmql process on each query. So it seems odd that it would block the next call.

  7. Paethon commented on Apr 12, 2023

    @Paethon

    Seeing the exact same problem here as well (running on Arch Linux)

  8. added a commit that references this issue on Apr 13, 2023
  9. lbeurerkellner commented on Apr 13, 2023

    @lbeurerkellner
    Collaborator

    I just released a bug fix release lmql==0.0.4.2, where this issue should be fixed. It would be really cool, if anyone who has experienced this bug, could briefly report back, if this is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions