Score:-1

nGinx keeps shutting down

pm flag

The nginx process keeps shutting itself off, here are the errors

2023/04/18 11:47:29 [alert] 11073#0: worker process 11312 exited on signal 9
2023/04/18 11:47:29 [alert] 11073#0: fork() failed while spawning "worker process" (12: Cannot allocate memory)
2023/04/18 11:47:29 [alert] 11073#0: could not respawn worker process

I know it has enough ram, it's a VPS I control and I've jacked its ram up to 4GB and still same thing. It's a very lightweight nginx server, no PHP, simple image serving. Running nginx 1.0.15, I know it's old, but it worked for many years no issues. Nothing's changed on this VPS in years.

awado avatar
us flag
Too much gin, too less tonic? :-D What is the count of the worker process? Maybe it's a RAM hardware issue?
Paul avatar
cn flag
Perhaps providing more information, such as `nginx.conf`, would help in getting a useful answer. Also consider explaining why you cannot upgrade to a more recent version of nginx, especially considering that they have been very good at supporting older `nginx.conf` syntax.
Score:0
ve flag

Add swap. Also, make sure the're isn't any credentials/privileges problem.

Also, reffering to this question where some app was limited with the RAM it could use. What does these workers do? This might be your answer.

Also, have you tried to update everything?

Score:0
jo flag

fork() failed while spawning "worker process" (12: Cannot allocate memory) Is the clue.

If you look at man 2 fork you can find out what conditions lead to that position.

ENOMEM fork() failed to allocate the necessary kernel structures because memory is tight.

ENOMEM An attempt was made to create a child process in a PID namespace whose "init" process has terminated. See pid_namespaces(7).

Its should be one of these two conditions. Does the entire VPS around the same time get restarted? If so there is your answer.

You can potentially test this if you cant tell by doing ps -o lstart 1 in the container and checking when the init process was started.

Else, if you still get this when it says 'memory is tight' it might be because overall system memory is tight. Thats not something you may be privvy to in your container, so you'd need to request more information from the hosting provider.

jfreak53 avatar
pm flag
As my initial post stated, I have upped the VPS ram to 4GB and tried again, still same issue. So it's not available ram. The host name I control, host node has over 48GB of free ram still available unallocated. And checking uptime after this happens, no, the VPS has not rebooted in about 3 months time.
Score:0
us flag

Based on the error message you provided, it seems that the worker process is exiting due to a signal 9, which indicates a SIGKILL signal. Additionally, the error message suggests that the fork() system call is failing, which means that the process is unable to create a new child process.

The error message "Cannot allocate memory" suggests that the system may be running out of memory, which could be causing the fork() system call to fail. One possible solution to this issue is to increase the amount of memory available to the system.

You can try to check the available memory on your server using the "free -tm" command, which will display information about the available memory and swap space. If the system is running low on memory, you may need to add more memory to your server or adjust your nginx configuration to use less memory.

Another possible solution is to reduce the number of worker processes in your nginx configuration. You can do this by adjusting the "worker_processes" setting in your nginx.conf file. By reducing the number of worker processes, you can decrease the memory usage of your nginx server.

jfreak53 avatar
pm flag
As my initial post stated, I have upped the VPS ram to 4GB and tried again, still same issue. So it's not available ram. The host name I control, host node has over 48GB of free ram still available unallocated. And checking uptime after this happens, no, the VPS has not rebooted in about 3 months time.
jfreak53 avatar
pm flag
Worker processes was set to 1 already
Zareh Kasparian avatar
us flag
@jfreak53 please share your nginx config file.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.