Hi,
I have added a service broker to cloudfoundry,but a exception raised when i was trying to create a service with the broker. It tell that:
CFoudry::BadResponse: 502: 502 Bad Gateway: Registered ednpoint failed to handle the request.
In my opinion, it shoud be a timeout exception. When CFoundry send a PUT requet to cc,it will wait a response in a default time(60s?). But it will take a few minutes to the creation which may lead to the exception. So does cc(sends a PUT request to service broker).
Then i try to increase the waitint time by modifying the read_timeout:
~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/cfoundry-4.6.1/lib/cfoundry/rest_client.rb #request_uri
http = HTTPFactory.create(uri, proxy_options_for(uri))
# TODO remove this when staging returns streaming responses
http.read_timeout = 10*60
http.open_timeout = 60
before = Time.now
http.start do
response = http.request(request)
time = Time.now - before
and /var/vcap/packages/cloud_controller_ng/cloud_controller_ng/app/models/services/service_broker/v2/http_client.rb #
begin
req_class = method.to_s.capitalize
req = Net::HTTP.const_get(req_class).new(uri.request_uri)
req.basic_auth(auth_username, auth_password)
req.body = body
req.content_type = 'application/json'
req[VCAP::Request::HEADER_NAME] = VCAP::Request.current_id
req['Accept'] = 'application/json'
logger.debug "Sending #{req_class} to #{uri}, BODY: #{req.body}, HEADERS: #{req.to_hash.inspect}"
response = Net::HTTP.start(uri.hostname, uri.port) do |http|
# TODO: make this configurable?
http.open_timeout = 60
http.read_timeout = 10*60
#http.continue_timeout = 90
http.request(req)
end
But it seems like that it only makes sense to cc, and the CFoundry raises the exception again. The difference is that the creation of service is finished, i can see the service by cf services.
So,what's the problem and what should i do?
Any reply is appreciated. Thanks!