I have a PHP CLI script that continually times out, and I can't figure out the source of the timeout. Seemingly "randomly" the script will stop (with no PHP error in the logs) and give the following output to console:
timeout, elapsed_time = 60
I'm setting PHP's time limit via set_time_limit(0); intermittently but it doesn't seem to be making a difference.
Besides that, PHP is supposed to throw an error if it hits its timeout, and no error is thrown, so could this timeout be triggered by something other than PHP?
The script is started by a bash script ".sh" on a Ubuntu machine.
Thanks!
Thanks to everyone who helped me out.
I tried running the script through nohup and the timeout issue seems to have disappeared. Hope this helps someone else!
Related
I create a nodejs app.
heroku local web works perfect.
However when I pushed it to heroku and open the application, error message pops up
ui error message
When I tried heroku logs --tail, another error shows up on the console
console error.
Please help me fix this, thank you!
I am the author of this post and I figured out where the problem is by executing
heroku run bash and manually restarting the program and soon observed the error in the output.
It was because I omitted installing one dependency, which caused the nodejs program fail to start.
However, the output of heroku logs --tail still needs improving. It does not return anything useful other than a 400 error.
I'm trying to run a simple app on heroku. It doesn't use Flask at all, the script just needs to be run once and it will (or should) keep itself alive. It runs fine locally, it runs fine on my VPS. I really want to deploy it to heroku for the ease of maintenance/addons though. So I deployed it, made sure all the dependencies were installed, etc.
This is my Procfile:
web: newrelic-admin run-program python dragon.py
But when I try to run it, it will run fine for a few seconds before I get this error:
heroku/web.1: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
In those few seconds, it will even respond to commands (it's a chat bot), but inevitably fails with the failed to bind error. I've tried several solutions, such as adding $PORT to my procfile, and none of them worked. I tried using gunicorn and the app would run, but it wouldn't receive or respond to incoming commands.
I'm at a loss, does anyone know a surefire way to bind a port for a Python app NOT running Flask? I couldn't find any answers for anything that wasn't using Flask in some way, but adding Flask didn't appear to be working either. I just need this app to run as-is, but bind to a port so it will stay open.
This is a screenshot of my logs, showing the request/response headers, and even the first keepalive signal being sent by the app before it crashes.
http://puu.sh/h3Jo2/e689e9ba38.png
First edit: I contacted Heroku Support to get my boot timeout increased to 120 seconds. It still failed to bind to $PORT, despite running and working until it crashed. I also tried specifying a port in the config vars, to no avail. This is a screenshot of my logs showing failure to boot (twice) after 120 seconds: http://puu.sh/h4e4r/11c50a5ae7.png
Alright, I figured it out. I contacted support again and found out that I was using the wrong process type. I am now running it as a bot process, so my Procfile now looks like this:
bot: newrelic-admin run-program python dragon.py
This allows it to run without binding to a port.
I'm running node app under forever in a docker container, how do I get all console.log output to show up on the console? I'm a beginner to docker so I assume the best way to log with docker is to simply log to stdout. If there's a better more proper way to do this I'm open to alternative solutions.
forever, like standard node, simply logs to stdout as well so you shouldn't have to do anything special. Of course, if you start your container with docker run -d you'll have to run docker logs -f myNodeContainer to actually see the output live.
I just came across this question because I also installed forever for the first time, ran it with just forever server.js and...nothing.
No node console messages, just the warnings about no --minUptime and no --spinSleepTime. I stopped the forever processes using forever stopall and went looking for the logs. Sure enough, in the forever log was all the stdout from my server.
I assumed I was missing an option to print to stdout, but apparently not. After reading this SO question, I launch a fresh terminal, run it again and it works - it now logs my server messages to the console.
Since then I have also experienced lots of strange issues with forever. Like it restarting the script continuously, even though the script fails to start within 1000ms (there was a syntax error in one of the files) - I stop it, run forever again (same options, same source files) and it does what it's supposed to (only runs the script once).
Not really an answer (sorry), but this is just in case anyone comes seeking information.
I am using Neo4j 2.0.3 Community server by installing it on my linux system (by unzipping the tar.gz). I got this error while I tried to start the server
WARNING! You are using an unsupported Java runtime.
process [50690]... waiting for server to be ready.neo4j-community-2.0.3/bin/neo4j: line 147: lsof : command not found
.neo4j-community-2.0.3/bin/neo4j: line 147: lsof : command not found
.neo4j-community-2.0.3/bin/neo4j: line 147: lsof : command not found
. Failed to start within 120 seconds.
Neo4j Server may have failed to start, please check the logs.
I checked for the solution for this and came to know that /usr/sbin had to be added to the path. On doing so and restarting the server, I got the following message
Another server-process is running with [40903], cannot start a new one. Exiting.
However, when I run the command neo4j staus , it says
Neo4j Server is not running
Can anybody please help me with how should I get started with it?
This is very late, but might help others.
If it tells you this, and you check that process id with, for example, ps aux | grep 40903, and it's not neo4j, the problem might be that the port is being used.
By default neo4j uses 7474, but can change this on the neo4j folder /conf/neo4j-server.properties and that was my problem, I had set the port to '22' which was being used. SO make sure it is set to a port that is open and available.
Hope this helps.
You might want to examine the startup script.
Another server-process is running with [40903], cannot start a new one. Exiting.
indicates (me to) that there might be a pid file (or the script uses them) which was written and is checked before attempting to start a new instances. This the normal thing to do.
I think you need to kill the other process using kill
You can see this answer for how to kill the process:
https://unix.stackexchange.com/questions/8916/when-should-i-not-kill-9-a-process
Otherwise, restarting the operating system will also do the job. For me, I normally start neo4j in the console, as in ./neo4j console. This makes it easier to stop the process.
Running my Java service using jsvc on Linux (Ubuntu) 10.04.4 LTS and when I stop service and requests and then hung, checked log to find jsvc exec error below.
14/03/2014 12:49:48 19831 jsvc.exec error: Still running according to PID file /home/user/tmp/example.pid, PID is 19728
14/03/2014 12:49:48 19830 jsvc.exec error: Service exit with a return value of 122
Any idea ?
Thanks,
I'm having a similar problem that happens at a log rotation. It appears that the system is shutting down, rotating the logs, then trying to start the system. I believe error 122 is telling you that it hasn't completed shutting down yet and can't restart. I believe the -wait parameter is needed in the start script.
http://commons.apache.org/proper/commons-daemon/jsvc.html
Also see http://freddyandersen.wordpress.com/2009/09/02/running-tomcat-as-a-service-on-linux/ for an example.
If this is happening due to logrotate, use the copytruncate option instead of restarting the service.
http://www.vineetmanohar.com/2010/03/howto-rotate-tomcat-catalina-out/
Try to run below command. Here 19728 is the process id.
pkill -9 19728
Now start your process. It will work.
This will solve your problem.
Thank you.