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

Fix race condition in ts_utils:make_dir/1 #109

Merged
merged 2 commits into from Mar 5, 2015

Conversation

Projects
None yet
2 participants
@tisba
Collaborator

tisba commented Mar 5, 2015

There is a race condition, when multiple Erlang VMs are started almost simultaneously which is a typical case if you are not using tsung's SMP option.

I observed it a couple of times now, that ts_local_mon failed to write the protocol_local dumpfile. The reason is that the check and set is not one atomic operation in ts_utils:make_dir_rec/3. There is a window after the check, when another process could have created the directory already, resulting in a {error, eexist}.

In #88 the check for ok in ts_local_mon:init/1 was wrongfully removed (I'm sorry for that). Back then I noticed the {error, eexist} and assumed that this is a result from the fact that the entire log directory already existed, which is not the case. ts_utils:make_dir/1 and ts_utils:make_dir_raw/1 should now be better protected against the mentioned race condition.

@tisba tisba changed the title from Fix race condition ts_utils:make_dir to Fix race condition in ts_utils:make_dir/1 Mar 5, 2015

nniclausse added a commit that referenced this pull request Mar 5, 2015

@nniclausse nniclausse merged commit 6e75081 into processone:master Mar 5, 2015

@tisba tisba deleted the tisba:fix-race-condition-ts_utils-make_dir branch Nov 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment