Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Bug]: func "get_by_id" crashes and leads to a failure quest #909

Open
2 tasks done
someone132s opened this issue Feb 21, 2025 · 3 comments
Open
2 tasks done

[Bug]: func "get_by_id" crashes and leads to a failure quest #909

someone132s opened this issue Feb 21, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@someone132s
Copy link

Do you need to file an issue?

  • I have searched the existing issues and this bug is not already filed.
  • I believe this is a legitimate bug, not just a question or feature request.

Describe the bug

a bug happens when I try to retrive something from the database

i'm pretty sure it's a bug because i implemented a fresh start.

accoring to the error and the source, it seems to be related to the commits these days, especially the code clean up.

Steps to reproduce

select tab "retrive" and type in anything and commit, then the bug happens immidiately

Expected Behavior

retival failed and the server continue to run.

LightRAG Config Used

Paste your config here

root@Debian12-Template:/opt/lightrag# cat docker-compose.yml
volumes:

PostgreSQL 数据卷

lightrag_postgres_data:

Qdrant 数据卷

lightrag_qdrant_data:

Neo4j 数据卷

lightrag_neo4j_data:

Neo4j 日志卷

lightrag_neo4j_logs:

Redis 数据卷 (保留, 先注释, 如需启用再取消注释)

lightrag_redis_data:

services:

###################################################################

专用 PostgreSQL: 用于 KV_STORAGE + DOC_STATUS_STORAGE

###################################################################
postgres:
image: shangor/postgres-for-rag:v1.0
container_name: lightrag-postgres
build:
args:
HTTP_PROXY: "http://10.248.155.2:7890"
HTTPS_PROXY: "http://10.248.155.2:7890"
env_file:
- .env
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DATABASE}
# 下面可选, 让PG数据放到 /var/lib/postgresql/data/pgdata
- PGDATA=/var/lib/postgresql/data/pgdata
command: sh -c "service postgresql start && sleep infinity"
ports:
- "5432:5432"
volumes:
- lightrag_postgres_data:/var/lib/postgresql/data
networks:
- lightrag_net
restart: unless-stopped

###################################################################

Redis: 暂时注释掉,不启用

###################################################################

redis:

image: redis:latest

container_name: lightrag-redis

env_file:

- .env

volumes:

- lightrag_redis_data:/data

networks:

- lightrag_net

command: ["redis-server", "--appendonly", "yes"]

restart: unless-stopped

###################################################################

Qdrant: 用于 VECTOR_STORAGE

###################################################################
qdrant:
image: qdrant/qdrant:latest
container_name: lightrag-qdrant
env_file:
- .env
ports:
- "6333:6333" # Qdrant Web UI
volumes:
- lightrag_qdrant_data:/qdrant/storage
networks:
- lightrag_net
restart: unless-stopped

###################################################################

Neo4j: 用于 GRAPH_STORAGE + Web UI

###################################################################
neo4j:
image: neo4j:latest
container_name: lightrag-neo4j

env_file:

- .env

ports:
  - "7474:7474"
  - "7687:7687"
environment:
  - NEO4J_AUTH=neo4j/neo4jpasswd
  - NEO4J_ACCEPT_LICENSE_AGREEMENT=yes
  - NEO4J_PLUGINS=["apoc"]
  - NEO4J_apoc_export_file_enabled=true
  - NEO4J_apoc_import_file_enabled=true

- NEO4J_dbms_logs_debug_level=DEBUG

  - NEO4J_server_logs_debug_enabled=true
  - NEO4J_server_logs_gc_enabled=true

- NEO4J_server_memory_heap_initial_size=4G

- NEO4J_server_memory_heap_max_size=16G

- NEO4J_server_memory_pagecache_size=8G

  - TZ=UTC
volumes:
  - lightrag_neo4j_data:/data
  - lightrag_neo4j_logs:/logs
networks:
  - lightrag_net
restart: unless-stopped

###################################################################

LightRAG 主服务

###################################################################
lightrag:
build:
context: .
dockerfile: Dockerfile
args:
HTTP_PROXY: "http://10.248.155.2:7890"
HTTPS_PROXY: "http://10.248.155.2:7890"
container_name: lightrag-server
env_file:
- .env
ports:
- "${PORT:-9621}:9621"
volumes:
- .env:/app/.env
- ./data/rag_storage:/app/data/rag_storage
- ./data/inputs:/app/data/inputs
environment:
- TZ=UTC
depends_on:
# - redis # 注释掉redis
- postgres # 需要 Postgres
- qdrant
- neo4j
networks:
- lightrag_net
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"

networks:
lightrag_net:
driver: bridge
root@Debian12-Template:/opt/lightrag# cat .env
#############################################################################

LightRAG Server Configuration

