You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2019/06/13 18:51:12 UTC

[Bug 63502] New: unable to proxy grpc over http2 proxy

https://bz.apache.org/bugzilla/show_bug.cgi?id=63502

            Bug ID: 63502
           Summary: unable to proxy grpc over http2 proxy
           Product: Apache httpd-2
           Version: 2.5-HEAD
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_proxy_http2
          Assignee: bugs@httpd.apache.org
          Reporter: jnshapiro@gmail.com
  Target Milestone: ---

I am unable to proxy a basic GRPC connection over mod_proxy_http2.  It appears
that the trailers are not being processed correctly.

Steps to reproduce:
apt-get install wget gcc make libpcre3 libpcre3-dev libexpat1-dev
libnghttp2-dev python3-pip

wget https://www-us.apache.org/dist//httpd/httpd-2.4.39.tar.bz2
wget http://us.mirrors.quenda.co/apache//apr/apr-1.7.0.tar.gz
wget https://www-eu.apache.org/dist//apr/apr-util-1.6.1.tar.gz

copy tarballs to the correct locations and build:

./configure --with-included-apr --with-included-apr-util --enable-proxy-http2
--enable-http2
make
make install

Adjust httpd.conf:
uncomment loadmodule lines for proxy_mod, proxy_http2 http2
add
<VirtualHost _default_:80>
    Protocols h2, h2c
    ProxyPass / h2c://localhost:50051/ retry=0
    ProxyPassReverse / http://localhost:50051/
    ProxyPreserveHost On
    ProxyTimeout 300
</VirtualHost>

Grab grpc hello world:
git clone -b v1.21.0 https://github.com/grpc/grpc
cd grpc/examples/python/hello_world
pip3 install grpcio-tools

Run the server
python3 ./greeter_server.py

Run the client.  It connects to the server over port 50051:
root@3e7ec5d04e27:~/grpc/examples/python/helloworld# python3 greeter_client.py 
Greeter client received: Hello, you!

Edit the client to go over port 80 and rerun:
root@3e7ec5d04e27:~/grpc/examples/python/helloworld# python3 greeter_client.py 
Traceback (most recent call last):
  File "greeter_client.py", line 37, in <module>
    run()
  File "greeter_client.py", line 31, in run
    response = stub.SayHello(helloworld_pb2.HelloRequest(name='you'))
  File "/usr/local/lib/python3.6/dist-packages/grpc/_channel.py", line 565, in
__call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/usr/local/lib/python3.6/dist-packages/grpc/_channel.py", line 467, in
_end_unary_response_blocking
    raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
        status = StatusCode.UNKNOWN
        details = "No status received"
        debug_error_string =
"{"created":"@1560450549.495326381","description":"No status
received","file":"src/core/lib/surface/call.cc","file_line":1071,"grpc_status":2}"
>

You can enable logging on the server or client with the following environment
variables:
export GRPC_TRACE=all
export GRPC_VERBOSITY=DEBUG

server logs show it sending the status as trailers:
I0613 18:36:59.293037496   10850 chttp2_transport.cc:1382]   HTTP:1:HDR:SVR:
:status: 200^M
I0613 18:36:59.293041486   10850 chttp2_transport.cc:1382]   HTTP:1:HDR:SVR:
content-type: application/grpc^M
I0613 18:36:59.293046051   10850 chttp2_transport.cc:1382]   HTTP:1:HDR:SVR:
grpc-accept-encoding: identity,deflate,gzip^M
I0613 18:36:59.293050928   10850 chttp2_transport.cc:1382]   HTTP:1:HDR:SVR:
accept-encoding: identity,gzip^M
I0613 18:36:59.293055675   10850 chttp2_transport.cc:1382]   HTTP:1:TRL:SVR:
grpc-status: 0^M
I0613 18:36:59.293060232   10850 chttp2_transport.cc:1382]   HTTP:1:TRL:SVR:
grpc-message: ^M

But the apache proxy logs appear to interpret the status as a header:
[Thu Jun 13 18:33:58.956805 2019] [proxy_http2:trace2] [pid 10617:tid
140426773894912] h2_proxy_session.c(311): [remote 127.0.0.1:50051]
h2_proxy_stream(128-1-1): got header Grpc-Status: 0
[Thu Jun 13 18:33:58.956810 2019] [proxy_http2:trace2] [pid 10617:tid
140426773894912] h2_proxy_session.c(311): [remote 127.0.0.1:50051]
h2_proxy_stream(128-1-1): got header Grpc-Message:

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 63502] unable to proxy grpc over http2 proxy

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63502

Stefan Eissing <st...@eissing.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Stefan Eissing <st...@eissing.org> ---
There is no planned release date yet. I hope that we can do one rather soon,
but cannot promise.

If you need something with a "released" stamp on it, you can grab the mod-h2
module at github. The latest release there contains the fix.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 63502] unable to proxy grpc over http2 proxy

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63502

jnshapiro@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|Mac OS X 10.1               |Linux

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 63502] unable to proxy grpc over http2 proxy

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63502

Christophe JAILLET <ch...@wanadoo.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 63502] unable to proxy grpc over http2 proxy

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63502

--- Comment #2 from jnshapiro@gmail.com ---
Yes, I can confirm this works for me.  Thanks for the quick turnaround.  Is
there a planned date for the 2.4.40 release?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 63502] unable to proxy grpc over http2 proxy

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63502

Stefan Eissing <st...@eissing.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Stefan Eissing <st...@eissing.org> ---
Thanks for the detailed instructions in how to reproduce.

Could you try r1861339 which I just merged into branches/2.4.x. This solves the
issue in my tests. Please let me know if this works for you as well.

Thanks a lot!

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org