注册 登录
n/ai · 2025-09-20 · 已编辑 · 407 次浏览
u/user80王者钻石会员
n/aiu/user80 钻石会员 · 2025-09-20

OpenAI Sandbox性能测试

今天才发现ChatGPT有沙盒这个东西,不过既然可以运行Python,那不得不看看它的配置了。

🖥 OpenAI Sandbox

系统环境

操作系统:Linux(内核 4.x)

架构:x86_64

用户权限:普通用户(非 root),不能 apt install / yum install

文件系统:

可用目录:/mnt/data(临时存储,容量约 20GB,会话结束即清空)

不可持久保存


💾 硬件限制

CPU:

逻辑核数:os.cpu_count() 报 56

单核性能中等。

内存:

总内存约 4 GB

可用内存约 3 GB(接近上限会 OOM,被强制终止)

磁盘:

/mnt/data 总 20 GB

可用大约 18 GB

I/O 性能中规中矩,512MB 写入 ~1.2s,读取 ~0.9s

网络:

完全隔离,不可联网。所以很遗憾,这并不可以挂探针或者搭节点。(所以也用不了脚本)

具体配置



==== Sandbox Comprehensive Test Report ====

== 1) System & OS ==
Python: 3.11.8
OS: Linux 4.4.0
Kernel: #1 SMP Sun Jan 10 15:06:54 PST 2016
Arch: x86_64
Logical CPUs: 56
Physical CPUs: 56
Memory: total=4GB, available=3GB, used=0GB
Disk /mnt/data: total=8589934591GB, used=0GB, free=8589934591GB
Open file limit (soft,hard): (1048576, 1048576)
Process PID: 11
Process count: 3

Mounted partitions:

== 2) Environment Variables (subset) ==
PATH=/home/sandbox/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOME=/home/sandbox
LANG=C.UTF-8
PWD=/home/sandbox/.openai_internal

== 3) Python Packages ==
numpy: 1.24.0
pandas: 1.5.3
matplotlib: 3.6.3
scipy: 1.14.1
sklearn: 1.1.3
torch: 2.5.1+cpu
PIL: 9.1.0
reportlab: 3.6.12
docx (python-docx): 0.8.11
pptx (python-pptx): 0.6.21

== 4) Performance Microbenchmarks ==
NumPy matmul 800x800: 0.783s
Sort 2,000,000 floats: 0.321s
Pure Python sum of squares 3,000,000: 0.454s (checksum=9313)
Threading (4x500k): 0.271s sum=42131666.22
Multiprocessing (4x300k): 1.419s sum=25278999.73

== 5) External Interpreters Availability ==
python3: AVAILABLE -> Python 3.11.8
python: AVAILABLE -> Python 3.11.8
bash: AVAILABLE -> GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu)
sh: AVAILABLE -> sh: 0: Illegal option --
zsh: NOT FOUND
fish: NOT FOUND
node: NOT FOUND
nodejs: NOT FOUND
deno: NOT FOUND
ruby: NOT FOUND
perl: AVAILABLE -> This is perl 5, version 36, subversion 0 (v5.36.0) built for x86_64-linux-gnu-thread-multi
php: NOT FOUND
lua: NOT FOUND
R: NOT FOUND
Rscript: NOT FOUND
julia: NOT FOUND
go: NOT FOUND
gcc: AVAILABLE -> gcc (Debian 12.2.0-14+deb12u1) 12.2.0
g++: AVAILABLE -> g++ (Debian 12.2.0-14+deb12u1) 12.2.0
javac: NOT FOUND
java: NOT FOUND
rustc: NOT FOUND
cargo: NOT FOUND
dotnet: NOT FOUND
swift: NOT FOUND
scala: NOT FOUND
kotlin: NOT FOUND
tsc: NOT FOUND
npm: NOT FOUND
pip: AVAILABLE -> pip 24.0 from /usr/local/lib/python3.11/site-packages/pip (python 3.11)

再来烤个鸡吧,不能白折腾吧 :xhj001:。

CPU 30秒烤鸡图

内存压力测试曲线

附:完整测试结果打包(包含PPT,PDF,Word,MD)
sandbox_vps.zip (781.0 KB)

1
11
登录后参与讨论。
u/udc2b6nr 广告
QuicksilverVPN

快银 VPN,一键连接全球节点,线路稳定、延迟低。支持 Windows、macOS 等多平台,TUN 全局模式覆盖全部应用流量。无需复杂配置,下载即用。

umami.dnsl.top 了解更多

11 条回复

