vllm: [Bug]: Disk I/O Error when using tools due to shared outlines cache database

Your current environment

Collecting environment information...
PyTorch version: 2.1.2+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.3 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.29.0
Libc version: glibc-2.35

Python version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-6.1.79-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: 
GPU 0: NVIDIA A10G
GPU 1: NVIDIA A10G
GPU 2: NVIDIA A10G
GPU 3: NVIDIA A10G

Nvidia driver version: 535.161.07
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Address sizes:                      48 bits physical, 48 bits virtual
Byte Order:                         Little Endian
CPU(s):                             96
On-line CPU(s) list:                0-95
Vendor ID:                          AuthenticAMD
Model name:                         AMD EPYC 7R32
CPU family:                         23
Model:                              49
Thread(s) per core:                 2
Core(s) per socket:                 48
Socket(s):                          1
Stepping:                           0
BogoMIPS:                           5599.99
Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch topoext perfctr_core ssbd ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 clzero xsaveerptr rdpru wbnoinvd arat npt nrip_save rdpid
Hypervisor vendor:                  KVM
Virtualization type:                full
L1d cache:                          1.5 MiB (48 instances)
L1i cache:                          1.5 MiB (48 instances)
L2 cache:                           24 MiB (48 instances)
L3 cache:                           192 MiB (12 instances)
NUMA node(s):                       1
NUMA node0 CPU(s):                  0-95
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit:        Not affected
Vulnerability L1tf:                 Not affected
Vulnerability Mds:                  Not affected
Vulnerability Meltdown:             Not affected
Vulnerability Mmio stale data:      Not affected
Vulnerability Retbleed:             Mitigation; untrained return thunk; SMT enabled with STIBP protection
Vulnerability Spec rstack overflow: Mitigation; safe RET
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; Retpolines, IBPB conditional, STIBP always-on, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Not affected

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] torch==2.1.2
[pip3] triton==2.1.0
[conda] Could not collectROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.4.0.post1
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0    GPU1    GPU2    GPU3    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      PHB     PHB     PHB     0-95    0               N/A
GPU1    PHB      X      PHB     PHB     0-95    0               N/A
GPU2    PHB     PHB      X      PHB     0-95    0               N/A
GPU3    PHB     PHB     PHB      X      0-95    0               N/A

Legend:

  X    = Self
  SYS  = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
  NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
  PHB  = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
  PXB  = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
  PIX  = Connection traversing at most a single PCIe bridge
  NV#  = Connection traversing a bonded set of # NVLinks

šŸ› Describe the bug

This was discovered when using the Llama 3 Instruct model with the workaround in #4180 on multiple nodes using a shared filed system for the cache directory.

Requests to the vLLM with tool_calls using the OpenAI compatible tool call API utilize the outlines library. When the filesystem is shared between nodes, e.g.: using AWS Elastic File System, the outlines library opens a SQLite database in the shared cache dir.

This causes I/O errors on at least one node due to each node conflicting on writing to the same SQLite database.

To mitigate this, vLLM could utilize a cache dir in /tmp for Outlines, configured on startup of vLLM:

https://github.com/outlines-dev/outlines/blob/main/outlines/caching.py#L14-L29

Workaround: set the env var OUTLINES_CACHE_DIR to a value such as /tmp/.outlines.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 10
  • Comments: 25 (6 by maintainers)

Most upvoted comments

For those running into issues working with Slurm, I found that setting the environment variable OUTLINES_CACHE_DIR to the job directory fixed the problem. I’m not using guided decoding though so not sure if this would affect that.

I installed and tested again; however, I did want to mention that we’re using Lustre for the file system, rather than NFS. It’s possible that others using Slurm are as well.

Successfully installed outlines-0.0.4.dev562+g9a924b0
Singularity> vllm serve
Traceback (most recent call last):
  File "/usr/local/bin/vllm", line 5, in <module>
    from vllm.scripts import main
  File "/usr/local/lib/python3.10/dist-packages/vllm/__init__.py", line 6, in <module>
    from vllm.entrypoints.llm import LLM
  File "/usr/local/lib/python3.10/dist-packages/vllm/entrypoints/llm.py", line 13, in <module>
    from vllm.model_executor.guided_decoding import (
  File "/usr/local/lib/python3.10/dist-packages/vllm/model_executor/guided_decoding/__init__.py", line 8, in <module>
    from vllm.model_executor.guided_decoding.outlines_decoding import (
  File "/usr/local/lib/python3.10/dist-packages/vllm/model_executor/guided_decoding/outlines_decoding.py", line 15, in <module>
    from vllm.model_executor.guided_decoding.outlines_logits_processors import (
  File "/usr/local/lib/python3.10/dist-packages/vllm/model_executor/guided_decoding/outlines_logits_processors.py", line 25, in <module>
    from outlines import grammars
  File "/home/killgore/.local/lib/python3.10/site-packages/outlines/__init__.py", line 2, in <module>
    import outlines.generate
  File "/home/killgore/.local/lib/python3.10/site-packages/outlines/generate/__init__.py", line 3, in <module>
    from .choice import choice
  File "/home/killgore/.local/lib/python3.10/site-packages/outlines/generate/choice.py", line 8, in <module>
    from .regex import regex
  File "/home/killgore/.local/lib/python3.10/site-packages/outlines/generate/regex.py", line 3, in <module>
    from outlines.fsm.guide import RegexGuide
  File "/home/killgore/.local/lib/python3.10/site-packages/outlines/fsm/guide.py", line 120, in <module>
    def create_states_mapping(
  File "/home/killgore/.local/lib/python3.10/site-packages/outlines/caching.py", line 110, in decorator
    memory = get_cache()
  File "/home/killgore/.local/lib/python3.10/site-packages/outlines/caching.py", line 80, in get_cache
    if outlines_version != memory.get("__version__"):
  File "/usr/local/lib/python3.10/dist-packages/diskcache/core.py", line 1165, in get
    rows = self._sql(select, (db_key, raw, time.time())).fetchall()
sqlite3.DatabaseError: database disk image is malformed

partially fixed by https://github.com/vllm-project/vllm/pull/7831

closing and wait for outlines to come up with the final solution.

I still encounter this error with vllm 0.6.3.post1 on slurm multi-node env. setting --guided-decoding-backend=lm-format-enforcer works for me.

@testzer0 I used the environment variable, but I’m not sure whether you can do the same for the Ray processes. Maybe you can try to set the environment variable by using the code line os.environ["OUTLINES_CACHE_DIR"]={something} in the function you’re using for spawning processes. Still, I’m not sure that this works fine because I don’t know exactly when this variable is used or called.

@lapp0 I have been doing some more testing, and now I’m getting a ā€œRead-only file systemā€ error.

I’m thinking this may have to do with the way that Singularity/Apptainer is mounting directories and is treating its file system. I think that if I build the container with a sandbox/writeable folder for the cache, it could fix it. It’s probably going to be tomorrow before I am able to do that and test, but I’ll report back and let you know.