kantord / SeaGOAT

local-first semantic code search engine
https://kantord.github.io/SeaGOAT/
MIT License
999 stars 65 forks source link

There is no current event loop in thread #243

Open dneprovets opened 1 year ago

dneprovets commented 1 year ago

❯ seagoat-server start ~/Projects/middleware/control/pong-front-end 2023-09-23 11:21:57,045 Creating server... 2023-09-23 11:21:57,046 Starting worker thread... 2023-09-23 11:21:57,047 Serving on http://0.0.0.0:57187 Exception in thread Thread-1 (_worker_function): Traceback (most recent call last): File "/opt/homebrew/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1038, in _bootstrap_inner self.run() File "/opt/homebrew/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 975, in run self._target(*self._args, **self._kwargs) File "/opt/homebrew/lib/python3.11/site-packages/seagoat/queue/base_queue.py", line 72, in _worker_function context = self._get_context() ^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/seagoat/queue/task_queue.py", line 39, in _get_context from seagoat.engine import Engine File "/opt/homebrew/lib/python3.11/site-packages/seagoat/engine.py", line 40, in nest_asyncio.apply() File "/opt/homebrew/lib/python3.11/site-packages/nest_asyncio.py", line 18, in apply loop = loop or asyncio.get_event_loop() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/nest_asyncio.py", line 45, in _get_event_loop loop = events.get_event_loop_policy().get_event_loop() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/events.py", line 677, in get_event_loop raise RuntimeError('There is no current event loop in thread %r.' RuntimeError: There is no current event loop in thread 'Thread-1 (_worker_function)'. ^CServer started at http://localhost:57187 Server running.

kantord commented 1 year ago

could you please add some more info?

dneprovets commented 1 year ago

❯ sw_vers ProductName: macOS ProductVersion: 13.4 BuildVersion: 22F66

❯ system_profiler SPHardwareDataType | grep "Model Identifier" Model Identifier: Mac14,9 M2

❯ python3 --version

Python 3.11.5

❯ pip3 --version pip 23.2.1

Happens always with any projects that i tried

fatihmert commented 1 year ago

First install with pipx install seagoat, then try the sample directory my-app and the result is as #333

kantord commented 1 year ago

I added the help wanted label because I am not familiar with macs and I am not able to reproduce the issue. Help with a Mac OS developer would be highly appreciated

kqvanity commented 4 weeks ago

I'm getting somewhat similar issue

2024-10-29 07:40:54,246 Creating server...
2024-10-29 07:40:54,248 Starting worker thread...
2024-10-29 07:40:54,253 Serving on http://0.0.0.0:59393
2024-10-29 07:40:55,084 Checking repository for new changes
2024-10-29 07:40:55,231 Estimated ripgrep cache size: 0.18 megabytes (185532 bytes). Line count 4793
Analyzing source code: 0it [00:00, ?it/s]
2024-10-29 07:40:55,399 Analyzed the minimum number of chunks needed to operate.
2024-10-29 07:40:55,399 Analyzed all chunks!
2024-10-29 07:42:33,370 Handling task: query
Exception in thread Thread-1 (_worker_function):
Traceback (most recent call last):
  File "/usr/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.12/threading.py", line 1012, in run
    self._target(*self._args, **self._kwargs)
  File "/home/keinvanity/.local/share/pipx/venvs/seagoat/lib/python3.12/site-packages/seagoat/queue/base_queue.py", line 81, in _worker_function
    self._handle_task(context, task)
  File "/home/keinvanity/.local/share/pipx/venvs/seagoat/lib/python3.12/site-packages/seagoat/queue/base_queue.py", line 68, in _handle_task
    result = handler(context, *task.args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/keinvanity/.local/share/pipx/venvs/seagoat/lib/python3.12/site-packages/seagoat/queue/task_queue.py", line 103, in handle_query
    results = context["seagoat_engine"].query_sync(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/keinvanity/.local/share/pipx/venvs/seagoat/lib/python3.12/site-packages/seagoat/engine.py", line 169, in query_sync
    return loop.run_until_complete(self.query(*args, **kwargs))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/keinvanity/.local/share/pipx/venvs/seagoat/lib/python3.12/site-packages/nest_asyncio.py", line 98, in run_until_complete
    return f.result()
           ^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/futures.py", line 203, in result
    raise self._exception.with_traceback(self._exception_tb)
  File "/usr/lib/python3.12/asyncio/tasks.py", line 316, in __step_run_and_handle_result
    result = coro.throw(exc)
             ^^^^^^^^^^^^^^^
  File "/home/keinvanity/.local/share/pipx/venvs/seagoat/lib/python3.12/site-packages/seagoat/engine.py", line 153, in query
    results = await asyncio.gather(*async_tasks)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/tasks.py", line 385, in __wakeup
    future.result()
  File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/keinvanity/.local/share/pipx/venvs/seagoat/lib/python3.12/site-packages/seagoat/sources/ripgrep.py", line 157, in fetch
    return _fetch(query_text, str(path), limit, memory_cache)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/keinvanity/.local/share/pipx/venvs/seagoat/lib/python3.12/site-packages/seagoat/sources/ripgrep.py", line 148, in _fetch
    files[relative_path].add_line(line_number, MAXIMUM_VECTOR_DISTANCE * 0.8)
  File "/home/keinvanity/.local/share/pipx/venvs/seagoat/lib/python3.12/site-packages/seagoat/result.py", line 130, in add_line
    self.gitfile.lines[line],
    ~~~~~~~~~~~~~~~~~~^^^^^^
KeyError: 44

specs.

OS: Arch Linux x86_64
Host: HP ProDesk 600 G1 TWR
Kernel: 6.11.5-arch1-1
Resolution: 1680x1050
CPU: Intel i5-4590 (4) @ 3.700GHz
GPU: Intel HD Graphics
Memory: 14332MiB / 23924MiB

Installed using pipx