A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://uwsgi-docs.readthedocs.io/en/latest/MasterFIFO.html below:

The Master FIFO — uWSGI 2.0 documentation

The Master FIFO

Available from uWSGI 1.9.17.

Generally you use UNIX signals to manage the master, but we are running out of signal numbers and (more importantly) not needing to mess with PIDs greatly simplifies the implementation of external management scripts.

So, instead of signals, you can tell the master to create a UNIX named pipe (FIFO) that you may use to issue commands to the master.

To create a FIFO just add --master-fifo <filename> then start issuing commands to it.

You can send multiple commands in one shot.

# add 3 workers and print stats
echo +++s > /tmp/yourfifo
Available commands FIFO slots

uWSGI supports up to 10 different FIFO files. By default the first specified is bound (mapped as ‘0’).

During the instance’s lifetime you can change from one FIFO to another by simply sending the number of the FIFO slot to use.

[uwsgi]
master-fifo = /tmp/fifo0
master-fifo = /tmp/fifo1
master-fifo = /var/run/foofifo
processes = 2
...

By default /tmp/fifo0 will be allocated, but after sending:

the /tmp/fifo1 file will be bound.

This is very useful to map FIFO files to specific instance when you (ab)use the ‘fork the master’ command (the ‘f’ one).

After sending this command, a new uWSGI instance (inheriting all of the bound sockets) will be spawned, the old one will be put in “paused” mode (the ‘p’ command).

As we have sent the ‘1’ command before ‘f’ and ‘p’ the old instance will now accept commands on /tmp/fifo1 (the slot 1), and the new one will use the default one (‘0’).

There are lot of tricks you can accomplish, and lots of ways to abuse the forking of the master.

Just take into account that corner-case problems can occur all over the place, especially if you use the most complex features of uWSGI.

Notes

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4