AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

IngestionPipeline.Run(Num_workers>1) Hangs Indefinitely When NLTK Data Needs Download

Parallel ingestion deadlocks when NLTK punkt data is missing because _download_nltk_data() calls nltk.download() synchronously without timeout or stale lock cleanup; every spawned worker blocks on the same lock/network call.

highConfidence 85%Llama_indexllama-index-coreIndexingVectorStoreIndexAffected V0.14.24

Origin Analysis

GlobalsHelper._download_nltk_data() in llama_index/core/utils.py invokes nltk.download() synchronously with no timeout and no handling for stale NLTK lock files. When IngestionPipeline.run(num_workers>1) uses a spawn process pool, each worker re-enters this download path. A leftover <package>.zip.lock or an unreachable NLTK index causes workers to wait indefinitely, and the pool never completes.
1. Fresh install with no NLTK cache. 2. Run pipeline.run(documents, num_workers=2) with SentenceSplitter and no pre-downloaded punkt_tab. 3. Observe workers stuck in _download_nltk_data -> nltk.download; p.starmap never returns. Minimal repro: import faulthandler; from llama_index.core import Document; from llama_index.core.ingestion import IngestionPipeline; from llama_index.core.node_parser import SentenceSplitter; faulthandler.dump_traceback_later(60, exit=True); docs = [Document(text="Sample document {i}." * 20, doc_id=str(i)) for i in range(4)]; pipeline = IngestionPipeline(transformations=[SentenceSplitter(chunk_size=25, chunk_overlap=0)]); pipeline.run(documents=docs, num_workers=2); print("done")

Fixing Code Block

Edge Case Audit

The 30s timeout is hardcoded and may be too short for very slow networks; users with legitimate downloads >30s should adjust. Lock cleanup uses mtime and may delete a lock from a long-running concurrent download in custom environments. Rollback by reverting _download_nltk_data and removing the pre-warm block; alternatively set NLTK_DATA to a pre-populated directory.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state