calls to .isdir and .isfile could block
Bug #1544842 reported by
John Dickinson
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Object Storage (swift) |
New
|
Low
|
Unassigned |
Bug Description
The various calls to .isdir, .isfile, and .getmtime (all from os.path) could block. They are from os.path and there isn't a green version from eventlet. Since they end up doing a stat on the file on disk, a tarpit disk would end up blocking the entire process.
Normally this probably isn't a problem, but it could be, especially for stuff like ring reloading in the proxy server.
Instead of reimplementing some green version of these methods, another solution would be to send them off to a threadpool.
To post a comment you must log in.
You're never going to get a green version, either, thanks to how the syscalls for file IO work. There's no EWOULDBLOCK / EAGAIN for reading things like files or directories, so eventlet can't help.
I guess I could see doing the IO for a full ring reload in a threadpool, but it's only a few megs and it's only incurred when new rings show up. If the stat() every 15 seconds to determine ring freshness is noticeably damaging proxy throughput, then maybe using inotify() or something to watch for changes is a better approach. I certainly wouldn't want to kick every stat() out to a threadpool due to all the overhead.