location /upload
local lock = ngx.shared.lock:safe_add(path)
......
local test = io.open(path, "r")
if test ~= nil then
io.close(test)
ngx.shared.lock:delete(path)
return false
end
local w, err = io.open(path, "w")
if w == nil then
ngx.log(ngx.ERR, "cannot create target file: " .. err)
ngx.shared.lock:delete(path)
return false
end
w:write(data)
io.close(w)
ngx.shared.lock:delete(path)
......
location /delete
......
os.remove(path)
......
复现方法:
upload一个文件,delete这个文件,然后重新发送第一个请求,就有概率提示"no such file or directory"错误
emmm.....