#############################################################################
HOST=0.0.0.0
PORT=9621
NAMESPACE_PREFIX=lightrag # 用于区分不同lightrag实例的数据命名空间

Logging

LOG_LEVEL=INFO
VERBOSE=True

#############################################################################

Timeouts / Others

#############################################################################
TIMEOUT=500 # 单次请求超时时长,可根据需要自行调整

#############################################################################

其他可选的LLM / Embedding 配置示例

#############################################################################

例如OpenAI风格API

LLM_BINDING=openai
LLM_MODEL=deepseek-r1-distill-qwen:32b
LLM_BINDING_HOST=http://10.248.155.223:3005/v1
LLM_BINDING_API_KEY=key

for OpenAI LLM (LLM_BINDING_API_KEY take priority)

OPENAI_API_KEY=key

EMBEDDING_BINDING=openai
EMBEDDING_MODEL=bge-m3
EMBEDDING_BINDING_HOST=http://10.248.155.223:3005/v1

RAG Configuration

MAX_ASYNC=16
EMBEDDING_DIM=1024
MAX_EMBED_TOKENS=8192

Settings relative to query

HISTORY_TURNS=100
COSINE_THRESHOLD=0.2
TOP_K=60
MAX_TOKEN_TEXT_CHUNK=4000
MAX_TOKEN_RELATION_DESC=4000
MAX_TOKEN_ENTITY_DESC=4000

Settings relative to indexing

CHUNK_SIZE=1200
CHUNK_OVERLAP_SIZE=100
MAX_TOKENS=32768
MAX_TOKEN_SUMMARY=500
SUMMARY_LANGUAGE=English

#############################################################################

Storage Selections

Postgres -> KV + DocStatus

Qdrant -> Vector

Neo4j -> Graph

#############################################################################
LIGHTRAG_KV_STORAGE=PGKVStorage
LIGHTRAG_VECTOR_STORAGE=QdrantVectorDBStorage
LIGHTRAG_GRAPH_STORAGE=Neo4JStorage
LIGHTRAG_DOC_STATUS_STORAGE=PGDocStatusStorage

#############################################################################

Redis Configuration

#############################################################################

格式 redis://host:port/dbindex

#REDIS_URI=redis://redis:6379/0

#############################################################################

PostgreSQL 配置

#############################################################################
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_USER=rag
POSTGRES_PASSWORD=rag
POSTGRES_DATABASE=rag

#############################################################################

Qdrant Configuration

#############################################################################

访问qdrant容器时的地址

QDRANT_URL=http://qdrant:6333

QDRANT_API_KEY=xxxx # 如果你启用了Qdrant的API Key认证,可以在这里填写

#############################################################################

Neo4j Configuration

#############################################################################
NEO4J_URI=bolt://neo4j:7687
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=neo4jpasswd # 注意与docker-compose.yml中对应

root@Debian12-Template:/opt/lightrag#

Logs and screenshots

DEBUG:get_best_cached_response: mode=local cache_type=query use_llm_check=False
[ERROR][2025-02-21 07:49:06] Traceback (most recent call last):
File "/app/lightrag/api/lightrag_server.py", line 1621, in query_text
response = await rag.aquery(
^^^^^^^^^^^^^^^^^
File "/app/lightrag/lightrag.py", line 962, in aquery
response = await kg_query(
^^^^^^^^^^^^^^^
File "/app/lightrag/operate.py", line 580, in kg_query
cached_response, quantized, min_val, max_val = await handle_cache(
^^^^^^^^^^^^^^^^^^^
File "/app/lightrag/utils.py", line 554, in handle_cache
best_cached_response = await get_best_cached_response(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/lightrag/utils.py", line 400, in get_best_cached_response
mode_cache = await hashing_kv.get_by_id(mode)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/lightrag/kg/postgres_impl.py", line 272, in get_by_id
sql = SQL_TEMPLATES["get_by_id_" + self.namespace]
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'get_by_id_lightragllm_response_cache'

INFO: 172.19.0.1:34658 - "POST /query HTTP/1.1" 500 Internal Server Error
INFO: 172.19.0.1:49778 - "GET /health HTTP/1.1" 200 OK

Additional Information

  • LightRAG Version: 1.1.12
  • Operating System: debian12.9
  • Python Version: 3.11-slim
  • Related Issues:
@someone132s someone132s added the bug Something isn't working label Feb 21, 2025
@someone132s
Copy link
Author

I have to say this bug even affect version 1.1.7

@fatehss
Copy link

fatehss commented Feb 21, 2025

I have also noticed that these code cleanup commits have introduced lots of breaking changes for my existing code...

@someone132s
Copy link
Author

I have also noticed that these code cleanup commits have introduced lots of breaking changes for my existing code...

There‘s no sense to upgrade at this moment

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants