Send_data crashing WEBrick under specific conditions


#1

I have an action with the following view, which seems to be crashing
WEBrick.

<%= render_component :controller => ‘picture’, :action => ‘show’, :id =>
1 %>

<%= render_component :controller => ‘picture’, :action => ‘show’, :id =>
2 %>

The two components (code below) result in image tags that call an action
that returns the image data. If I remove the tag, this does not occur. Nor does it
occur if both components are given the same id argument (display the
same image).
Often the page will load the first time, but upon refresh the two images
from the component calls will not display and WEBrick will stop
responding.

The ‘show’ action:
def show
@picture_id = params[:id]
render :layout => false
end

The ‘show’ view:

The ‘picture’ action:
def picture
picture = Picture.find(params[:id])
send_data(picture.data, :filename => picture.id, :type => “image/jpeg”,
:disposition => “inline”)
end

The ‘data’ method in the Picture class
def data
Magick::Image.read(get_root + “/” + get_filename).first.to_blob
end

Does anyone have a clue as to why this may be occuring? Thanks.