Rabbitmq dying during startup, "epmd error for host" - rabbitmq

Rabbitmq keeps dying within 2 minutes of startup, and fails with the error:
ERROR: epmd error for host localhost: timeout (timed out)
The /etc/hosts file shows:
127.0.0.1 localhost []-MacBook-Pro []-MacBook-Pro.local
255.255.255.255 broadcasthost
::1 localhost
([] replaces actual name in file)
I have tried uninstalling and reinstalling Erlang (v20.3.8.3) and Rabbitmq via homebrew, and still no connection. This is also regardless of what wifi I am on, or if I'm disconnected from wifi. Other commands I have tried:
$ echo $HOSTNAME
localhost
$ hostname
localhost
$ ifconfig lo0
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
inet 127.0.0.1 netmask 0xff000000
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
nd6 options=201<PERFORMNUD,DAD>
$ lsof -p 15279
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
epmd 15279 user cwd DIR 1,5 960 2 /
epmd 15279 user txt REG 1,5 46756 4852991 /usr/local/Cellar/erlang#20/20.3.8.3/lib/erlang/erts-9.3.3.2/bin/epmd
epmd 15279 user txt REG 1,5 841456 2333502 /usr/lib/dyld
epmd 15279 user txt REG 1,5 1170673664 3866438 /private/var/db/dyld/dyld_shared_cache_x86_64h
epmd 15279 user 0r CHR 3,2 0t0 311 /dev/null
epmd 15279 user 1w CHR 3,2 0t0 311 /dev/null
epmd 15279 user 2w CHR 3,2 0t0 311 /dev/null
epmd 15279 user 3u IPv4 0x91f821cb489372bb 0t0 TCP *:epmd (LISTEN)
epmd 15279 user 4u IPv6 0x91f821cb3ac82ed3 0t0 TCP *:epmd (LISTEN)
epmd 15279 user 5u IPv4 0x91f821cb4a2f057b 0t0 TCP localhost:epmd->localhost:55223 (ESTABLISHED)
epmd 15279 user 6u IPv4 0x91f821cb3a64dc1b 0t0 TCP localhost:epmd->localhost:55470 (ESTABLISHED)
epmd 15279 user 7u IPv4 0x91f821cb4919995b 0t0 TCP localhost:epmd->localhost:55974 (ESTABLISHED)
I'm not sure what else to try here, and am hoping someone has an idea.

I think it likely means that the port 4369 is not accessible.
Also your hosts file is a little strange:
127.0.0.1 localhost []-MacBook-Pro []-MacBook-Pro.local
can you just make that:
127.0.0.1 localhost

After getting help on the rabbitmq list, I discovered that rabbitmq was unable to log, and that's why it was quitting.
A bit more detail to help others in this, using epmd -d to start up epmd was useful to finally determine that rabbitmq was actually getting there, so that wasn't the issue in this case. But finding the erl_crash.dump file did show the error for not being able to log, so I changed the path in /usr/local/etc/rabbitmq/rabbitmq-env.conf for the log file, and now it works.

Related

Stale socket in lsof due to REDIS

I'm having a redis connection established and I've a python script which performs CLUSTER MEET, CLUSTER FORGET, IPTBL ADD and IPTBL DELETE.
When I give CLUSTER FORGET.
Before FIN packet reaches the other end, it closes the connection and I'm left with a stale socket.
On going through the redis documentation and other blogs I found tcp-keepalive and even after changing it to 300 and restarting the redisd I still see no effect.
/usr/sbin/lsof | grep 16381
redis-ser 23104 admin 10u IPv6 397237 0t0 TCP *:16381 (LISTEN)
redis-ser 23104 admin 11u IPv4 397239 0t0 TCP *:16381 (LISTEN)
redis-ser 23104 admin 12u IPv4 397251 0t0 TCP a.b.c.d:16381->a.b.c.e:56440 (ESTABLISHED)
redis-ser 23104 admin 13u IPv4 397253 0t0 TCP a.b.c.d:16381->a.b.c.f:58744 (ESTABLISHED)
redis-ser 23104 admin 14u IPv4 408062 0t0 TCP a.b.c.d:47230->a.b.c.e:16381 (ESTABLISHED)
redis-ser 23104 admin 15u IPv4 748468 0t0 TCP a.b.c.d:39754->a.b.c.f:16381 (ESTABLISHED)
redis-ser 23104 admin 16u IPv4 719475 0t0 TCP a.b.c.d:16381->a.b.c.f:58868 (ESTABLISHED)
I would like to understand how to make tcp-keepalive work ? Am I missing something ?
Any help would be appreciated.

