Re: debugging 500 Internal error in httpd+gunicorn setup

2021-11-22 Thread Sandeep Gupta
Success..sort of.
Following path setup seems to work:

for httpd:
server "www.example.com" {
root "/htdocs/www.example.com/"
location "/app" {fastcgi socket
"/htdocs/www.example.com/run/gunicorn.sock"}
}
for uvicorn:
--bind=unix:/var/www/htdocs/www.example.com/run/gunicorn.sock. The
location path was not correct.

With this gunicorn seems to receives bits from httpd. Although it
doesn't like what it gets -- might be mismatch in protocol type
[2021-11-22 22:07:30 +0530] [1631] [WARNING] Invalid HTTP request received.
Traceback (most recent call last):
  File 
"/home/shared/Builds/Python-3.10.0/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py",
line 136, in handle_events
event = self.conn.next_event()
  File 
"/home/shared/Builds/Python-3.10.0/lib/python3.10/site-packages/h11/_connection.py",
line 443, in next_event
exc._reraise_as_remote_protocol_error()
  File 
"/home/shared/Builds/Python-3.10.0/lib/python3.10/site-packages/h11/_util.py",
line 76, in _reraise_as_remote_protocol_error
raise self
  File 
"/home/shared/Builds/Python-3.10.0/lib/python3.10/site-packages/h11/_connection.py",
line 425, in next_event
event = self._extract_next_receive_event()
  File 
"/home/shared/Builds/Python-3.10.0/lib/python3.10/site-packages/h11/_connection.py",
line 367, in _extract_next_receive_event
event = self._reader(self._receive_buffer)
  File 
"/home/shared/Builds/Python-3.10.0/lib/python3.10/site-packages/h11/_readers.py",
line 68, in maybe_read_from_IDLE_client
raise LocalProtocolError("illegal request line")
h11._util.RemoteProtocolError: illegal request line



~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
-- VISUAL --

 6 9,0-1 All
0 curl  1* etc/httpd.conf  2 /var/www/logs  3 curl  4
htdocs/example.com  5- gunicorn  6 rc.d  7 simpleapp  8 nginx

On Mon, Nov 22, 2021 at 6:59 PM Sandeep Gupta  wrote:
>
> I can generate ktrace.out but I am not able to view the output.
> The command "kdump -f ktrace.out"  does not yield any output.
>
> On Mon, Nov 22, 2021 at 5:33 PM Peter J. Philipp  
> wrote:
> >
> > On Mon, Nov 22, 2021 at 05:18:42PM +0530, Sandeep Gupta wrote:
> > > Below is my simple httpd.conf entry:
> > >
> > > server "www.example.com" {
> > > listen on * port 80
> > > root "/htdocs/www.example.com/"
> > > location "/app" {fastcgi socket "/run/gunicorn.sock"}
> > > }
> > >
> > > In the background gunicorn server is running. When I access
> > > www.example.com/app, I get 500 Internal Server Error. There is nothing
> > > in the httpd error log (/var/www/logs/error.log). The gunicorn server
> > > doesn't report any incoming request.
> > > Hence, I thing request breaks down in the  httpd part before
> > > forwarding to the request to gunicorn.
> > > How do I go about debugging httpd requests.  I have put "-v -d" in the
> > > httpd_flags in /etc/rc.conf.local but doesnt produce any additional
> > > log messages.
> > >
> > >
> > > Thanks
> > > -S
> >
> > I keep on having the same problem.  The way to debug the CGI is with 
> > slowcgi.
> > I usually ktrace -p (pid of slowcgi) -i and watch the ktrace.out and then
> > turn off ktrac'ing with ktrace -C.  Since the 500 Internal Server Error is
> > not really informative.
> >
> > Best Regards,
> > -peter



Re: debugging 500 Internal error in httpd+gunicorn setup

