Currently transferring a Python 3.12 program from local to a container environment, while it runs and completes its task locally it crashes on Docker in the early stages of the run.
/home/app/.../.venv/lib/python3.12/site-packages/nvidia_smi.py:810: SyntaxWarning: invalid escape sequence '\A'
mem = 'N\A'
/home/app/.../.venv/lib/python3.12/site-packages/nvidia_smi.py:831: SyntaxWarning: invalid escape sequence '\A'
maxMemoryUsage = 'N\A'
/home/app/.../run.py:2: MovedIn20Warning: The ``declarative_base()`` function is now available as sqlalchemy.orm.declarative_base(). (deprecated since: 2.0) (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
from ... import main
25.10.2-8-g51a92b3-dirty
[2025/11/26 12:38:36.285] | [ INFO] | Running scenario: ... | ID=796395118d801c8b2bd1c91730121205 SimulationTime=240.00[s]
[2025/11/26 12:38:37.312] | [ INFO] | child process calling self.run()
<Beginning of Stacktrace>
Exception ignored in: <cyfunction CTrackingLoopFB.__del__ at 0x73a4aa51d630>
Traceback (most recent call last):
File "... .py", line 19392, in ... .CTrackingLoopFB.__del__
AttributeError: 'CTrackingLoopFB' object has no attribute 'mFile'
Exception ignored in: <function SharedMemory.__del__ at 0x73a4f5490720>
Traceback (most recent call last):
File "/root/.local/share/uv/python/cpython-3.12.12-linux-x86_64-gnu/lib/python3.12/multiprocessing/shared_memory.py", line 187, in __del__
self.close()
File "/root/.local/share/uv/python/cpython-3.12.12-linux-x86_64-gnu/lib/python3.12/multiprocessing/shared_memory.py", line 230, in close
self._mmap.close()
BufferError: cannot close exported pointers exist
Exception ignored in: <function SharedMemory.__del__ at 0x73a4f5490720>
Traceback (most recent call last):
File "/root/.local/share/uv/python/cpython-3.12.12-linux-x86_64-gnu/lib/python3.12/multiprocessing/shared_memory.py", line 187, in __del__
self.close()
File "/root/.local/share/uv/python/cpython-3.12.12-linux-x86_64-gnu/lib/python3.12/multiprocessing/shared_memory.py", line 230, in close
self._mmap.close()
BufferError: cannot close exported pointers exist
I have checked /dev/shm on the local machine and the expected usage is ~4Gb while on containers it consistently only uses 60Mb before it crashes/stops while still having more space available.
I am running the container with docker run --gpus all --runtime=nvidia --shm-size=10Gb <image> uv run.py <args>.
FROM nvidia/cuda:13.0.2-cudnn-devel-ubuntu24.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
sudo \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
### Fetch uv from image repository
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
WORKDIR /home/app/aplication
COPY . .
RUN uv venv --python 3.12
ENV VIRTUAL_ENV=/home/app/xrc_core/.venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN uv pip install -r python312_packages.txt
C extensions packages are used such as cython, greenlet, fastrlock.
Unfortunately, I can't provide the source code, but it is running pre-compiled in the container.
CTrackingLoopFByour code? Are any particular C extensions involved?CTrackingLoopFBis part of the written code, yes. But it'll be difficult to provide an example. There are a bunch of C extensions involved, which I'll add the most relevant in the main post.