Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hanyuu streams files from disk that are unlocked. #22

Open
ameliaikeda opened this issue Dec 21, 2012 · 1 comment
Open

Hanyuu streams files from disk that are unlocked. #22

ameliaikeda opened this issue Dec 21, 2012 · 1 comment
Labels
Milestone

Comments

@ameliaikeda
Copy link
Contributor

Files can be edited while Hanyuu is reading from them, causing an Invalid File error.
This can be fixed in one of two ways:

  1. Locking files while streaming using fcntl.lockf(filename, fcntl.LOCK_EX)
  2. Locking files before reading files into RAM (such as a dictionary somewhere containing the open file object like deque(_tmp_files)), again using fcntl.lockf(filename, fcntl.LOCK_EX)
    Option 2 can be implemented without a lock, but it causes a race condition to appear if a file is written to just as/while hanyuu is reading
@Wessie
Copy link
Contributor

Wessie commented Jan 17, 2013

We should use option 2 most likely. A combination of lock, read into RAM, release lock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants