import { 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', 'failed to create thread', 'unable to create thread', 'unable to create native thread', 'unable to create new native thread', 'exception in thread "craft async scheduler management 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;