You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Datastore: does not work inside Puma webserver #691
Would be good to receive independent confirmation, but from what I can tell is that Datastore queries hang if run inside Puma webserver. Same query runs fine from rails console process. Worker processes running other queries/inserts also look to be running ok. All environment is the same.
Web process just hangs when calling dataset.run(query)
@timanovsky I don't know what this is about. I'll investigate. What size are your dynos? How many threads are you running on each one? How many dynos are you running?
@timanovsky Is there anything interesting in the logs before the process hangs? Feel free to email me a private gist if you don't want to share publicly.
I don't recognize this specific problem. It would help to have more information. If you run with the environment variable GRPC_TRACE=all, it will output a bunch of log information that might contain something useful (make sure to remove private information).
The problem could be a bug in the gRPC client, or it could be that the server is not responding properly.
What I see happening in that log is: grpc connects to the server, completes a TLS handshake, and starts initializing an HTTP2 stream. And then it suddenly stops, and ~20 seconds later, Heroku kills it. Unfortunately, I don't recognize that failure case.
Can you open a bug against grpc (https://github.com/grpc/grpc) including that trace and a description of how you encountered the error?
OK, will do. @blowmage the gcloud-ruby gcloud.gemspec lists "grpc", "~> 0.13.1". It looks like the current version is 0.14.1. Any chance this has already been fixed?
@timanovsky Are you able to connect to an actual datastore while running Puma locally? If I run Puma localhost and connect to the datastore emulator it is fine but if I run Puma localhost and connect to my actual datastore it hangs with: D0512 21:17:47.508334000 123145307635712 chttp2_transport.c:698] got goaway [0]: 73 65 73 73 69 6f 6e 5f 74 69 6d 65 64 5f 6f 75 74 'session_timed_out'
@blowmage Unfortunately Puma still hangs. I tried your branch as follows: gem 'gcloud', :git => 'https://github.com/blowmage/gcloud-ruby.git', :branch => 'grpc-0.15'
I ran bundle install and verified that I was now using grpc (0.15.0 universal-darwin).
I moved the require 'gcloud/datastore' back to the top of the Rails CloudDatastore initializer.
I ran my app with rails s -e production connected to an actual cloud datastore.
It still hangs.
Hello, any updates on this? Unfortunately I have to require "gcloud/datastore" at the top, as I have several functions which do not need dataset object, but work with objects likeGcloud::Datastore::Key. It would be a mess to change all such functions to require "gcloud/datastore"inside.
Can you take a look at #875? I think it might help remove the need for const_missing hacks. It should even allow you to create a Google::Cloud::Datastore::Dataset object in an initializer as long as you don't make any API calls with it before Puma forks the sub-processes.
Activity
timanovsky commentedon May 12, 2016
Actually same Puma server runs fine on localhost. The problem only manifests on Heroku, in web Dyno, and only using v1beta3 API. Weird
blowmage commentedon May 12, 2016
@timanovsky I don't know what this is about. I'll investigate. What size are your dynos? How many threads are you running on each one? How many dynos are you running?
timanovsky commentedon May 12, 2016
This is scary: grpc/grpc#6278
blowmage commentedon May 12, 2016
@timanovsky Is there anything interesting in the logs before the process hangs? Feel free to email me a private gist if you don't want to share publicly.
bmclean commentedon May 12, 2016
@blowmage Unfortunately I can reproduce this as well on 1 standard professional dyno.
Puma config:
threads_count = 5
workers = 2
preload_app!
Heroku logs:
blowmage commentedon May 12, 2016
@murgatroid99 @nicolasnoble Sorry to pull you guys in on this, but do you have any insight on why the GRPC client would hang on Heroku?
murgatroid99 commentedon May 12, 2016
I don't recognize this specific problem. It would help to have more information. If you run with the environment variable
GRPC_TRACE=all, it will output a bunch of log information that might contain something useful (make sure to remove private information).The problem could be a bug in the gRPC client, or it could be that the server is not responding properly.
bmclean commentedon May 12, 2016
@murgatroid99 I added the environment variable
GRPC_TRACE=alland the output is captured here.murgatroid99 commentedon May 12, 2016
What I see happening in that log is: grpc connects to the server, completes a TLS handshake, and starts initializing an HTTP2 stream. And then it suddenly stops, and ~20 seconds later, Heroku kills it. Unfortunately, I don't recognize that failure case.
Can you open a bug against grpc (https://github.com/grpc/grpc) including that trace and a description of how you encountered the error?
blowmage commentedon May 12, 2016
Thanks for your help @murgatroid99!
bmclean commentedon May 13, 2016
OK, will do. @blowmage the gcloud-ruby gcloud.gemspec lists
"grpc", "~> 0.13.1". It looks like the current version is 0.14.1. Any chance this has already been fixed?blowmage commentedon May 13, 2016
@bmclean We'd like to bump the dependency, but we have an open issue that is blocking us from doing that.
bmclean commentedon May 13, 2016
@timanovsky Are you able to connect to an actual datastore while running Puma locally? If I run Puma localhost and connect to the datastore emulator it is fine but if I run Puma localhost and connect to my actual datastore it hangs with:
D0512 21:17:47.508334000 123145307635712 chttp2_transport.c:698] got goaway [0]: 73 65 73 73 69 6f 6e 5f 74 69 6d 65 64 5f 6f 75 74 'session_timed_out'timanovsky commentedon May 13, 2016
Yes, from local puma with same settings it works. This is Linux VM though.
On 13 May 2016 6:11 am, "Bryce McLean" notifications@github.com wrote:
timanovsky commentedon May 13, 2016
Btw those
got goawaylog messages are pretty frequent even in normally working processes (local, or non-puma).17 remaining items
bmclean commentedon Jun 30, 2016
@blowmage Unfortunately Puma still hangs. I tried your branch as follows:
gem 'gcloud', :git => 'https://github.com/blowmage/gcloud-ruby.git', :branch => 'grpc-0.15'I ran bundle install and verified that I was now using grpc (0.15.0 universal-darwin).
I moved the
require 'gcloud/datastore'back to the top of the Rails CloudDatastore initializer.I ran my app with
rails s -e productionconnected to an actual cloud datastore.It still hangs.
timanovsky commentedon Jul 22, 2016
Hello, any updates on this? Unfortunately I have to
require "gcloud/datastore"at the top, as I have several functions which do not need dataset object, but work with objects likeGcloud::Datastore::Key. It would be a mess to change all such functions torequire "gcloud/datastore"inside.Update workaround for those with similar problem:
blowmage commentedon Aug 29, 2016
Does the 0.20.0 release using grpc 1.0 change this at all?
bmclean commentedon Aug 30, 2016
@blowmage No, the problem still exists with 0.20.0.
blowmage commentedon Sep 1, 2016
Can you take a look at #875? I think it might help remove the need for
const_missinghacks. It should even allow you to create aGoogle::Cloud::Datastore::Datasetobject in an initializer as long as you don't make any API calls with it before Puma forks the sub-processes.bmclean commentedon Sep 1, 2016
@blowmage Sure, I will give it a try.
bmclean commentedon Sep 1, 2016
@blowmage I tried your branch:
:git => 'https://github.com/blowmage/gcloud-ruby.git', :branch => 'grpc-delay-require'Using an initializer like this:
and Puma works fine configured with 2 workers.
blowmage commentedon Sep 2, 2016
Great. Thank you!
quartzmo commentedon Sep 7, 2016
Does the 0.20.1 release (with PR #875) resolve this issue?
bmclean commentedon Sep 8, 2016
Yes.
quartzmo commentedon Sep 9, 2016
@timanovsky Can you confirm 0.20.1 release (with PR #875) as a fix?
timanovsky commentedon Sep 9, 2016
Seems to work, thanks for fixing this!
fix!: handle GCP enum name start with uppercase IPProtocol (#691)