Skip to content
Browse files

writing the new body can cause the response to be committed and the

request thread to return up the stack before the instance variable is
assigned.  Synchronize so that the ivar is assigned before the other
thread can activate.

fixes #10984
  • Loading branch information...
1 parent 572f9b6 commit 1b6aa27320f8ae4a34fcb5fbfb83a448449a76b5 @tenderlove tenderlove committed Jun 28, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 actionpack/lib/action_dispatch/http/response.rb
View
4 actionpack/lib/action_dispatch/http/response.rb
@@ -210,7 +210,9 @@ def body=(body)
if body.respond_to?(:to_path)
@stream = body
else
- @stream = build_buffer self, munge_body_object(body)
+ synchronize do
+ @stream = build_buffer self, munge_body_object(body)
+ end
end
end

0 comments on commit 1b6aa27

Please sign in to comment.
Something went wrong with that request. Please try again.