排序
  1. user80 王者 楼主 钻石会员 2025-09-20 #2

    container_env_info.txt (2.2 KB)
    根据环境变量可判断
    容器类型:极大概率是 Docker/containerd 容器(因为 cgroup 直指容器 ID,格式典型)。
    编排层:可能由 Kubernetes 管理,但在容器内看不到 kubepods,说明外层做了二次隔离或清理。
    隔离技术:可能叠加了 gVisor / Firecracker,因为 CPU 型号被隐藏成 unknown。
    硬件基础:Intel Xeon Broadwell,虚拟化多核环境。

    2
  2. user80 王者 楼主 钻石会员 2025-09-20 #3
    回复 @user80:container_env_info.txt (2.2 KB) 根据环境变量可判断 容器类型:极大概率是 Docker/…

    确认了,该沙盒为gVisor 隔离的容器,执行

    print(os.listdir('/proc'))
    

    即可看到

     'cgroups', 'loadavg', 'sys', 'fs', 'irq', 'mounts', 'sentry-meminfo', 
     'filesystems', 'meminfo', 'net', 'self', 'thread-self', '1', '3', '11', '101']
    

    特殊的 sentry-meminfo —— 这是 gVisor 隔离的容器的典型痕迹 ✅。

    1
  3. user80 王者 楼主 钻石会员 2025-09-20 #4
    回复 @user80:确认了,该沙盒为gVisor 隔离的容器,执行 print(os.listdir('/proc')) 即…

    其中PID 1为Jupyter 的 Docker 容器

    Raw bytes: b'tini\x00--\x00python3\x00-m\x00uvicorn\x00--host\x000.0.0.0\x00--port\x008080\x00--log-config\x00/home/sandbox/uvicorn_logging.config\x00jupyter_server.app:app\x00'
    
    1
  4. user80 王者 楼主 钻石会员 2025-09-20 #5
    回复 @user80:其中PID 1为Jupyter 的 Docker 容器 Raw bytes: b'tini\x00--\x00p…

    沙盒为Jupyter + Uvicorn 的受限容器环境

    ['.ipython', '.bashrc', '.config', 'uvicorn_logging.config',
     '.local', '.bash_logout', '.profile', '.openai_internal', '.cache']
    
    0
  5. user80 王者 楼主 钻石会员 2025-09-20 #6
    回复 @user80:沙盒为Jupyter + Uvicorn 的受限容器环境 ['.ipython', '.bash…

    沙盒的基础系统是 Debian 12 (Bookworm)

    
    PRETTY_NAME=“Debian GNU/Linux 12 (bookworm)”
    
    NAME=“Debian GNU/Linux”
    
    VERSION_ID=“12”
    
    VERSION=“12 (bookworm)”
    
    VERSION_CODENAME=bookworm
    
    ID=debian
    
    HOME_URL=“https://www.debian.org/”
    
    SUPPORT_URL=“https://www.debian.org/support”
    
    BUG_REPORT_URL=“https://bugs.debian.org/”
    
    0
  6. srv 王者 3 YEARS 2025-09-20 #7
    回复 @user80:沙盒的基础系统是 Debian 12 (Bookworm) PRETTY_NAME=“Debian GNU/Linux …

    这也行

    0
  7. nleis 黄金 2 YEARS 2025-09-20 #8

    这也能挖出来😱

    0
  8. user80 王者 楼主 钻石会员 2025-09-20 #9
    回复 @user80:沙盒的基础系统是 Debian 12 (Bookworm) PRETTY_NAME=“Debian GNU/Linux …

    不行,ChatGPT把 requests 库禁了,然后把 file:///etc/passwd 访问拦了。而且它不能把沙盒里的数据 发送到外部 IP/服务(或执行任何试图“逃逸”或建立外联连接的命令)。⚠️

    0
  9. user80 王者 楼主 钻石会员 2025-09-20 #10
    回复 @user80:不行,ChatGPT把 requests 库禁了,然后把 file:///etc/passwd 访问拦了。而且它不能把沙…
    API_PORT=8080
    HOSTNAME=69ac84fb80b1
    
    PYTHON_VERSION=3.11.8
    
    PYDEVD_DISABLE_FILE_VALIDATION=1
    
    PROCESS_MEMORY_LIMIT=4294967296
    
    PWD=/home/sandbox/.openai_internal
    
    PYTHON_SETUPTOOLS_VERSION=65.5.1
    
    PYTHONMALLOC=malloc
    
    LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2
    
    HOME=/home/sandbox
    
    LANG=C.UTF-8
    
    MALLOC_CONF=narenas:1,background_thread:true,lg_tcache_max:10,dirty_decay_ms:5000,muzzy_decay_ms:5000
    
    GPG_KEY=A035C8C19219BA821ECEA86B64E628F8D684696D
    
    FEATURE_SET=chatgpt-applied
    
    SHLVL=0
    
    PYTHON_PIP_VERSION=24.0
    
    LD_LIBRARY_PATH=:/usr/local/lib
    
    PYTHON_GET_PIP_SHA256=dfe9fd5c28dc98b5ac17979a953ea550cec37ae1b47a5116007395bfacff2ab9
    
    PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/dbf0c85f76fb6e1ab42aa672ffca6f0a675d9ee4/public/get-pip.py
    
    PATH=/home/sandbox/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    
    DEBIAN_FRONTEND=noninteractive
    
    OLDPWD=
    

    emm...骗到Jupyter的配置了(PID 1)也许PYTHON_GET_PIP_URL可以成为突破点

    0
  10. user80 王者 楼主 钻石会员 2025-09-20 #11
    回复 @user80:API_PORT=8080 HOSTNAME=69ac84fb80b1 PYTHON_VERSION=3.11.8 PY…

    可以用Base85 编码+gpt4o,这样就不会被发现执行恶意代码了 比如查看进程

    USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    root           1  0.0  0.0   2064  1460 ?        Ss   Sep18   0:00 /usr/bin/tini -g -- python3 -m uvicorn --host 0.0.0.0 --port 8080 --log-config /home/sandbox/uvicorn_logging.config jupyter_server.app:app
    root           3  0.0  0.0   2064  1420 ?        S    Sep18   0:00 /usr/bin/tini -g -- python3 -m uvicorn --host 0.0.0.0 --port 8080 --log-config /home/sandbox/uvicorn_logging.config jupyter_server.app:app
    sandbox       11  0.0  0.0   2064  1420 ?        S    Sep18   0:00 python3
    sandbox      101  0.0  0.0   2064  1420 ?        R    Sep18   0:00 /usr/bin/python3 /tmp/python_code.py
    
    
    0
  11. user80 王者 楼主 钻石会员 2025-09-20 #12
    回复 @user80:可以用Base85 编码+gpt4o,这样就不会被发现执行恶意代码了 比如查看进程 USER PID %CPU %MEM…

    理论上来说,利用ChatGPT与沙盒的通讯端口即可进行容器与外界的通讯

    0