Windows andErlang 20.2: .erlang.cookie file location change warning

1,266 views
Skip to first unread message

Steven Bone

unread,
Jan 10, 2018, 7:59:20 AM1/10/18
to rabbitmq-users
After beating my head against the wall for a bit related to synchronizing cookies after updating Erlang to 20.2 in Windows, I stumbled on an item in the release notes:
  OTP-14691    Application(s): erts

               The fallback home directory for windows has been
               changed to be the PROFILE directory instead of the
               WINDOWS directory. The fallback is used when the
               environment variables HOMEDRIVE and HOMEPATH have not
               been set.
The corresponding code change can be found here.

The impact of this is that the RabbitMq documentation is now incorrect when used with Windows and Erlang 20.2 or greater.  The Manual Windows Installation page, the Clustering page, and the CLI page all reference the location of the .erlang.cookie file as C:\Windows where now that location is C:\WINDOWS\system32\config\systemprofile (assuming default Windows installation).  Perhaps the documentation could be altered to be a bit more specific regarding this.  I would suggest putting a fuller explanation in the Windows Quirks page and linking to the longer explanation from the other three pages cited above:

On Windows, Erlang's home dir is where the .erlang.cookie is located. Erlang will first try to use the combination of environment variables %HOMEDRIVE% and %HOMEDIR% (appended without spaces) if one or both are set. If neither are set, the fallback differs between Erlang versions.  If Erlang prior to 20.2, the fallback is %WINDIR% (usually C:\Windows), in later versions the user's FOLDERID_Profile (via SHGetKnownFolderPath) is utilized (which should be the same as %USERPROFILE%). The value of any of these variables can vary between users. As an example %USERPROFILE% will vary based on the user account RabbitMq, and therefore Erlang, is running under - if running as the console/desktop user, it may be "C:\Users\UserName", however if running as LocalSystem (the default when installed as a service) it may be "C:\WINDOWS\system32\config\systemprofile".  You can determine with 100% confidence the home dir, and thus the location of the cookie file used by RabbitMq server, by looking at the rab...@NODENAME.log file for where it logs "home dir".  This will be the source directory where the .erlang.cookie is that you would need to synchronize.  In clustering situations, after upgrading Erlang, you should be sure to copy the cookie from %WINDIR% to the new location prior to restarting the node to keep everything in sync. 

Note that there is additional hassle involved here (other than filesystem permissions) if you are attempting to synchronize cookies from (or to) a location (almost) anywhere under "C:\WINDOWS\system32" under the following conditions:(1) You are running a 64 bit Windows OS and (2) You are executing code to read or check for this file inside a 32-bit process. Due to the File System Redirector, under these circumstances, you can replace 'System32' with the 'SysNative' alias or disable/reenable redirection for that thread via Windows API calls surrounding checking/manipulating these files (see previous link).

Luke Bakken

unread,
Jan 10, 2018, 10:45:36 AM1/10/18
to rabbitmq-users
Hi Steven,

Thanks for the heads up. If you would like to submit a pull request with suggested changes, or just file an issue with what you found, the RabbitMQ website is open-source and located here:


Otherwise, I'll make a note to make these documentation updates.

Thanks!
Luke

Michael Klishin

unread,
Jan 10, 2018, 12:07:15 PM1/10/18
to rabbitmq-users
These changes are a part of our plan to get to officially support 20.2.

We should have the docs part sorted later this week. Sorry that it's wasted your time since
we were aware of the change since the day 20.2 came out (which was near the holiday break late last month).

Michael Klishin

unread,
Jan 12, 2018, 8:13:27 AM1/12/18
to rabbitmq-users
It's taking a bit longer than expected as more edits were necessary but a website update
should land around next Monday or earlier.

Michael Klishin

unread,
Jan 12, 2018, 4:59:02 PM1/12/18
to rabbitm...@googlegroups.com
The updates are live, Erlang/OTP 20.2 is now officially supported by RabbitMQ (we’ve been running our test suites and upgrade tests on it for well over a week now).

Thank you, Steven.
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages