luanti-org / luanti-org/serverlist

Multiple workers are not supported due to locking

Open
#25 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
58
Forks
29
PR merge metrics
No merged PRs in 30d

Description

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](https://uwsgi-docs.readthedocs.io/en/latest/Locks.html) from doing this.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in server.py around the save method and line 385, then read the linked uWSGI locking documentation alongside the existing thread lock. Reproduce the issue with multiple workers such as uWSGI -p 2; done means concurrent workers no longer produce the reported FileNotFoundError during saves.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.