<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Hi<div><br></div><div>These are the options</div><div><br></div><div>







<p class="p1">ets:new(StationIdTableName,[{keypos,2},named_table,public]),</p><p class="p1"><br></p><p class="p1">The only odd things I can think of is that during the select records are getting deleted and added. Also, the select operation is run slowly (over 900 seconds)</p><p class="p1"><br></p><p class="p1">Again, this isn't every time I get the crash.</p><p class="p1"><br></p><p class="p1">Matt</p><p class="p1"><br></p><br><div><div id="SkyDrivePlaceholder"></div>> Date: Mon, 15 Oct 2012 11:49:14 +0200<br>> From: sverker.eriksson@ericsson.com<br>> To: mattevans123@hotmail.com<br>> CC: erlang-questions@erlang.org<br>> Subject: Re: [erlang-questions] ets:select badarg question (R15B)<br>> <br>> What options are you using when the table is created?<br>> <br>> /Sverker, Erlang/OTP<br>> <br>> Matthew Evans wrote:<br>> > Hi,<br>> > I'm running a select with a continuation on a public ets table with approximately 20,000 records.<br>> > The original call to the select is: ets:select(TableName,[{'$1',[],['$_']}],RecordsToGet), then an ets:select/1 on the continuation.<br>> ><br>> ><br>> ><br>> ><br>> ><br>> ><br>> ><br>> ><br>> > The process that is spawned to walk the table is sitting in a recursive loop doing a select (grabbing about 150 records each time), processing the matching records (which includes possibly deleting some of these records), then sleeping for a few seconds. It takes about 900 seconds to walk through the table. As well as records getting deleted, new records are added to the table during this time.<br>> > Every now and then I get an exception in the process doing the select/1:<br>> > Error in process <0.16218.1> on node 'xxxxx@E039D7001180' with exit value: {badarg,[{ets,select,[{'table_E0:39:D7:00:11:80',301,6,<<0 bytes>>,[{p_MacEntry.......  (truncated here)<br>> > This is the code (all running in the same process that started the select) obviously the last ets:select is causing the crash:<br>> ><br>> ><br>> ><br>> ><br>> ><br>> ><br>> ><br>> ><br>> > start_aging1(AgeInterval,MaxAge,SelectData) -><br>> >      start_aging1(AgeInterval,MaxAge,SelectData,0).<br>> > start_aging1(_AgeInterval,_MaxAge,'$end_of_table',RecsAged) -><br>> >      gen_server:cast(?MODULE,{completed_aging_operation,RecsAged});<br>> > start_aging1(_AgeInterval,MaxAge,{Matches,'$end_of_table'},RecsAged) -><br>> >      RecordsAgedCount = age_records(Matches,[],MaxAge*1000000,os:timestamp()),<br>> >      gen_server:cast(?MODULE,{completed_aging_operation,RecsAged+RecordsAgedCount});<br>> > start_aging1(AgeInterval,MaxAge,{Matches,Continuation},RecsAged) -><br>> >      RecordsAgedCount = age_records(Matches,[],MaxAge*1000000,os:timestamp()),<br>> >      timer:sleep(AgeInterval),<br>> >      start_aging1(AgeInterval,MaxAge,ets:select(Continuation),RecsAged+RecordsAgedCount).<br>> ><br>> > I'm not sure what could be the cause of the select getting a bad arg.<br>> > Any ideas?<br>> > Thanks<br>> > Matt                                                                                <br>> >   <br>> > ------------------------------------------------------------------------<br>> ><br>> > _______________________________________________<br>> > erlang-questions mailing list<br>> > erlang-questions@erlang.org<br>> > http://erlang.org/mailman/listinfo/erlang-questions<br>> >   <br>> <br></div></div>                                          </div></body>
</html>