我的 nextjs 应用程序在我的 cPanel 中导致大量进程,并且在一天内达到了超过 1000 次的限制。
这对于 nextjs 应用程序来说正常吗,因为它在服务器上呈现?这只是一个在线商店和一些 API,还有一个其他应用程序,即商店的管理仪表板。
这不是一个大型应用程序,但在我的 cPanel 仪表板中,进程数从 21 到 199。
这些是最后的日志。
4072046 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072047 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072053 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072057 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072062 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072067 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072074 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072080 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072093 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072096 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072103 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072110 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072119 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072130 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072138 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072145 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072153 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072160 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072168 0.0 469M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072176 0.0 74M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072187 0.0 70M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
4072196 0.0 70M Sl 04:59 00:00:00 \_ /opt/alt/alt-nodejs10/root/usr/bin/node /home/mohaetwk/nodevenv/shahre-game/client/10/lib/node_modules/jest-worker/build/workers/processChild.js
显然,
next build
无法杀死processChild
jest-worker子进程。
直到 Next.js 修复此问题:
terminate
目录中创建文件 ~/bin
(确保将其添加到您的 PATH
):#!/bin/bash
sudo kill -9 $(ps aux | grep "$@" | awk '{print $2}')
chmod +x ~/bin/terminate
terminate processChild
添加到您的构建脚本/命令中:next build && terminate processChild
此解决方案可以帮助您: 在此输入链接描述