Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send_response intermittent failure #34

Open
catmando opened this issue Mar 11, 2016 · 2 comments
Open

send_response intermittent failure #34

catmando opened this issue Mar 11, 2016 · 2 comments

Comments

@catmando
Copy link

The puffing billy gem is using evma_httpserver to simulate responses to javascript clients.

Intermittently a response is not getting back to the browser.

The puffing billy code (monkey patched to provide logging looks like this:)

Billy::ProxyConnection.send(:define_method, :send_response) do |response|
  Billy.log(:info, "puffing-billing: send_response #{response[:status]}, #{response[:headers]}, '#{response[:content][0..10]}'")
  res = EM::DelegatedHttpResponse.new(self)
  res.status = response[:status]
  res.headers = response[:headers]
  res.content = response[:content]
  res.send_response
  Billy.log(:info, "puffing-billing: send_response SENT!")
end

In the resulting log I see this:

puffing-billing: send_response 200, {"Content-Type"=>"application/javascript;charset=utf-8", "Connection"=>"close", "Status"=>"200", "X-Powered-By"=>"Phusion Passenger (mod_rails/mod_rack) 3.0.11", "Content-Length"=>"1708", "Server"=>"nginx/1.0.14 + Phusion Passenger 3.0.11 (mod_rails/mod_rack)"}, 'jQuery11200'
puffing-billing: send_response SENT!

but the browser log looks like this:

screen shot 2016-03-11 at 3 03 14 pm

This happens about 25 % of the time. When the response is successful everything looks exactly the same except in the browser net log I see 200 ... and 1708 bytes received.

The problem is NOT browser specific. I have tried the same scenario using poltergeist, with the same results.

It would be very difficult to get this into an isolated test case that I could share, but I would be happy to add logging to evma_httpserver, if I could have some clues WHAT to investigate. Also would be happy to set up a co-debug session on cloud9.

@catmando
Copy link
Author

Turns out this was a problem inside of puffing billy. BUT in case anybody cares the problem was that the Content-Length header was being supplied, but had a different value than the actual Content-Length. Not sure whether this broke evma_httpserver, EM, or both firefox/poltergeist, but at any rate simply removing the Content-Length header (and I guess letting evma_httpserver compute it) fixed the problem.

@mackermans
Copy link

Hey @catmando, looks like you had the same issue as I had. Check out this PR oesmith/puffing-billy#162

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants