[erlang-bugs] inets stand_alone mode

Anthony Ramine n.oxyde@REDACTED
Sat Jan 3 14:50:14 CET 2015


Le 4 août 2014 à 11:28, Ingela Anderton Andin <ingela.anderton.andin@REDACTED> a écrit :

> Hi!
> 
> On 07/30/2014 09:37 PM, Michael Truog wrote:
>> Hi,
>> 
>> I ran into a problem that exists in 17.1.2 with inets between inets mode
>> and stand_along mode with httpc:
>> 
>> This works:
>> 1> application:start(inets).
>> ok
>> 2> inets:start(httpc, [{profile, foobar}], inets).
>> {ok,<0.53.0>}
>> 3> inets:start(httpc, [{profile, foobar}], inets).
>> {error,{already_started,<0.53.0>}}
>> 
>> This is the problem (unable to use a try/catch to get the exit, since
>> that is within an inets process):
>> 1> inets:start(httpc, [{profile, foobar}], stand_alone).
>> {ok,<0.35.0>}
>> 2> inets:start(httpc, [{profile, foobar}], stand_alone).
> 
> 
> You are trying to start the same profile twice that will not work fine.
> You can start a profile and then access that profile from different processes, but you can only start a profile once. A profile should be viewed in the same way as an incognito windows in chrome.
> 
> 
> Regards Ingela Erlang/OTP Team - Ericsson AB
> 
> 
>> 
>> =ERROR REPORT==== 30-Jul-2014::12:24:22 ===
>> ** Generic server <0.35.0> terminating
>> ** Last message in was {'EXIT',<0.33.0>,
>>                         {'EXIT',
>>                          {badarg,
>>                           [{ets,new,
>>                             [stand_alone_foobar__session_db,
>>                              [public,set,named_table,{keypos,2}]],
>>                             []},
>>                            {httpc_manager,do_init,2,
>> [{file,"httpc_manager.erl"},{line,421}]},
>>                            {httpc_manager,init,1,
>> [{file,"httpc_manager.erl"},{line,406}]},
>>                            {gen_server,init_it,6,
>>                             [{file,"gen_server.erl"},{line,306}]},
>>                            {proc_lib,init_p_do_apply,3,
>> [{file,"proc_lib.erl"},{line,239}]}]}}}
>> ** When Server state == {state,[],stand_alone_foobar__handler_db,
>>                             {cookie_db,undefined,16402},
>> stand_alone_foobar__session_db,stand_alone_foobar,
>>                             {options,
>>                                 {undefined,[]},
>>                                 {undefined,[]},
>> 0,2,5,120000,2,disabled,false,inet,default,
>>                                 default,[]}}
>> ** Reason for termination ==
>> ** {'EXIT',{badarg,[{ets,new,
>>                          [stand_alone_foobar__session_db,
>>                           [public,set,named_table,{keypos,2}]],
>>                          []},
>>                     {httpc_manager,do_init,2,
>> [{file,"httpc_manager.erl"},{line,421}]},
>>                     {httpc_manager,init,1,
>> [{file,"httpc_manager.erl"},{line,406}]},
>>                     {gen_server,init_it,6,
>> [{file,"gen_server.erl"},{line,306}]},
>>                     {proc_lib,init_p_do_apply,3,
>> [{file,"proc_lib.erl"},{line,239}]}]}}
>> ** exception exit: {'EXIT',
>>                        {badarg,
>>                            [{ets,new,
>>                                 [stand_alone_foobar__session_db,
>> [public,set,named_table,{keypos,2}]],
>>                                 []},
>>                             {httpc_manager,do_init,2,
>> [{file,"httpc_manager.erl"},{line,421}]},
>>                             {httpc_manager,init,1,
>> [{file,"httpc_manager.erl"},{line,406}]},
>>                             {gen_server,init_it,6,
>> [{file,"gen_server.erl"},{line,306}]},
>>                             {proc_lib,init_p_do_apply,3,
>> [{file,"proc_lib.erl"},{line,239}]}]}}
>> 
>> I am not sure if this was a known issue, but it should be a bug, since
>> it seems valid that two standalone Erlang processes might use the same
>> httpc profile data in ets.
>> 
>> Thanks,
>> Michael

Still, shouldn't a proper already_started error be returned instead of crashing in the middle of nowhere?

Regards,
Anthony.




More information about the erlang-bugs mailing list