diff --git a/database/Seeders/eggs/minecraft/egg-bungeecord.json b/database/Seeders/eggs/minecraft/egg-bungeecord.json index 9a538a8e1..ac3749c8c 100644 --- a/database/Seeders/eggs/minecraft/egg-bungeecord.json +++ b/database/Seeders/eggs/minecraft/egg-bungeecord.json @@ -10,7 +10,8 @@ "description": "For a long time, Minecraft server owners have had a dream that encompasses a free, easy, and reliable way to connect multiple Minecraft servers together. BungeeCord is the answer to said dream. Whether you are a small server wishing to string multiple game-modes together, or the owner of the ShotBow Network, BungeeCord is the ideal solution for you. With the help of BungeeCord, you will be able to unlock your community's full potential.", "features": [ "eula", - "java_version" + "java_version", + "pid_limit" ], "images": [ "ghcr.io\/pterodactyl\/yolks:java_8", diff --git a/database/Seeders/eggs/minecraft/egg-forge-minecraft.json b/database/Seeders/eggs/minecraft/egg-forge-minecraft.json index 7f889f1a9..a077df6d1 100644 --- a/database/Seeders/eggs/minecraft/egg-forge-minecraft.json +++ b/database/Seeders/eggs/minecraft/egg-forge-minecraft.json @@ -10,7 +10,8 @@ "description": "Minecraft Forge Server. Minecraft Forge is a modding API (Application Programming Interface), which makes it easier to create mods, and also make sure mods are compatible with each other.", "features": [ "eula", - "java_version" + "java_version", + "pid_limit" ], "images": [ "ghcr.io\/pterodactyl\/yolks:java_17", diff --git a/database/Seeders/eggs/minecraft/egg-paper.json b/database/Seeders/eggs/minecraft/egg-paper.json index 284ee97fb..afd3715d8 100644 --- a/database/Seeders/eggs/minecraft/egg-paper.json +++ b/database/Seeders/eggs/minecraft/egg-paper.json @@ -10,7 +10,8 @@ "description": "High performance Spigot fork that aims to fix gameplay and mechanics inconsistencies.", "features": [ "eula", - "java_version" + "java_version", + "pid_limit" ], "images": [ "ghcr.io\/pterodactyl\/yolks:java_8", diff --git a/database/Seeders/eggs/minecraft/egg-sponge--sponge-vanilla.json b/database/Seeders/eggs/minecraft/egg-sponge--sponge-vanilla.json index 9c502f747..908c1f4e5 100644 --- a/database/Seeders/eggs/minecraft/egg-sponge--sponge-vanilla.json +++ b/database/Seeders/eggs/minecraft/egg-sponge--sponge-vanilla.json @@ -10,7 +10,8 @@ "description": "SpongeVanilla is the SpongeAPI implementation for Vanilla Minecraft.", "features": [ "eula", - "java_version" + "java_version", + "pid_limit" ], "images": [ "ghcr.io\/pterodactyl\/yolks:java_8", diff --git a/database/Seeders/eggs/minecraft/egg-vanilla-minecraft.json b/database/Seeders/eggs/minecraft/egg-vanilla-minecraft.json index 9106d1a72..2361a2974 100644 --- a/database/Seeders/eggs/minecraft/egg-vanilla-minecraft.json +++ b/database/Seeders/eggs/minecraft/egg-vanilla-minecraft.json @@ -10,7 +10,8 @@ "description": "Minecraft is a game about placing blocks and going on adventures. Explore randomly generated worlds and build amazing things from the simplest of homes to the grandest of castles. Play in Creative Mode with unlimited resources or mine deep in Survival Mode, crafting weapons and armor to fend off dangerous mobs. Do all this alone or with friends.", "features": [ "eula", - "java_version" + "java_version", + "pid_limit" ], "images": [ "ghcr.io\/pterodactyl\/yolks:java_8", diff --git a/resources/scripts/components/server/ServerConsole.tsx b/resources/scripts/components/server/ServerConsole.tsx index 73b06676e..276a64a38 100644 --- a/resources/scripts/components/server/ServerConsole.tsx +++ b/resources/scripts/components/server/ServerConsole.tsx @@ -7,7 +7,7 @@ import ServerContentBlock from '@/components/elements/ServerContentBlock'; import ServerDetailsBlock from '@/components/server/ServerDetailsBlock'; import isEqual from 'react-fast-compare'; import PowerControls from '@/components/server/PowerControls'; -import { EulaModalFeature, JavaVersionModalFeature, GSLTokenModalFeature } from '@feature/index'; +import { EulaModalFeature, JavaVersionModalFeature, GSLTokenModalFeature, PIDLimitModalFeature } from '@feature/index'; import ErrorBoundary from '@/components/elements/ErrorBoundary'; import Spinner from '@/components/elements/Spinner'; @@ -61,6 +61,7 @@ const ServerConsole = () => { {eggFeatures.includes('eula') && } {eggFeatures.includes('java_version') && } {eggFeatures.includes('gsl_token') && } + {eggFeatures.includes('pid_limit') && } diff --git a/resources/scripts/components/server/features/PIDLimitModalFeature.tsx b/resources/scripts/components/server/features/PIDLimitModalFeature.tsx new file mode 100644 index 000000000..821a31068 --- /dev/null +++ b/resources/scripts/components/server/features/PIDLimitModalFeature.tsx @@ -0,0 +1,86 @@ +import React, { useEffect, useState } from 'react'; +import { ServerContext } from '@/state/server'; +import Modal from '@/components/elements/Modal'; +import tw from 'twin.macro'; +import Button from '@/components/elements/Button'; +import FlashMessageRender from '@/components/FlashMessageRender'; +import useFlash from '@/plugins/useFlash'; +import { SocketEvent } from '@/components/server/events'; +import { useStoreState } from 'easy-peasy'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'; + +const PIDLimitModalFeature = () => { + const [ visible, setVisible ] = useState(false); + const [ loading ] = useState(false); + + const status = ServerContext.useStoreState(state => state.status.value); + const { clearFlashes } = useFlash(); + const { connected, instance } = ServerContext.useStoreState(state => state.socket); + const isAdmin = useStoreState(state => state.user.data!.rootAdmin); + + useEffect(() => { + if (!connected || !instance || status === 'running') return; + + const errors = [ + 'pthread_create failed', + 'Exception in thread "Craft Async Scheduler Management Thread"', + 'unable to create new native thread', + 'unable to create native thread', + ]; + + const listener = (line: string) => { + if (errors.some(p => line.toLowerCase().includes(p))) { + setVisible(true); + } + }; + + instance.addListener(SocketEvent.CONSOLE_OUTPUT, listener); + + return () => { + instance.removeListener(SocketEvent.CONSOLE_OUTPUT, listener); + }; + }, [ connected, instance, status ]); + + useEffect(() => { + clearFlashes('feature:pidLimit'); + }, []); + + return ( + setVisible(false)} closeOnBackground={false} showSpinnerOverlay={loading}> + + {isAdmin ? + <> +
+ +

Memory or process limit reached...

+
+

This server has reached the maximum process or memory limit.

+

Increasing container_pid_limit in the wings configuration, config.yml, might help resolve this issue.

+

Note: Wings must be restarted for the configuration file changes to take effect

+
+ +
+ + : + <> +
+ +

Possible resource limit reached...

+
+

This server is attempting to use more resources than allocated. Please contact the administrator and give them the error below.

+

pthread_create failed, Possibly out of memory or process/resource limits reached

+
+ +
+ + } +
+ ); +}; + +export default PIDLimitModalFeature; diff --git a/resources/scripts/components/server/features/index.ts b/resources/scripts/components/server/features/index.ts index c84d57183..087e329dc 100644 --- a/resources/scripts/components/server/features/index.ts +++ b/resources/scripts/components/server/features/index.ts @@ -9,5 +9,6 @@ import { lazy } from 'react'; const EulaModalFeature = lazy(() => import(/* webpackChunkName: "feature.eula" */'@feature/eula/EulaModalFeature')); const JavaVersionModalFeature = lazy(() => import(/* webpackChunkName: "feature.java_version" */'@feature/JavaVersionModalFeature')); const GSLTokenModalFeature = lazy(() => import(/* webpackChunkName: "feature.gsl_token" */'@feature/GSLTokenModalFeature')); +const PIDLimitModalFeature = lazy(() => import(/* webpackChunkName: "feature.pid_limit" */'@feature/PIDLimitModalFeature')); -export { EulaModalFeature, JavaVersionModalFeature, GSLTokenModalFeature }; +export { EulaModalFeature, JavaVersionModalFeature, GSLTokenModalFeature, PIDLimitModalFeature };