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

plug bg_manager_eqc into eunit and address potential race #595

Merged
merged 1 commit into from
Jun 4, 2014

Conversation

jrwest
Copy link
Contributor

@jrwest jrwest commented May 29, 2014

previously this eqc was not run as part of the eunit suite (#485). When plugging it in a found a failure due to a race-condition in the test:

1> bg_manager_eqc:run_check().
Starting Quviq QuickCheck version 1.29.1
   (compiled at {{2013,6,27},{9,46,39}})
Licence for Basho reserved until {{2014,5,29},{12,7,3}}
Failed!
[{set,{var,2},{call,bg_manager_eqc,set_concurrency_limit,[d,1,false]}},
 {set,{var,5},{call,bg_manager_eqc,start_process,[]}},
 {set,{var,7},{call,bg_manager_eqc,get_lock,[d,{var,5},[]]}},
 {set,{var,11},{call,bg_manager_eqc,stop_process,[{var,5}]}},
 {set,{var,13},{call,bg_manager_eqc,all_resources,[all]}}]


Final State:
---------------
alive = true
bypassed = false
enabled = true
procs = [{<0.222.0>,not_running}]
limits = [{d,1}]
locks = [{d,[{#Ref<0.0.0.262>,<0.222.0>,[],released}]}]
counts = []
tokens = []
---------------


background_mgr tables:
---------------
[{enabled,true},{bypassed,false},{{info,d},{resource_info,lock,1,true}}]
---------------
[{{given,d},{resource_entry,d,lock,<0.222.0>,[],#Ref<0.0.0.262>}}]
---------------


bg_manager monitors:
---------------
{monitors,[]}
---------------

bg_manager_eqc:set_concurrency_limit(d, 1, false) -> undefined
bg_manager_eqc:start_process() -> <0.222.0>
bg_manager_eqc:get_lock(d, <0.222.0>, []) -> #Ref<0.0.0.262>
bg_manager_eqc:stop_process(<0.222.0>) -> ok
bg_manager_eqc:all_resources(all) ->
  [#bg_stat_live{
     resource = d, type = lock, owner = {<0.222.0>, []} }]

Reason: {postcondition, {1, '/=', 0}}
false

This PR addresses both those issues.

see comment in changeset for more details

see comment in changeset for more details
@jrwest
Copy link
Contributor Author

jrwest commented May 30, 2014

not sure why the build is failing. a test was skipped because there should be 370 w/ this change. The bg_manager_eqc test did run.

@reiddraper
Copy link
Contributor

@jrwest here's the failure, eunit's reporting is just stupid. This should be fixed in the merge commit:

module 'hashtree'
  hashtree: snapshot_test...[0.870 s] ok
  hashtree: delta_test...[0.028 s] ok
  hashtree: sha_test_...[9.125 s] ok
  hashtree: eqc_test_...*timed out*
  undefined

@kellymclaughlin kellymclaughlin added this to the 2.0-RC milestone May 30, 2014
@jrwest
Copy link
Contributor Author

jrwest commented May 30, 2014

bah, easy to miss. thanks.

@reiddraper
Copy link
Contributor

I'll grab review now.

@reiddraper reiddraper self-assigned this May 30, 2014
borshop added a commit that referenced this pull request May 30, 2014
plug bg_manager_eqc into eunit and address potential race

Reviewed-by: reiddraper
%% background manager receives the monitor message for the failed pid
%% (waiting for the test process to receive its monitor message is not
%% enough). This relies on local erlang message semantics a bit and may
%% not be bullet proof. The catch handles the case where the bg manager
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on what local messaging semantics this relies on?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"local" may be ancillary. its relying on ordering of messages between two processes A and B (the test process and the bg manager). Its not bullet proof because technically the 2 messages (enabled and the next command) may still arrive before the monitor message but its a lot less likely now -- i was reproducing it every 1k tests and now can't in 100k regularly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks.

@jrwest
Copy link
Contributor Author

jrwest commented May 30, 2014

build failed again for unrelated reason: #596

@reiddraper
Copy link
Contributor

@jrwest so, shall we get #596 fixed, and the once that is merged, the bors merge-commit should pass here?

borshop added a commit that referenced this pull request Jun 4, 2014
plug bg_manager_eqc into eunit and address potential race

Reviewed-by: reiddraper
@jrwest
Copy link
Contributor Author

jrwest commented Jun 4, 2014

@borshop merge

@borshop borshop merged commit 960b83c into develop Jun 4, 2014
@reiddraper reiddraper deleted the bugfix/jrw/bg-mgr-eqc-fixes branch June 4, 2014 15:55
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

Successfully merging this pull request may close these issues.

4 participants