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

olive_branch fails silently when combined with ActionController::Live #15

Open
patrickvinograd opened this issue May 9, 2017 · 1 comment

Comments

@patrickvinograd
Copy link

In a project that was using olive_branch for its JSON API responses, I implemented a controller that involved streaming large PDF content, and used ActionController::Live to implement the streaming in the controller's #show method. The #show method worked fine, since olive_branch ignored the non-JSON content-type.

However, this controller had another method that returned JSON content and so olive_branch would coerce the content of the response. If I pass an x-key-inflection header to this method, it fails - response headers come back, but no response body. No error/stack trace is generated. And, the rails connection/thread hangs - if I generate enough of these responses eventually I'll start getting ActiveRecord connection pool exhaustion because resources are not getting released.

It makes sense that olive_branch can't replace the response body because if it's being streamed, it will not have access to the entire response, only a chunk at a time. And ActionController::Live marks the response as committed as soon as the first byte is written. But, the failure mode is very pernicious and hard to diagnose.

@efatsi
Copy link
Contributor

efatsi commented May 10, 2017

Interesting scenario. I've never worked with ActionController::Live so not sure I'll have much to contribute here. Did you happen to have any particular thoughts on how olive_branch should behave in this use case?

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