diff --git a/core/spooler.c b/core/spooler.c index 9e4b10ed64..9c485fc1b7 100755 --- a/core/spooler.c +++ b/core/spooler.c @@ -650,6 +650,12 @@ void spooler_manage_task(struct uwsgi_spooler *uspool, char *dir, char *task) { if (uwsgi_spooler_read_header(task, spool_fd, &uh)) return; + // access lstat second time after getting a lock + // first-time lstat could be dirty (for example between writes in master) + if (lstat(task, &sf_lstat)) { + return; + } + if (uwsgi_spooler_read_content(spool_fd, spool_buf, &body, &body_len, &uh, &sf_lstat)) { destroy_spool(dir, task); return;