minetest / serverlist

The global Minetest server list server
GNU Lesser General Public License v2.1
52 stars 28 forks source link

Locking is ineffective when using multiple workers #25

Open sfan5 opened 6 years ago

sfan5 commented 6 years ago

When running this under uwsgi with multiple processes (e.g. -p 2), you start seeing errors like this:

  File "./server.py", line 385, in save
    os.rename(list_path + "~", list_path)
FileNotFoundError: [Errno 2] No such file or directory: '/srv/serverlist/static/list.json~' -> '/srv/serverlist/static/list.json'

We do have a lock to prevent multiple threads from doing this, but not to prevent multiple workers from doing this.