question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Empty reply from server

See original GitHub issue

I’m trying to run the gateway in a Docker container, following the instructions in the Dockerfile itself. I’ve pulled the repo down, and here the relevant excerpt from my Compose file.

  grpc-web:
    build:
      context: grpc-web
      dockerfile: net/grpc/gateway/docker/ubuntu_16_04/Dockerfile
    ports:
      - "9091:9091"
    links:
      - app-server:localhost
    command: sh -c "cd /github/grpc-web/gConnector && ./nginx.sh"

When the container starts, I get the following output:

grpc-web_1      | nginx: [alert] could not open error log file: open() "./logs/error.log" failed (2: No such file or directory)
grpc-web_1      | 2018/02/27 22:07:58 [notice] 7#0: using the "epoll" event method
grpc-web_1      | 2018/02/27 22:07:58 [notice] 7#0: nginx/1.11.13
grpc-web_1      | 2018/02/27 22:07:58 [notice] 7#0: built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 
grpc-web_1      | 2018/02/27 22:07:58 [notice] 7#0: OS: Linux 4.9.60-linuxkit-aufs
grpc-web_1      | 2018/02/27 22:07:58 [notice] 7#0: getrlimit(RLIMIT_NOFILE): 1048576:1048576
grpc-web_1      | I0227 22:07:58.939213904       7 grpc_event_queue.cc:44]     GRPC event thread started: 1

But when I make a request like this:

$ curl 'http://localhost:9091/helloworld.Greeter/SayHello' -H 'content-type: application/grpc-web+proto' -H 'x-grpc-web: 1' -H 'authority: localhost:9091' --data-binary $'\x00\x00\x00\x00\x04\n\x02yo' --insecure -v
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9091 (#0)
> POST /helloworld.Greeter/SayHello HTTP/1.1
> Host: localhost:9091
> User-Agent: curl/7.54.0
> Accept: */*
> content-type: application/grpc-web+proto
> x-grpc-web: 1
> authority: localhost:9091
> Content-Length: 0
> 
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server

As you can see, I get no response. And nothing shows up in the console. My gRPC server is running and listening on port 9090. Is there an issue with my config?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15

github_iconTop GitHub Comments

1reaction
jonahbroncommented, Feb 28, 2018

@fengli79 That makes sense. I think this has to do with bash strings using null bytes as the ending character.

https://unix.stackexchange.com/questions/174016/how-do-i-use-null-bytes-in-bash

I found a workaround in bash to avoid ever storing the request body in a bash string:

printf '\x00\x00\x00\x00\x04\n\x02yo' | curl -skv 'http://localhost:9091/helloworld.Greeter/SayHello' -H 'content-type: application/grpc-web+proto' -H 'x-grpc-web: 1' -H 'authority: localhost:9091' -H 'accept: application/grpc-web-text' --data-binary @- | base64 --decode
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9091 (#0)
> POST /helloworld.Greeter/SayHello HTTP/1.1
> Host: localhost:9091
> User-Agent: curl/7.54.0
> content-type: application/grpc-web+proto
> x-grpc-web: 1
> authority: localhost:9091
> accept: application/grpc-web-text
> Content-Length: 9
> 
} [9 bytes data]
* upload completely sent off: 9 out of 9 bytes
< HTTP/1.1 200 OK
< Server: nginx/1.11.13
< Date: Wed, 28 Feb 2018 19:35:41 GMT
< Transfer-Encoding: chunked
< Connection: keep-alive
< content-type: application/grpc-web-text
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: GET, POST, OPTIONS
< Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Transfer-Encoding,Custom-Header-1,X-Accept-Content-Transfer-Encoding,X-Accept-Response-Streaming
< Access-Control-Expose-Headers: Content-Transfer-Encoding
< 
{ [151 bytes data]
* Connection #0 to host localhost left intact
?bgrpc-status: 13
grpc-message: Receiving initial metadata for GRPC response from backend failed.

I’m still not getting any console output from my backend server, so it seems like the gateway isn’t talking to it.

0reactions
jonahbroncommented, Mar 2, 2018

@stanley-cheung PR #155 added, thanks very much.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the curl error 52 "empty reply from server"?
This is likely the wrong approach to troubleshooting. Empty reply means it was able to connect to the IP/port, but the server returned...
Read more >
What does "empty reply from server" mean? - HTTP Request
The "empty reply from server" error indicates that a zero length response was received - no HTTP headers or content, simply a closed...
Read more >
cURL error 52: Empty reply from server - WordPress.org
The underlying problem could be one of a number of server issues. Perhaps the server is configured to not respond to loopback requests,...
Read more >
How to troubleshoot connectivity when curl gets an *empty ...
One possible reason you are getting an empty reply is that you're trying to hit a website that is a name-based virtual host....
Read more >
T2499E - Empty reply from server - Amcrest Forum
It seems to work most all the time using a browser UI. But using the android app, it fails to connect about half...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found