[d]ets:lookup misbehaves when called during init:start?
Chris Pressey
cpressey@REDACTED
Fri Apr 12 19:45:15 CEST 2002
Unhappy to report - this is not a consistent solution :(
Sometimes it works; other times, I can call inet_db:start/0, wait for a
process with the name inet_db to be registered, and sleep for a whole
extra second - and the problem is still there - all calls to
gen_tcp:accept/1 immediately return {error, closed}.
It is possibly a FreeBSD thing - I'm running 4.5-stable and "stable" can
be something of a euphemism in FreeBSDtalk :)
So, back to echo 'myapp:start().' | erl, for now...
Chris
On Tue, 02 Apr 2002 18:39:17 -0600
Chris Pressey <cpressey@REDACTED> wrote:
> Thanks! FWIW, erl -run inet_db -run yourapp also seems to work.
>
> Chris
>
> On Mon, 01 Apr 2002 08:43:40 +0100
> Per Bergqvist <per@REDACTED> wrote:
>
> > Hi Chris,
> >
> > the problem is that the inet_db modules has not yet been started
> > and hence the inet_db ets table does not exist (yet).
> > It is supposed to be started by the kernel_sup supervisor.
> >
> > I haven't managed to recreate the problem with R8B-0 under
> > Linux but two possible other workarounds are
> > a) wait for the inet_db process to become registered.
> > b) call inet_db:start from your application (as ftp,httpd and orber
> > already does (for the same reason ?)).
> >
> > /Per
> >
> > > I have discovered one workaround for this, although it comes at a
> > grave
> > > cost (namely, the use of the shell)
> > >
> > > Instead of
> > >
> > > erl -run module function
> > >
> > > use
> > >
> > > echo 'module:function().' | erl
> > >
> > > Should have been obvious I suppose :)
> > >
> > > Chris
> > >
> > > On Fri, 29 Mar 2002 06:27:22 -0600
> > > Chris Pressey <cpressey@REDACTED> wrote:
> > >
> > > > I'd really like to get to the bottom of this one...
> > > >
> > > > I have a server that opens a socket. If I start this server from
> > the
> > > > Erlang shell, everything works smoothly. If I try to start it
> > with a
> > > > -run command line argument to erl, it does *not* work and I get
> > the
> > > > following error message upon quitting:
> > > >
> > > > {error_logger,{{2002,3,29},{6,10,40}},'Error in process
> > <0.24481.0>
> > > > with exit value: {badarg,[{ets,lookup,[inet_db,tcp_module]},
> > > > {inet_db,db_get,1},{gen_tcp,listen,2},{ce_socket,start,4}]}\n',[]}
> > > >
> > > > I get the same error if I try to start it from my .erlang file.
> > > >
> > > > The question is... why?
> > > >
> > > > I've asked this once before a while ago, but got no response so
> > far.
> > > >
> > > > It seems someone else is (anonymously) getting a very similar
> > error
> > > > trying to start the wiki in the same way:
> > > >
> > > > http://www.bluetail.com/wiki/showPage?node=WikiSetup
> > > >
> > > > {badarg,[{ets,lookup_element,[dets_registry,wikie,3]},
> > > > {dets,lookup,2},
> > > > {wikie,fetch_page,1},
> > > > {erl_eval,expr,3},
> > > > {erl_eval,exprs,4},
> > > > {esp,eval,2},
> > > > {esp,expand,3},
> > > > {esp,do_expand_file,2},
> > > > {esp,handle,1}|
> > > > more]}
> > > >
> > > > Any information on this anomaly (e.g. why it happens and/or how to
> > work
> > > > around it) would be greatly appreciated (seeing as I *really*
> > don't want
> > > > to have to start my server from the Erlang shell every time I want
> > to
> > > > use it :)
> > > >
> > > > Thanks in advance,
> > > > Chris
> > >
> > =========================================================
> > Per Bergqvist
> > Synapse Systems AB
> > Phone: +46 709 686 685
> > Email: per@REDACTED
More information about the erlang-questions
mailing list