Address already in use for puma-dev

Problem
Whenever I try to run
bundle exec puma -C config/puma.rb --port 5000
I keep getting
bundler: failed to load command: puma (/Users/ogirginc/.asdf/installs/ruby/2.7.2/bin/puma)
Errno::EADDRINUSE: Address already in use - bind(2) for "0.0.0.0" port 5000
Tried Things
I have tried anything I can think of or read. Here is the list:
1. Good old restart the mac.
Nope.
2. Find PID and kill.
Run lsof -wni tcp:5000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ControlCe 6071 ogirginc 20u IPv4 0x1deaf49fde14659 0t0 TCP *:commplex-main (LISTEN)
ControlCe 6071 ogirginc 21u IPv6 0x1deaf49ec4c9741 0t0 TCP *:commplex-main (LISTEN)
Kill with sudo kill -9 6071.
When I kill it, it is restarted with a new PID.
> lsof -wni tcp:5000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ControlCe 6071 ogirginc 20u IPv4 0x1deaf49fde14659 0t0 TCP *:commplex-main (LISTEN)
ControlCe 6071 ogirginc 21u IPv6 0x1deaf49ec4c9741 0t0 TCP *:commplex-main (LISTEN)
3. Use HTOP to find & kill
Filter with puma.
Found a match.
PID USER PRI NI VIRT RES S CPU% MEM% TIME+ Command
661 ogirginc 17 0 390G 6704 ? 0.0 0.0 0:00.00 /opt/homebrew/bin/puma-dev -launchd -dir ~/.puma-dev -d localhost -timeout 15m0s -no-serve-public-paths
Kill it with sudo kill -9 661.
Restarted with a new PID.
Additional Info
rails version is 5.2.6.
puma version is 4.3.8.
puma-dev version is 0.16.2.
Here are the logs for puma-dev:
2021/10/26 09:48:14 Existing valid puma-dev CA keypair found. Assuming previously trusted.
* Directory for apps: /Users/ogirginc/.puma-dev
* Domains: localhost
* DNS Server port: 9253
* HTTP Server port: inherited from launchd
* HTTPS Server port: inherited from launchd
! Puma dev running...
It feels like I am missing something obvious. Probably, due to lack of understanding some critical & lower parts of puma-dev. I would really appreciate, if this is solved with some simple explanation. Thanks in advance! :)
Why
Well, this is interesting. I did not think of searching for lsof's COMMAND column, before.
Turns out, ControlCe means "Control Center" and beginning with Monterey, macOS does listen ports 5000 & 7000 on default.
Solution
Go to System Preferences > Sharing
Uncheck AirPlay Receiver.
Now, you should be able to restart puma as usual.
Source: https://developer.apple.com/forums/thread/682332

Unable To Use Localhost Port 80 ; Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE)

I am using a Mac Book Pro
I need to use my localhost Port :80 but i keep getting this ERROR message:
Error response from daemon: driver failed programming external
connectivity on endpoint nostalgic_ride : Error starting userland
proxy:
Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE).
this issue arose because i tried to use docker to do this:
docker run -it -p 80:80 -p 443:443 nginx
I did a search to see what is listening on all my ports:
sudo lsof -nP | grep LISTEN
UserEvent 41 root 113u IPv6 0xa09c168d9d24ed2f 0t0 TCP [fe80:8::aede:48ff:fe00:1122]:49153 (LISTEN)
UserEvent 41 root 114u IPv6 0xa09c168d9d24e1af 0t0 TCP [fe80:8::aede:48ff:fe00:1122]:49154 (LISTEN)
UserEvent 41 root 115u IPv6 0xa09c168d9d24dbef 0t0 TCP [fe80:8::aede:48ff:fe00:1122]:49155 (LISTEN)
UserEvent 41 root 116u IPv6 0xa09c168d9d24f2ef 0t0 TCP [fe80:8::aede:48ff:fe00:1122]:49156 (LISTEN)
php-fpm 48 root 8u IPv4 0xa09c168d9d7b322f 0t0 TCP 127.0.0.1:9000 (LISTEN)
php-fpm 221 _www 9u IPv4 0xa09c168d9d7b322f 0t0 TCP 127.0.0.1:9000 (LISTEN)
php-fpm 222 _www 9u IPv4 0xa09c168d9d7b322f 0t0 TCP 127.0.0.1:9000 (LISTEN)
EEventMan 351 tom 4u IPv4 0xa09c168da7672eaf 0t0 TCP *:2968 (LISTEN)
java 648 tom 69u IPv6 0xa09c168d9d24c4ef 0t0 TCP [fe80:1::1]:49185 (LISTEN)
LogiMgrDa 715 tom 4u IPv4 0xa09c168da914f52f 0t0 TCP *:59866 (LISTEN)
httpd 860 root 4u IPv6 0xa09c168da64892ef 0t0 TCP *:80 (LISTEN)
httpd 864 _www 4u IPv6 0xa09c168da64892ef 0t0 TCP *:80 (LISTEN)
httpd 955 _www 4u IPv6 0xa09c168da64892ef 0t0 TCP *:80 (LISTEN)
Questions:
It appears that there are 3 instances of httpd listening on Port 80. If so, does anyone know what these httpd are for and whether it's safe to remove them.
If so, how do I kill/remove them.
ANSWER TO SIMILAR QUESTIONS ON THIS ISSUE:
these answers do not help me beucase they all recommend simply changing the port. however i need port 80 for localhost development

