2

What causes the access on the server when the server starts?

I've run rhc tail on my app to monitor the new logs.

Here is my log http://laravel.io/bin/Dez4o


When I started the app using rhc app-start

app-root/logs/php-fpm-error.log

[26-Jul-2016 21:53:00] NOTICE: [pool www] 'user' directive is ignored     
when FPM is not running as root
[26-Jul-2016 21:53:00] NOTICE: [pool www] 'group' directive is ignored
when FPM is not running as root
[26-Jul-2016 21:53:00] NOTICE: fpm is running, pid 33590
[26-Jul-2016 21:53:00] NOTICE: ready to handle connections

app-root/logs/haproxy.log

[WARNING] 207/215259 (33493) : config : log format ignored for proxy 'stats' since it has no log address.
[WARNING] 207/215259 (33493) : config : log format ignored for proxy 'express' since it has no log address.
[WARNING] 207/215259 (33493) : Server express/local-gear is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 207/215259 (33493) : proxy 'express' has no server available!

app-root/logs/haproxy_ctld.log

I, [2016-07-26T21:52:59.962585 #33508]  INFO -- : Starting haproxy_ctld

nginx/logs/error.log

2016/07/26 21:53:03 [warn] 36575#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /var/lib/openshift/578775d489f5cf4fc100019f/nginx//conf/nginx.conf:2

app-root/logs/nginx_access.log

(my.sever.ip.address) - - [26/Jul/2016:21:53:06 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:08 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:10 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"

app-root/logs/haproxy.log

[WARNING] 207/215310 (33493) : Server express/local-gear is UP, reason: Layer7 check passed, code: 302, info: "HTTP status check returned code <3C>302<3E>", check duration: 69ms. 1 active and 0 backup servers online. 0 sessions requeued, 0 total in queue.

app-root/logs/nginx_access.log

(my.sever.ip.address) - - [26/Jul/2016:21:53:12 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:14 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:16 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:18 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:20 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:22 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"

then I try to access my root directory of the website

(my.sever.ip.address) - - [26/Jul/2016:21:53:24 -0400]  200 "GET /login HTTP/1.1" 1422 "-" "Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" "(my.client.ip.address)"
(my.sever.ip.address) - - [26/Jul/2016:21:53:24 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:25 -0400]  200 "GET /components/AdminLTE/bootstrap/css/bootstrap.min.css HTTP/1.1" 23930 "http://dev-teleradportal.rhcloud.com/login" "Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" "(my.client.ip.address)"
(my.sever.ip.address) - - [26/Jul/2016:21:53:25 -0400]  200 "GET /components/AdminLTE/plugins/font-awesome/css/font-awesome.min.css HTTP/1.1" 6734 "http://dev-teleradportal.rhcloud.com/login" "Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" "(my.client.ip.address)"
... other assets

but the logs continues after the loading

(my.sever.ip.address) - - [26/Jul/2016:21:53:26 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:29 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:31 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:33 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"

Then I executed the rhc app-stop to stop the server

these are the logs after executing "stop"

app-root/logs/php-fpm-error.log

[26-Jul-2016 21:53:55] NOTICE: Terminating ...
[26-Jul-2016 21:53:55] NOTICE: exiting, bye-bye!

nginx/logs/error.log

2016/07/26 21:53:55 [warn] 37102#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /var/lib/openshift/578775d489f5cf4fc100019f/nginx//conf/nginx.conf:2
2016/07/26 21:53:55 [notice] 37102#0: signal process started

The access logs

marlo
  • 123
  • 5

1 Answers1

5

The described behavior matches haproxy's http health checks. New sessions are created because haproxy does not keep cookies between health checks, thus your application (Laravel) considers the request the first request of a new browsing session.

You could reconfigure your health check url to something that does not use sessions to avoid creating the session file, but that would mean that the health check would pass even if the session functionality is broken.

The "inter" parameter sets the interval between two consecutive health checks to milliseconds. If left unspecified, the delay defaults to 2000 ms.

Source: http://cbonte.github.io/haproxy-dconv/1.6/snapshot/configuration.html#inter

sisve
  • 211
  • 1
  • 4
  • As a note in the margin: Most likely not Laravel directly, Nginx passes the request to PHP which is executing the Laravel script and PHP is configured to auto-start sessions and sets cookies. IIRC Laravel session management is on top of PHP core session functionality which is controlled by php.ini directives. Your suggestion however looks legit. Health check should look for HTTP availability first-hand only as this is the parent service interfaced with. – hakre Jul 27 '16 at 05:18
  • @hakre, just to be clear; Laravel does not use the builtin session support in php. In this case Laravel creates the session, but in other php applications there may be other functionality (the native sessions for example) that does it. Source: https://github.com/laravel/framework/blob/7dfb945c2813bc7f965792f1f83ea9decb856ca1/src/Illuminate/Session/Middleware/StartSession.php#L53-L55 – sisve Jul 27 '16 at 06:07