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

Fix race condition in cover.erl #10

Closed
wants to merge 1 commit into from

Conversation

altenwald
Copy link

Erlang R15B02 and R16B has a race condition in cover.erl, when a project with several applications in the apps directory is launched throught rebar with eunit, often crash with this message:

ERROR: eunit failed while processing /home/manuel/Proyectos/myproject/apps/app2: {'EXIT',
    {{badmatch,
         {error,
             {badarg,
                 [{ets,new,
                      [cover_internal_data_table,
                       [set,public,named_table,{write_concurrency,true}]],
                      []},
                  {cover,init_main,1,[{file,"cover.erl"},{line,565}]}]}}},
     [{rebar_eunit,cover_init,2,[{file,"src/rebar_eunit.erl"},{line,445}]},
      {rebar_eunit,run_eunit,3,[{file,"src/rebar_eunit.erl"},{line,127}]},
      {rebar_core,run_modules,4,[{file,"src/rebar_core.erl"},{line,405}]},
      {rebar_core,execute,5,[{file,"src/rebar_core.erl"},{line,334}]},
      {rebar_core,process_dir1,6,[{file,"src/rebar_core.erl"},{line,197}]},
      {rebar_core,process_each,5,[{file,"src/rebar_core.erl"},{line,268}]},
      {rebar_core,process_dir1,6,[{file,"src/rebar_core.erl"},{line,173}]},
      {rebar_core,process_commands,2,
          [{file,"src/rebar_core.erl"},{line,61}]}]}}

Adding cover.erl to the "src" directory fix the issue.

@bfosberry
Copy link

I consistently trigger this issue with eunit and ct. I tried hooking rebar into BOTH of your repos and they both trigger the issue. @bosqueviejo, should cover.erl take effect if I plug your repo into rebar the same way I would with @idubrovs or are there any other steps I would need to take to implement the patch?

@manuel-rubio
Copy link

If you get the ets error in cover, only put the cover.erl in the dependency and launch the tests, in Erlang with flat module model, this cover module overload the cover by default.

@tsloughter
Copy link
Collaborator

It has been almost 5 years since anyone has commented on this and it seems to be a rebar2 specific issue so I'm going to close. If it is still important please reopen.

@tsloughter tsloughter closed this Apr 15, 2018
@manuel-rubio
Copy link

manuel-rubio commented Apr 17, 2018

@tsloughter yes, sorry, I sent the fix for cover.erl to Erlang/OTP base code and was included in R16 so, it's should be solved/fixed a long time ago (if you are using R16+, of course).

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.

None yet

4 participants