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

ability to pick behavior of session overwriting, contention #64

Open
TYoung86 opened this issue Sep 4, 2017 · 0 comments
Open

ability to pick behavior of session overwriting, contention #64

TYoung86 opened this issue Sep 4, 2017 · 0 comments

Comments

@TYoung86
Copy link

TYoung86 commented Sep 4, 2017

(per PR #55)

While using an atomic write should resolve session corruption due to concurrent writes, there is still the issue of the picking the correct writer.

This can be avoided by allowing the first reader to issue a lock if it has an intent to modify, but this requires a significantly different behavior for the implementor of session-file-store.

I propose adding a write-conflict behavior option, a user provided selection function, and cancellation handling by fs events.

Write conflict behavior could default to last write wins (what currently happens), with other options available; last read wins, first read wins, first write wins, and/or user selection.

A user provided selection function could pick a winner or provide a custom merge result or defer an existing behavior dynamically.

Where the execution of the conflict resolution would occur will depend on the behavior, and in the case of user selection will need to decide when (and where) to execute.

This could be on successive reads under lock (preemption), first and/or successive writes under semaphore (cancellation), and successive writes upon modified time mismatch (in post).

Are there other execution scenarios?

The option to lock and silently block to avoid contention all together should probably also be implemented. Lock breaking (e.g. check if the owner is still alive, maybe a timeout) should also be implemented if the locking implementation depends on a lock file or other mutex that can lose it's owner (preferably should not, and use OS/FS level locking primitives).

While using a different session store provider such as sqlite may solve these issues, it should not be necessary, and is undesirable in certain situations.

Testing should be kept in mind during the implementation to allow the injection of fake events.

@TYoung86 TYoung86 changed the title session write contention session overwriting, write contention, resolution Sep 4, 2017
@TYoung86 TYoung86 changed the title session overwriting, write contention, resolution ability to pick behavior of session overwriting, contention Sep 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant