wildfly 10 unexpected shutdown often - amazon-web-services

Currently i have issue.
application server (wildfly 10) unexpected shutdown often.  
so i have check the server log nothing is there about the shutdown.
application running in aws(amazon web services).
application server name -wildfly 10.
am using putty to start the application(remote session)
server start command /usr/share/wildfly/bin/standalone.sh &
once i start i will close the putty.
i have place & symbol in start command so it will run in background, but after few days it's unexpected shutdown and nothing is there in server log.
thanks in advance

When you start applications from a command line on any unix based OS, it will be terminated automatically when the terminal session is closed, unless you tell the OS not to do that:
some-aws-prompt$ nohup /usr/share/wildfly/bin/standalone.sh &
The nohup command is an abbreviation for "don't hang up (the phone)" or "no hang up" when the user logs out.

Related

How to restart a squid server that is launched by exec

I am currently writing a program that will control the launch of squid server, in which I use fork-exec to launch squid server with non-background mode and with designated configuration file. And in the main process, I will periodically reload the squid server by sending signal to the child process.
However, it seems like that it doesn't work for me to reload the squid process by using "kill -HUP". So later I tried to verify if the "SIGHUP" is really working for reloading squid server by launching the server in a separate shell, and it doesn't work too.
So am i wrong with reloading squid server?
In the implementation I use kill command with SIGHUP to restart the server with child process id (followed by what systemd configuration of squid tells me how to reload the squid, https://github.com/squid-cache/squid/blob/master/tools/systemd/squid.service).
expected: I can reload squid with kill -HUP any times in my main process.
actual: failed with reloading, and the child process will exit when I send SIGHUP.
By looking into the cache.log file, I find out that the squid only recognize full path for the configuration file. So just type full path of file when launch the squid, and it will successfully reload with the same configuration when you send HUP signal to the squid process.

django: Localhost stopped working suddenly?

I'm truing to run a django server and all of a sudden I'm not able to go
to localhost:8000. I was able to a few seconds back, but now now it's just freezing up and saying "waiting for localhost"
I'm on a Mac OS X
How do I debug this?
Some links:
Waiting for localhost : getting this message on all browsers
Waiting for localhost, forever!
Why does my machine keeps waiting for localhost forever?
To summarise it - in general it means that the 1) server is waiting for input (e.g. not returning a response), 2) some other service might be running on the same port, 3) no DB connection.
However, that said a restart should sort all these out by killing all processes that might've taken the port and by restarting the DB and reconnecting properly.

c/c++ Controlling Linux service in my app

I want to start or stop mariadb in my app.
So, I am just using
system("systemctl start mariadb.service");
But it does not work.
Error is:
Error creating textual authentication agent: Error opening current controlling terminal for the process (`/dev/tty'): No such device or address (polkit-error-quark, 0)
What should I do?
My app runs with root and daemon
Thanks.

504 gateway timeout flask socketio

I am working on a flask-socketio server which is getting stuck in a state where only 504s (gateway timeout) are returned. We are using AWS ELB in front of the server. I was wondering if anyone wouldn't mind giving some tips as to how to debug this issue.
Other symptoms:
This problem does not occur consistently, but once it begins happening, only 504s are received from requests. Restarting the process seems to fix the issue.
When I run netstat -nt on the server, I see many entries with rec-q's of over 100 stuck in the CLOSE_WAIT state
When I run strace on the process, I only see select and clock_gettime
When I run tcpdump on the server, I can see the valid requests coming into the server
AWS health checks are coming back succesfully
EDIT:
I should also add two things:
flask-socketio's server is used for production (not gunicorn or uWSGI)
Python's daemonize function is used for daemonizing the app
It seemed that switching to gunicorn as the wsgi server fixed the problem. This legitimately might be an issue with the flask-socketio wsgi server.

How to figure out why ssh session does not exit sometimes?

I have a C++ application that uses ssh to summon a connection to the server. I find that sometimes the ssh session is left lying around long after the command to summon the server has exited. Looking at the Centos4 man page for ssh I see the following:
The session terminates when the command or shell on the remote machine
exits and all X11 and TCP/IP connections have been closed. The exit
status of the remote program is returned as the exit status of ssh.
I see that the command has exited, so I imagine not all the X11 and TCP/IP connections have been closed. How can I figure out which of these ssh is waiting for so that I can fix my summon command's C++ application to clean up whatever is being left behind that keeps the ssh open.
I wonder why this failure only occurs some of the time and not on every invocation? It seems to occur approximately 50% of the time. What could my C++ application be leaving around to trigger this?
More background: The server is a daemon, when launched, it forks and the parent exits, leaving the child running. The client summons by using:
popen("ssh -n -o ConnectTimeout=300 user#host \"sererApp argsHere\""
" 2>&1 < /dev/null", "r")
Use libssh or libssh2, rather than calling popen(3) from C only to invoke ssh(1) which itself is another C program. If you want my personal experience, I'd say try libssh2 - I've used it in a C++ program and it works.
I find some hints here:
http://www.snailbook.com/faq/background-jobs.auto.html
This problem is usually due to a feature of the OpenSSH server. When writing an SSH server, you have to answer the question, "When should the server close the SSH connection?" The obvious answer might seem to be: close it when the server-side user program started by client request (shell or remote command) exits. However, it's actually a bit more complicated; this simple strategy allows a race condition which can cause data loss (see the explanation below). To avoid this problem, sshd instead waits until it encounters end-of-file (eof) on the pipes connecting to the stdout and stderr of the user program.
#sienkiew: If you really want to execute a command or script via ssh and exit, have a look at the daemontool of the libslack package. (Similar tools that can detach a command from its standard streams would be screen, tmux or detach.)
To inspect stdin, stdout & stderr of the command executed via ssh on the command line, you can, for example, use lsof.
# sample code to figure out why ssh session does not exit
# sleep keeps its stdout open, so sshd only sees EOF after command completion
ssh localhost 'sleep 10 &' # blocks
ssh localhost 'sleep 10 1>&- &' # does not block
ssh localhost 'sleep 10 & lsof -p ${!}'
ssh localhost 'sleep 10 1>&- & lsof -p ${!}'
ssh localhost 'sleep 10 1>/dev/null & lsof -p ${!}'
ssh localhost 'sleep 10 1>/dev/null 2>&1 & lsof -p ${!}'