2021-11-22 Thread Sandeep Gupta
I can generate ktrace.out but I am not able to view the output.
The command "kdump -f ktrace.out"  does not yield any output.

On Mon, Nov 22, 2021 at 5:33 PM Peter J. Philipp  wrote:
>
> On Mon, Nov 22, 2021 at 05:18:42PM +0530, Sandeep Gupta wrote:
> > Below is my simple httpd.conf entry:
> >
> > server "www.example.com" {
> > listen on * port 80
> > root "/htdocs/www.example.com/"
> > location "/app" {fastcgi socket "/run/gunicorn.sock"}
> > }
> >
> > In the background gunicorn server is running. When I access
> > www.example.com/app, I get 500 Internal Server Error. There is nothing
> > in the httpd error log (/var/www/logs/error.log). The gunicorn server
> > doesn't report any incoming request.
> > Hence, I thing request breaks down in the  httpd part before
> > forwarding to the request to gunicorn.
> > How do I go about debugging httpd requests.  I have put "-v -d" in the
> > httpd_flags in /etc/rc.conf.local but doesnt produce any additional
> > log messages.
> >
> >
> > Thanks
> > -S
>
> I keep on having the same problem.  The way to debug the CGI is with slowcgi.
> I usually ktrace -p (pid of slowcgi) -i and watch the ktrace.out and then
> turn off ktrac'ing with ktrace -C.  Since the 500 Internal Server Error is
> not really informative.
>
> Best Regards,
> -peter



Re: debugging 500 Internal error in httpd+gunicorn setup

2021-11-22 Thread Peter J. Philipp
On Mon, Nov 22, 2021 at 05:18:42PM +0530, Sandeep Gupta wrote:
> Below is my simple httpd.conf entry:
> 
> server "www.example.com" {
> listen on * port 80
> root "/htdocs/www.example.com/"
> location "/app" {fastcgi socket "/run/gunicorn.sock"}
> }
> 
> In the background gunicorn server is running. When I access
> www.example.com/app, I get 500 Internal Server Error. There is nothing
> in the httpd error log (/var/www/logs/error.log). The gunicorn server
> doesn't report any incoming request.
> Hence, I thing request breaks down in the  httpd part before
> forwarding to the request to gunicorn.
> How do I go about debugging httpd requests.  I have put "-v -d" in the
> httpd_flags in /etc/rc.conf.local but doesnt produce any additional
> log messages.
> 
> 
> Thanks
> -S

I keep on having the same problem.  The way to debug the CGI is with slowcgi.
I usually ktrace -p (pid of slowcgi) -i and watch the ktrace.out and then
turn off ktrac'ing with ktrace -C.  Since the 500 Internal Server Error is
not really informative.

Best Regards,
-peter



Re: debugging 500 Internal error in httpd+gunicorn setup

2021-11-22 Thread Łukasz Moskała



Dnia 22 listopada 2021 12:48:42 CET, Sandeep Gupta  
napisał/a:
>Below is my simple httpd.conf entry:
>
>server "www.example.com" {
>listen on * port 80
>root "/htdocs/www.example.com/"
>location "/app" {fastcgi socket "/run/gunicorn.sock"}
>}
>
>In the background gunicorn server is running. When I access
>www.example.com/app, I get 500 Internal Server Error. There is nothing
>in the httpd error log (/var/www/logs/error.log). The gunicorn server
>doesn't report any incoming request.
>Hence, I thing request breaks down in the  httpd part before
>forwarding to the request to gunicorn.
>How do I go about debugging httpd requests.  I have put "-v -d" in the
>httpd_flags in /etc/rc.conf.local but doesnt produce any additional
>log messages.
>
>
>Thanks
>-S
>

httpd is chrooted to /var/www, so your gunicorn server should listen in 
/var/www/run/gunicorn.sock instead of /run/gunicorn.sock, if you specify 
/run/gunicorn.sock in httpd.conf
--
Łukasz Moskała