Andr3as / Codiad-CodeGit

Git integration for Codiad
MIT License
26 stars 15 forks source link

php5-fpm crashing when trying to push/pull #6

Closed GilDev closed 10 years ago

GilDev commented 10 years ago

Hello, I have a webserver running Nginx and PHP5 on my Raspberry Pi. I'm not really experienced with php5-fpm, Nginx or other things like that and their configurations. When I try to push or pull to my remote, PHP just crashes. I can't load any PHP file after that. My php5-fpm logfile doesn't show anything abnormal, my Nginx error.log file looks like this:

2014/07/15 16:42:19 [error] 4262#0: *417 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 88.138.49.173, server: , request: "GET /codiad/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "gildev.tk"

And my Nginx access.log file looks like this:

88.138.49.173 - - [15/Jul/2014:16:43:59 +0200] "GET /codiad/ HTTP/1.1" 499 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:31.0) Gecko/20100101 Firefox/31.0"
88.138.49.173 - - [15/Jul/2014:16:44:21 +0200] "-" 400 0 "-" "-"
88.138.49.173 - - [15/Jul/2014:16:44:31 +0200] "-" 400 0 "-" "-"
88.138.49.173 - - [15/Jul/2014:16:44:41 +0200] "-" 400 0 "-" "-"
88.138.49.173 - - [15/Jul/2014:16:44:51 +0200] "-" 400 0 "-" "-"

So the headers of the requests made after the crash seems… Empty. To fix the problem I must enter sudo service php5-fpm restart and everything goes back normal until I push/pull again. I hope you'll find how to fix this, maybe do you need more log files. Thanks!

PS: Sorry if my english isn't perfect, I'm 16, french, and I learned english pretty much by myself.

GilDev commented 10 years ago

Oh, after waiting for a long time on the Codiad loading webpage (I set the php5-fpm timeout to 300s because of 504 errors I was having), it shows a 504 error in my browser and I get this in my php5-fpm.log file:

[15-Jul-2014 16:59:00] WARNING: [pool www] child 28802, script '/var/www/codiad/components/user/controller.php' (request: "GET /codiad/components/user/controller.php") execution timed out (328.263093 sec), terminating
[15-Jul-2014 16:59:00] WARNING: [pool www] child 28799, script '/var/www/codiad/index.php' (request: "GET /codiad/index.php") execution timed out (330.103352 sec), terminating
[15-Jul-2014 16:59:00] WARNING: [pool www] child 28798, script '/var/www/codiad/components/user/controller.php' (request: "GET /codiad/components/user/controller.php") execution timed out (338.246452 sec), terminating
[15-Jul-2014 16:59:00] WARNING: [pool www] child 28774, script '/var/www/codiad/plugins/Codiad-CodeGit-master/controller.php' (request: "GET /codiad/plugins/Codiad-CodeGit-master/controller.php") execution timed out (339.095040 sec), terminating
[15-Jul-2014 16:59:00] WARNING: [pool www] child 28773, script '/var/www/codiad/plugins/Codiad-CodeGit-master/controller.php' (request: "GET /codiad/plugins/Codiad-CodeGit-master/controller.php") execution timed out (342.710668 sec), terminating
[15-Jul-2014 16:59:00] WARNING: [pool www] child 28772, script '/var/www/codiad/plugins/Codiad-CodeGit-master/controller.php' (request: "GET /codiad/plugins/Codiad-CodeGit-master/controller.php") execution timed out (342.839566 sec), terminating
[15-Jul-2014 16:59:00] WARNING: [pool www] child 28773 exited on signal 15 (SIGTERM) after 599.875115 seconds from start
[15-Jul-2014 16:59:00] NOTICE: [pool www] child 28875 started
[15-Jul-2014 16:59:00] WARNING: [pool www] child 28772 exited on signal 15 (SIGTERM) after 599.904724 seconds from start
[15-Jul-2014 16:59:00] NOTICE: [pool www] child 28876 started
[15-Jul-2014 16:59:00] WARNING: [pool www] child 28774 exited on signal 15 (SIGTERM) after 599.896503 seconds from start
[15-Jul-2014 16:59:00] NOTICE: [pool www] child 28877 started
[15-Jul-2014 16:59:00] WARNING: [pool www] child 28798 exited on signal 15 (SIGTERM) after 338.337172 seconds from start
[15-Jul-2014 16:59:00] NOTICE: [pool www] child 28878 started
[15-Jul-2014 16:59:00] WARNING: [pool www] child 28799 exited on signal 15 (SIGTERM) after 337.340281 seconds from start
[15-Jul-2014 16:59:00] NOTICE: [pool www] child 28879 started
[15-Jul-2014 16:59:00] WARNING: [pool www] child 28802 exited on signal 15 (SIGTERM) after 329.344326 seconds from start
[15-Jul-2014 16:59:00] NOTICE: [pool www] child 28880 started

And things go back normally after that.

Andr3as commented 10 years ago

Does it only happen during pull or push? I have no experience neither with nginx nor with php5_fpm. (I use Codiad with apache on a raspberry). The php script waits until git has finished, so if the script runs into timeout, it's a problem with git. (I guess). How long does it normally takes to run git pull or push over a console?

GilDev commented 10 years ago

Nevermind I just found the bug. In fact it's the SSH connection which doesn't work. I tried with the HTTP URL of the repo and the plugin asks my credentials and I then can push. But with SSH, it's stuck (maybe you should add a timeout to the PHP script if Git hasn't finished in a long time). When I try to push on my RPi console over SSH, I get this: Permission denied (publickey). fatal: The remote end hung up unexpectedly, so how can I create public keys for Codiad/my webserver? If I put the SSH keys of the pi user, I don't think it will work. Btw maybe you should try Nginx, I got a huge performance boost over Apache with it. ;-)

Andr3as commented 10 years ago

Check Github Help.

GilDev commented 10 years ago

Sure, but do you know how to create keys that could be used by CodeGit? If I create them with the pi user it doesn't work.

Andr3as commented 10 years ago

Now I get your problem: Check this. After adding your ssh key to github, you should test it: sudo -Hu www-data ssh -T git@github.com.

GilDev commented 10 years ago

It works! Thank you very much it was really helpful!