Cypress内存溢出奔溃问题汇总

发布于:2024-11-29 ⋅ 阅读:(31) ⋅ 点赞:(0)

内存溢出报错信息

<--- Last few GCs ---> [196:0xe58001bc000] 683925 ms: Scavenge 1870.7 (1969.9) -> 1865.6 (1969.9) MB, 6.07 / 0.00 ms (average mu = 0.359, current mu = 0.444) task; [196:0xe58001bc000] 683999 ms: Scavenge 1872.4 (1969.9) -> 1867.1 (1969.9) MB, 5.86 / 0.00 ms (average mu = 0.359, current mu = 0.444) task; [196:0xe58001bc000] 684076 ms: Scavenge 1873.9 (1969.9) -> 1868.8 (1969.9) MB, 5.43 / 0.00 ms (average mu = 0.359, current mu = 0.444) task; <--- JS stacktrace ---> FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory Error: The Test Runner unexpectedly exited via a exit event with signal SIGABRT Please search Cypress documentation for possible solutions: https://on.cypress.io Check if there is a GitHub issue describing this crash: https://github.com/cypress-io/cypress/issues Consider opening a new issue. ---------- Platform: linux-x64 (Debian - 12.7) Cypress Version: 13.15.2 at /node_modules/cypress/lib/errors.js:264:17 at processTicksAndRejections (node:internal/process/task_queues:95:5) { known: true }

Base文件命令

# --- Build/test ---
FROM cypress/browsers:node-22.11.0-chrome-131.0.6778.69-1-ff-132.0.2-edge-131.0.2903.51-1 as base

# Install necessary dependencies
RUN apt-get update
RUN apt-get -y install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb libu2f-udev libvulkan1
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt-get -y install fonts-liberation xdg-utils man-db
RUN dpkg -i google-chrome-stable_current_amd64.deb

docker base版本测试

cypress docker images测试
Tag Platform 测试结果
cypress/browsers:node18.12.0-chrome106-ff106

linux-x64 (Debian - 11.5)

Cypress 13.15.2

错误1 W: GPG error: https://dl.google.com/linux/chrome/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E88979FB9B30ACF2

错误2 内存泄漏,删除package-lock.json后,npm install命令依然失败,提示node版本需要>18.18或>20

cypress/browsers:node-18.20.3-chrome-125.0.6422.141-1-ff-126.0.1-edge-125.0.2535.85-1
linux-x64 (Debian - 12.5)
Cypress 13.15.2

错误1:内存泄漏

错误2:删除package-lock.json并重新安装依赖后,依然内存泄漏

cypress/browsers:node-20.15.1-chrome-126.0.6478.114-1-ff-127.0.1-edge-126.0.2592.61-1
cypress/browsers:node-20.18.0-chrome-129.0.6668.89-1-ff-131.0-edge-129.0.2792.65-1
cypress/browsers:node-22.11.0-chrome-130.0.6723.69-1-ff-132.0-edge-130.0.2849.56-1