<p>Ets table is always linked to some process. When the owner process of a table dies, the table is destroyed. In your case it is linked to shell process. By default shell process dies if any exception happens in the code it runs.</p>

<p>BR,<br>
Gleb Peregud</p>
<div class="gmail_quote">On 2 May 2011 07:55, "Todd" <<a href="mailto:t.greenwoodgeer@gmail.com">t.greenwoodgeer@gmail.com</a>> wrote:<br type="attribution">> I have an ets query that is broken. The funny thing is that after the <br>
> query fails, the ets table disappears...<br>> <br>> Here's the code...mostly ripped off from the file doc entry:<br>> git://<a href="http://gist.github.com/951214.git">gist.github.com/951214.git</a><br>> <br>
> REPRO:<br>> <br>> 1. the ets table does not exist<br>> <br>> 127> ets:all().<br>> [8207,4110,13,file_io_servers,inet_hosts_file_byaddr,<br>>   inet_hosts_file_byname,inet_hosts_byaddr,inet_hosts_byname,<br>
>   inet_cache,inet_db,global_pid_ids,global_pid_names,<br>>   global_names_ext,global_names,global_locks,ac_tab]<br>> 128><br>> <br>> 2. running the test creates the ets table, 'file_test'<br>> <br>
> dynamic_file:test(). <br>> <br>> -----------------------------------------<br>> create_file_slow<br>> -----------------------------------------<br>> create_file_slow,4884,1024,0.20966420966420968,1,<br>
> create_file_slow,16569,2048,0.1236043213229525,1,<br>> create_file_slow,41857,4096,0.09785698927300093,1,<br>> create_file_slow,135915,8192,0.060272964720597434,1,<br>> create_file_slow,564260,16384,0.029036259880197073,1,<br>
> create_file_slow,525989,32768,0.062297880754160255,1,<br>> -----------------------------------------<br>> create_file (fast)<br>> -----------------------------------------<br>> create_file,13306,1024,0.07695776341500075,1,<br>
> create_file,2907,1024,0.3522531819745442,2,<br>> create_file,1435,1024,0.713588850174216,4,<br>> create_file,740,1024,1.3837837837837839,8,<br>> ...<br>> create_file,468,1024,2.1880341880341883,16,<br>> create_file,3132,32768,10.462324393358877,2048,<br>
> create_file,3556,32768,9.214848143982003,4096,<br>> ok<br>> <br>> 3. verify the ets entry exists (it does)<br>> <br>> 129> ets:all().<br>> [file_test,8207,4110,13,file_io_servers,<br>>   inet_hosts_file_byaddr,inet_hosts_file_byname,<br>
>   inet_hosts_byaddr,inet_hosts_byname,inet_cache,inet_db,<br>>   global_pid_ids,global_pid_names,global_names_ext,<br>>   global_names,global_locks,ac_tab]<br>> <br>> <br>> 4. run my broken query. i'm trying to sort the results by a specific <br>
> column so that I can find what block size results in the best <br>> performance...not sure yet what's wrong with the query, but i'll figure <br>> it out:<br>> <br>> 130> lists:sort(fun({_,_,_,A,_}, {_,_,_,B,_}) -> A < B end, <br>
> ets:match(file_test, {create_file, '$0', '$1', '$2', '$3'})).<br>> ** exception error: no function clause matching <br>> erl_eval:'-inside-an-interpreted-fun-'([13306,1024,0.07695776341500075,1],<br>
> [2907,1024,0.3522531819745442,2])<br>> <br>> 5. look at the ets tables again, and whoa, the 'file_test' table is gone!<br>> <br>> 131><br>> ets:all(). <br>> <br>> [8207,4110,13,file_io_servers,inet_hosts_file_byaddr,<br>
>   inet_hosts_file_byname,inet_hosts_byaddr,inet_hosts_byname,<br>>   inet_cache,inet_db,global_pid_ids,global_pid_names,<br>>   global_names_ext,global_names,global_locks,ac_tab]<br>> <br>> 6. Is this expected behaviour? What would I have to do to prevent losing <br>
> my ets table?<br>> <br>> -Todd<br>> _______________________________________________<br>> erlang-questions mailing list<br>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br></div>