Node Express Ubuntu Pm2 | EADDRINUSE - express

I have a node express app running on Ubuntu with the pm2 service and nginx. All is fine starting up the pm2 service and my app is accessible. As soon as I navigate to another page on my app, pm2 list shows my app as status: errored. When I look at the error logs, I'm seeing a loop of:
Error: listen EADDRINUSE :::4300
I would think that I simply just need to find the service using port 4300 and kill it, but that's becoming a problem. When I run lsof -w -n -i tcp:4300 I do see a service running with an id of 23350. When I then run kill -15 23350, that obviously kills the process, but a new service is started immediately. I have tried stopping, starting and restarting pm2 with no luck. When I stop pm2, I can't even run npm run start as I get Error: listen EADDRINUSE :::4300.
Why is pm2 crashing upon navigating to another page on my app?
Why, when pm2 does crash, is it complaining about port 4300 already being in use?
I should note that when pm2 list reports status: errored, my app is still accessible except for when the form on the /contact page is submitted. It submits to itself with app.post('/contact'...), but in the browser, I see a blank white screen with 'Cannot post /contact'.
Thanks for your help in advance!

I had this same issue (killing node process but another one spawns) and finally resolved it. I may use some wrong UNIX terminology, please correct me if I do.
I was running pm2 on an AWS EC2 instance, and the OS was Ubuntu 20.04.
My problem was that it appears that the root user's pm2 processes are separate from the ubuntu (default) user's. When I was the default user and ran pm2 status, I saw my one stopped node process. When I switched to the root user using sudo su and ran pm2 status, I found another pm2 process running that wasn't listed when I was the default user! So I ran pm2 stop all as the root user and that solved my issue.
Steps:
sudo su # switch to root user
pm2 status # list all processes. For me this listed an extra running process that wasn't listed when I was the default user.
I just ran pm2 stop all to stop all the root user processes. You can also just stop the specific running process if you want with pm2 stop <name of pm2 process>.
Hopefully that helps someone!

Related

Web HUE is not getting loaded though HUE is workin on the port 8000

I have installed the Hue on the Linux whixh is an instance from Azure. I have made all the required changes in ambari and hue.ini conf file. And when I run the supervisor job, it runs fine
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
hue 83933 sshuser 3u IPv4 15707246 0t0 TCP *:8000 (LISTEN)
But when I try to access the wb hue, I don't get any page loaded. It shows refused to connect.
Tried deleting caches and reset up was done.
I am using hue 4.7 version and I don't find any issues in error.log file. Yet, I don't see any data in access.log file. Could you please help me?
Do you have
http_host=0.0.0.0
in the hue.ini?
#Ruthikajawar here is a working hue.ini for ambari
https://github.com/steven-dfheinz/HDP3-Hue-Service/blob/Hue.4.6.0/configuration/live.hue.ini
I have noticed that sometimes, after initial install, it takes 1 or 2 restarts to get the WEBUI to work. I have also noticed sometimes, after a restart, it takes quite a few moments before the WEBUI starts to respond.
Give it some time after restart and check the WEBUI. If you still are not getting it to answer you need to check /var/log/hue/error.log as it should be very specific with errors causing the WEBUI to fail on startup.

Cannot start renderd service for mod_tile

I am building an OSM tile server as per directions available here: https://switch2osm.org/manually-building-a-tile-server-16-04-2-lts/ on an Amazon EC2 instance with Ubuntu 16-04 LTS.
Everything is working well until the step of starting renderd as a service:
sudo /etc/init.d/renderd start
This returns an error of: "Job for renderd.service failed because the control process exited with error code. See "systemctl status renderd.service" and "journalctl -xe" for details."
Checking the details mentioned gives messages like:
"renderd.service: Control process exited, code=exited status=203"
"The error number returned by this process is 8."
I can however run renderd directly no problem as below, and can even (slowly) load tiles into a leaflet map, I just cannot run it as a service.
sudo -u username renderd -f -c /usr/local/etc/renderd.conf
I have also tried changing to my rendering user and starting the service from there, but then I get a password prompt for user ubuntu (there isn't one).
What else can I test out or investigate to find out what the problem is?
I decided to start building my server again from scratch, this time also using information from other tutorials: https://www.linuxbabe.com/linux-server/openstreetmap-tile-server-ubuntu-16-04 and https://ircama.github.io/osm-carto-tutorials/tile-server-ubuntu
Following those instructions, renderd now runs as a service. The main difference I noticed was those tutorials above use https://github.com/openstreetmap/mod_tile.git rather than the
https://github.com/SomeoneElseOSM/mod_tile.git source I used before, so perhaps the settings of the branched mod_tile were not compatible with my server.

ActiveMQ 5.15 HTTP ERROR: 503

Run environment :linux (CentOS 7), JDK 1.8, & ActiveMQ 5.15
I started Activemq then visit the management page with Chrome,when I try to log in with the default username & password I get the following error;
HTTP ERROR: 503
Problem accessing /admin/. Reason:
Service Unavailable Powered by Jetty://
How can I resolve this problem?
I was getting this same error. It turns out that I had run it as root user originally, then later I stopped it and ran it as a non-root user. Certain data files that had been created and owned by the original root instance were not accessible to the non-root user.
Check the ownership of the files, and change them if necessary to match the user that the broker is running as.
Had the same issue.
Maybe something went wrong the extraction of the package.
I downloaded this:
wget https://archive.apache.org/dist/activemq/5.15.0/apache-activemq-5.15.0-bin.tar.gz
and extracted it with:
sudo tar -zxvf apache-activemq-5.15.0-bin.tar.gz -C /opt
then it worked for me.
My two cents:
I start with the activemq in Ubuntu Repo, but then later change to binary package from official website.
In my case, the repo version left an /etc/default/activemq config file, which runs activemq with user "activemq". It turns out in previous experiments, I did not kill the old processes running under "activemq" when I start activemq under my own user name. There are two activemq processes running under different user names, and when connecting to admin console, I have a 503.
I delete the /etc/default/activemq file, and kill all activemq processes running under "activemq", then restart activemq with my user name, the 503 is gone.

Keystone Service In Devstack Not starting

I installed devstack on ubuntu 16.04 running on virtual box. The first time everything came up and i was able to access all services. I turned off my VM and reopened it again and now the keystone service is not starting.
I have been reading lot of forums which say devstack installation is corrupted and i have to run stack.sh again. But isn't there any way to bring up the existing keystone service ? All the other services running.
I have tried "sudo systemctl start devstack#keystone.service" but it doesn't work.
Please provide a solution for this. Thanks!
Do you see below file after reboot?
ls -l /var/run/uwsgi/keystone-wsgi-public.socket
srw-rw-rw- 1 stack stack 0 May 9 09:19 keystone-wsgi-public.socket
This is socket file and it should get created during startup.

Apache not starting, fails silently/hangs

I had a web server that got overloaded. I attempted to stop apache but it just hung so I kill -9 the apache pid.
When trying to run
sudo /etc/init.d.apache2 start
or any derivative thereof, nothing happens. The command doesn't return. There is no error in log or at command line. I just get Starting web server: apache2 and the cursor keeps blinking. I've waited 30 minutes and still nothing. The server has 10G of memory free.
I running Debian wheezy.
Start by looking at the log files. That should contain the reason.
If there is nothing in the log files, troubleshoot using strace shown here : https://serverfault.com/questions/150249/best-way-to-troubleshoot-apache-not-starting
strace showed it was hanging on an nfs4 mountpoint that was not functioning properly.