[erlang-questions] Re: Cannot unload module from remote shell

Matthias Lang matthias@REDACTED
Fri Dec 17 11:23:29 CET 2010


Matt> > You can investigate the problem a bit by using the 'code' module. In
Matt> > particular, try calling
> >
Matt> >   code:which(dmitrys_module)

Dmitry> code:which(rbt).
Dmitry> "/var/lib/rabbitmq/rbt.beam"

Dmitry> That's it. Thank you, Matt. So, if this is really unexpected,
Dmitry> I can assume that RabbitMQ overrides the default compilation
Dmitry> procedure, caching the compiled module, right? And, probably,
Dmitry> the default loading procedure, too, since /var/lib/rabbitmq is
Dmitry> missing in the output of code:get_path.

On the copy of rabbitmq (Debian, 1.8.1-1) I just installed:

(rabbit@REDACTED)1> code:get_path().
["/usr/lib/rabbitmq/lib/rabbitmq_server-1.8.1/sbin/../ebin",
 ".","/usr/lib/erlang/lib/kernel-2.14/ebin",
 "/usr/lib/erlang/lib/stdlib-1.17/ebin",
 "/usr/lib/erlang/lib/sasl-2.1.9.2/ebin",
 "/usr/lib/erlang/lib/syntax_tools-1.6.6/ebin",
 "/usr/lib/erlang/lib/ssl-4.0/ebin",
 "/usr/lib/erlang/lib/snmp-4.17/ebin",
 "/usr/lib/erlang/lib/runtime_tools-1.8.4/ebin",
 "/usr/lib/erlang/lib/public_key-0.7/ebin",
 "/usr/lib/erlang/lib/otp_mibs-1.0.6/ebin",
 "/usr/lib/erlang/lib/os_mon-2.2.5/ebin",
 "/usr/lib/erlang/lib/mnesia-4.4.14/ebin",
 "/usr/lib/erlang/lib/hipe-3.7.6/ebin",
 "/usr/lib/erlang/lib/erts-5.8/ebin",
 "/usr/lib/erlang/lib/erl_interface-3.7",
 "/usr/lib/erlang/lib/crypto-2.0/ebin",
 "/usr/lib/erlang/lib/compiler-4.7/ebin"]

Notice that ".", i.e. the current directory, is included in the path.
What does rabbitmq use for a current directory?

  (rabbit@REDACTED)2> pwd().
  /var/lib/rabbitmq

So there's nothing unexpected about Erlang loading code from
/var/lib/rabbitmq, it's the current directory for rabbitmq and
the current directory is in the code path!

Matt

(Bonus question for the rabbitmq guys: what's the .erlang.cookie file
for?  Is it a cookie or a hash of a cookie?)


More information about the erlang-questions mailing list