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

use ets:select instead of ets:filter in application:loaded_applications/0 #2601

Merged
merged 1 commit into from
May 20, 2020

Conversation

f3c0
Copy link
Contributor

@f3c0 f3c0 commented Apr 21, 2020

ets:filter dies with badarg if there is a delete, while it is walking through the table

I've found that if an application uses application:loaded_applications() while live upgrade/downgrade is running, it throws badarg errors

it is fairly easy to reproduce:

2> [spawn(fun() -> application:loaded_applications(),application:unset_env(kernel,shell_history),application:set_env(kernel,shell_history,enabled) end) || _<-lists:seq(1,10000)].
=ERROR REPORT==== 21-Apr-2020::10:31:10.959539 ===
Error in process <0.732.0> with exit value:
{badarg,[{ets,next,[ac_tab,{env,kernel,shell_history}],[]},
         {ets,do_filter,5,[{file,"ets.erl"},{line,775}]},
         {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,684}]},
         {erl_eval,exprs,5,[{file,"erl_eval.erl"},{line,126}]}]}

=ERROR REPORT==== 21-Apr-2020::10:31:11.064337 ===
Error in process <0.2606.0> with exit value:
{badarg,[{ets,next,[ac_tab,{env,kernel,shell_history}],[]},
         {ets,do_filter,5,[{file,"ets.erl"},{line,775}]},
         {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,684}]},
         {erl_eval,exprs,5,[{file,"erl_eval.erl"},{line,126}]}]}
...

…ns/0

ets:filter dies with badarg if there is a delete, while it is walking through the table
@sverker
Copy link
Contributor

sverker commented May 5, 2020

Merged to master for OTP-23

@rickard-green rickard-green merged commit 93816e3 into erlang:maint-22 May 20, 2020
@sverker
Copy link
Contributor

sverker commented May 20, 2020

Released in OTP-23 and 22.3.4.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants