502 error for redmine sign in or sign out

432 views
Skip to first unread message

Mark Edwards

unread,
Oct 9, 2013, 7:38:56 PM10/9/13
to phusion-...@googlegroups.com
I have a 


I seem to have an error related to database write function in my redmine app. specific to login and logout
can you please advise.

app works ok with webrick 

i understand sqlite does not support db security 
i noticed earlier that the redmine app is trying to add some data to the database
(more info about that db error to follow when i get copy of the message)


What is the expected output? redmine logged in as admin
 What do you see instead? html error page '502 bad gateway'


What version of Phusion Passenger are you using? 4.0.20 Which version of Rails? 3.2.13  
On what operating system? ubuntu squeezy on a little raspberry pi. 

nginx log

ile reading response header from upstream, client: 192.168.1.4, server: localhos
t, request: "POST /login HTTP/1.1", upstream: "passenger:/tmp/passenger.1.0.2302
/generation-0/request:", host: "192.168.1.8:8000", referrer: "http://192.168.1.8
:8000/login"
[ 2013-10-09 23:04:17.3457 2306/b52ea450 Pool2/Spawner.h:738 ]: [App 2725 stdout
]
[ 2013-10-09 23:04:32.7506 2306/b5bba450 agents/HelperAgent/RequestHandler.h:591
 ]: [Client 20] Disconnecting with error: invalid SCGI header
2013/10/09 23:04:32 [error] 2322#0: *16 upstream prematurely closed connection w
hile reading response header from upstream, client: 192.168.1.4, server: localho
st, request: "POST /logout HTTP/1.1", upstream: "passenger:/tmp/passenger.1.0.23
02/generation-0/request:", host: "192.168.1.8:8000", referrer: "http://192.168.1
.8:8000/"
[ 2013-10-09 23:05:03.1542 2306/b5bba450 agents/HelperAgent/RequestHandler.h:591
 ]: [Client 24] Disconnecting with error: invalid SCGI header
2013/10/09 23:05:03 [error] 2322#0: *16 upstream prematurely closed connection w
hile reading response header from upstream, client: 192.168.1.4, server: localho
st, request: "POST /logout HTTP/1.1", upstream: "passenger:/tmp/passenger.1.0.23
02/generation-0/request:", host: "192.168.1.8:8000", referrer: "http://192.168.1
.8:8000/"
[ 2013-10-09 23:05:50.7496 2306/b52ea450 Pool2/SmartSpawner.h:301 ]: Preloader f
or /var/lib/redmine started on PID 2725, listening on unix:/tmp/passenger.1.0.23
02/generation-0/backends/preloader.2725

Hongli Lai

unread,
Oct 10, 2013, 6:27:03 AM10/10/13
to phusion-passenger
Can you set passenger_log_level to 3, trigger the problem, and send
the contents of the Nginx error log?
> --
> You received this message because you are subscribed to the Google Groups
> "Phusion Passenger Discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to phusion-passen...@googlegroups.com.
> To post to this group, send email to phusion-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/phusion-passenger.
> For more options, visit https://groups.google.com/groups/opt_out.



--
Phusion | Ruby & Rails deployment, scaling and tuning solutions

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

Mark Edwards

unread,
Oct 10, 2013, 7:33:29 AM10/10/13
to phusion-...@googlegroups.com

Hi and thanks for taking the enquiry.

here is error.log

mark


--
You received this message because you are subscribed to a topic in the Google Groups "Phusion Passenger Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/phusion-passenger/SzkgVU2ty8E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to phusion-passen...@googlegroups.com.
error.log

Hongli Lai

unread,
Oct 10, 2013, 12:01:54 PM10/10/13
to phusion-passenger
There is something strange about the cookie. It contains a null
character, which is not allowed according to the HTTP grammar, so
Phusion Passenger throws an error.

Can you obtain the exact, raw HTTP headers that are being sent to the
server for the /login request?

Mark Edwards

unread,
Oct 10, 2013, 8:09:44 PM10/10/13
to phusion-...@googlegroups.com
Here is the file using a         > file.txt 

thanks

mark
file.txt

Mark Edwards

unread,
Oct 10, 2013, 6:28:42 PM10/10/13
to phusion-...@googlegroups.com


Here is what i got


mark 


root@raspberrypi:~# tcpflow -p -c -i eth0 port 8000 | grep -EA20 '(GET|POST|HEAD) .* HTTP/1.[01]|hOST: .*'
tcpflow[3059]: listening on eth0
192.168.001.004.01102-192.168.001.008.08000: POST /login HTTP/1.1
Connection: keep-alive
Content-Length: 182
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Cookie: _redmine_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJTg4NjljMjdmNGMxNmFkNDBjZGNlMzc4ZDlmZDdlNGNkBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMS9oRVc5WnBKMTZWQlk2S3lYeVVQeTlmZ3d5K3hmc2N6b1VEaXU5WEN5Q0E9BjsARg%3D%3D--10ca996c4fff792cd8bcd29fda20031254a04fe8

utf8=%E2%9C%93&authenticity_token=%2FhEW9ZpJ16VBY6KyXyUPy9fgwy%2BxfsczoUDiu9XCyCA%3D&back_url=http%3A%2F%2F192.168.1.8%3A8000%2Flogin&username=admin&password=admin&login=Login+%C2%BB
192.168.001.008.08000-192.168.001.004.01102: HTTP/1.1 502 Bad Gateway
Server: nginx/1.4.2
Date: Thu, 10 Oct 2013 22:27:45 GMT
Content-Type: text/html
Content-Length: 574
Connection: keep-alive



On Fri, Oct 11, 2013 at 3:01 AM, Hongli Lai <hon...@phusion.nl> wrote:

Hongli Lai

unread,
Oct 17, 2013, 6:19:46 AM10/17/13
to phusion-passenger
This is strange. I don't see anything wrong in your HTTP headers, and
when I try to reproduce this error locally, I was unable to.

Mark Edwards

unread,
Oct 22, 2013, 1:56:09 AM10/22/13
to phusion-...@googlegroups.com
thanks for taking a look hong lai.

i wonder if i have a user access level - file permission problem.
i have manually made redmine folders belong to www-data:www-data 
is it OK to ask how can i tell if the nginx http server is accessing html files as this user ?
i imagine the redmine login authetication would need to render some html to confirm the login ??
perhaps when it is trying to change to a different user say from guest to admin files or database access is denied ??

anyhow - will try to re install more carefully.


mark 

Mark Edwards

unread,
Oct 22, 2013, 7:47:56 AM10/22/13
to phusion-...@googlegroups.com
OK - now i have tried a completely fresh re install with another SD card as ext2 part. - and i get exactly the same problem >!

i tried it from several different remote browser and local browser - all same 502 error - with log saying invalid scgi header ...

what to do ?

mark 

Mark Edwards

unread,
Oct 22, 2013, 8:16:59 AM10/22/13
to phusion-...@googlegroups.com
Hong lia take a look at this dialog about the arm architecture in relation to this problem - what do you think ?

Mark Edwards

unread,
Oct 23, 2013, 7:43:25 PM10/23/13
to phusion-...@googlegroups.com
Thanks guys,

Just a note to advise - i had no luck sorting this problem.

i have found a working path with nginx and thin using proxy.

anyhow
thanks for your help 

Hongli Lai

unread,
Nov 19, 2013, 2:30:50 PM11/19/13
to phusion-passenger
Sorry for not being responsive Mark. I haven't had time at all to
further look at this, it's been too busy. Good to hear that Nginx +
Thin works for you.
Reply all
Reply to author
Forward
0 new messages