Apache/Nginx configuration issue after uninstalling laravel/valet and homestead on macOS Sierra

After uninstalling laravel/valet and Homestead on macOS Sierra, I switched back to Apache (rather than NGINX), tried to restart it using sudo apachectl -k restart, and it outputs this error:
httpd not running, trying to start
(48)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Additional Info - using Homebrew 1.3.1 with OS Sierra 10.12.6. Also used a similar local environment to the one found here:
https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions
Disclaimer: I almost never use NGINX but I'm assuming it, or something else involved in the laravel/valet setup is preventing Apache from binding to the right port.
How do I fix this error and reconfigure Apache to work with Homebrew again, instead of NGINX?
No output from lsof -i | grep LISTEN | grep ":80" but the output of sudo lsof -i :80 below:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 12146 root 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 12148 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 37113 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 37114 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 37115 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 38654 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
First check if nginx is running
ps aux | grep nginx
If it is running then check if it is running using brew
brew services list
If that shows nginx started then you use below command to stop it
brew services stop nginx
If it is not listed as started or not listed as a service then try to manually kill nginx
pkill nginx
Now to try to restart apache
sudo apachectl restart

(48)Address already in use: make_sock: could not bind to address [::]:80 on OS x Mavericks

I just updated my OSX yesterday with Mavericks and now I am getting error while using apache and Jetty.
It used to map my example.com domain directly to the localhost.
Now It seems broke on do to run my application server I have to explicitly specifying port to hit my server.(ex. example.com:8080)
While I run below command.
sudo apachectl -e debug
I will get the
[debug] mod_so.c(246): loaded module jk_module
(48)Address already in use: make_sock: could not bind to address [::]:80
(48)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
I ran many diff command to kill all httpd process as well find port which is listening on this port.
ex. sudo lsof -i :80
httpd 946 root 5u IPv6 0xe0c8ad50898bcf0f 0t0 TCP *:http (LISTEN)
httpd 947 _www 5u IPv6 0xe0c8ad50898bcf0f 0t0 TCP *:http (LISTEN)
httpd 949 _www 5u IPv6 0xe0c8ad50898bcf0f 0t0 TCP *:http (LISTEN)
httpd 954 _www 5u IPv6 0xe0c8ad50898bcf0f 0t0 TCP *:http (LISTEN)
Google 1633 jignesh.sheth 59u IPv4 0xe0c8ad508597efaf 0t0 TCP example.com:53742->stackoverflow.com:http (ESTABLISHED)
Google 1633 jignesh.sheth 189u IPv4 0xe0c8ad5082027faf 0t0 TCP example.com:53725->stackoverflow.com:http (ESTABLISHED)
Any idea what am I doing wrong?
I also had the same, I removed 'Listern 80' from my config file to solve this issue.
I had the same error. The error log file for Apache server at /var/log/apache*/ mentioned "Address already in use: make_sock: could not bind to address 0.0.0.0:443".
Resolved it using "sudo lsof -i :" command to find processes running on port.
Kill all the processes and re-run sudo apachectl start.
The apache server should start running.
This may help: https://superuser.com/questions/479146/macports-apache2-could-not-bind-to-address/479147#479147?newreg=95099c6a74724da49640329d4ee400f2
I had the same problem.
What I did was changing the permission on "username.conf" from users directory to 644 like in this tutorial
http://www.coolestguidesontheplanet.com/downtown/get-apache-mysql-php-and-phpmyadmin-working-osx-109-mavericks