# File\_column crashing WEBrick when using :magick options

**URL:** <https://www.ruby-forum.com/t/file-column-crashing-webrick-when-using-magick-options/89665>\
**Category:** Rails\
**Created:** [January 5, 2006, 1:54am UTC](https://www.ruby-forum.com/t/file-column-crashing-webrick-when-using-magick-options/89665 "2006-01-05T01:54:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rjlyders](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@rjlyders](https://www.ruby-forum.com/u/rjlyders)\
**Post date:** [January 5, 2006, 1:54am UTC](https://www.ruby-forum.com/t/file-column-crashing-webrick-when-using-magick-options/89665/1 "2006-01-05T01:54:37Z")

</div>

I’m trying to use file\_column in an app I’m writing. Simple file uploads  
are working fine.

However, when I try and use the :magick options to make resized  
versions, WEBrick dies.

This is the Media model:

class Media \< ActiveRecord::Base  
file\_column :media\_item,  
:magick =\> {  
:versions =\> {  
:thumb =\> {:size =\> “50x50”},  
:medium =\> {:size =\> “640x480”}  
}  
}  
end

This is the output from WEBrick when it dies:

script/server: No such file or directory - file -bi  
“./script/…/config/…/publi  
c/media/media\_item/tmp/1136422120.515000.5436/004.jpg”  
Output file write error — out of disk space?

There is no issue with disk space and the odd thing is it looks to have  
gotten half way through when it dies as this is the contents of the  
dirs:

E:\rails\app\_name\public\media  
-–media\_item  
-–tmp  
-–1136422120.515000.5436  
| 004.jpg  
|  
-–thumb  
004.jpg

The file itself seems to be fine. The resized thumb is at 0 bytes, so  
this is where it looks to have died when trying to write that.

RMagick itself seems to work fine on its own. I wrote a small app to  
test it and all went ok, so it would seem to be something file\_column  
related as opposed to simply RMagick itself not working.

Anyone any ideas as to how to solve this issue?

Running on Windows XP box if that makes any diff and using edge rails.

Thanks in advance.

–  
R.Livsey

> **[Livsey.org](http://livsey.org)**
>
> I’ve been using Firebase with Ember.js quite a lot recently and have just
> released Fireplace, a library to integrate the two more easily. It

---

<div class="post-metadata">

**Author:** ![rjlyders](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@rjlyders](https://www.ruby-forum.com/u/rjlyders)\
**Post date:** [January 5, 2006, 2:00am UTC](https://www.ruby-forum.com/t/file-column-crashing-webrick-when-using-magick-options/89665/2 "2006-01-05T02:00:38Z")

</div>

How come you always seem to find the answer 5 mins after hitting send!?

An earlier thread (file\_column on windows?) contains all the info  
required to fix the issue.

Sorry for the noise.

–  
R.Livsey

> **[Livsey.org](http://livsey.org)**
>
> I’ve been using Firebase with Ember.js quite a lot recently and have just
> released Fireplace, a library to integrate the two more easily. It

---

<div class="post-metadata">

**Author:** ![rjlyders](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@rjlyders](https://www.ruby-forum.com/u/rjlyders)\
**Post date:** [January 5, 2006, 2:09am UTC](https://www.ruby-forum.com/t/file-column-crashing-webrick-when-using-magick-options/89665/3 "2006-01-05T02:09:39Z")

</div>

Seems I spoke too soon when I said it was all ok.  
The comments in the earlier thread fix the issue with the ‘-file -bi’  
error, but WEBrick still dies with the following:

“Output file write error — out of disk space?”

Now I’m nowhere near short of disk space and it seems to upload the  
original file ok, as far as I can see it just dies when writing the  
resized version to disk.

Any ideas would be greatly appreciated.

Thanks in advance.

–  
R.Livsey

> **[Livsey.org](http://livsey.org)**
>
> I’ve been using Firebase with Ember.js quite a lot recently and have just
> released Fireplace, a library to integrate the two more easily. It

---

<div class="post-metadata">

**Author:** ![rjlyders](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@rjlyders](https://www.ruby-forum.com/u/rjlyders)\
**Post date:** [January 5, 2006, 2:45am UTC](https://www.ruby-forum.com/t/file-column-crashing-webrick-when-using-magick-options/89665/4 "2006-01-05T02:45:43Z")

</div>

Richard L. wrote:

> Any ideas would be greatly appreciated.
> 
> Thanks in advance.

Well I’ve fixed it now, but I’m not sure how!

I changed this line in magick\_file\_column (about 85) from:

File.open(dest\_path, “wb”, options[:permissions]) {|f| img.write f }

to

File.open(dest\_path, “wb”, options[:permissions]) {|f|  
f.write(img.to\_blob) }

And it stops dying now.

Not a clue why… but I’m leaving it and backing away slowly!

–  
R.Livsey

> **[Livsey.org](http://livsey.org)**
>
> I’ve been using Firebase with Ember.js quite a lot recently and have just
> released Fireplace, a library to integrate the two more easily. It

---

<div class="post-metadata">

**Author:** ![rjlyders](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@rjlyders](https://www.ruby-forum.com/u/rjlyders)\
**Post date:** [January 10, 2006, 9:50am UTC](https://www.ruby-forum.com/t/file-column-crashing-webrick-when-using-magick-options/89665/5 "2006-01-10T09:50:49Z")

</div>

Hi Richard,

thanks for investigating this mysterious windows crash. As I’m only  
running unix (and the problem doesn’t appear there), I’m hoping you  
can help me a bit more…

On 1/5/06, Richard L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Well I’ve fixed it now, but I’m not sure how!
> 
> I changed this line in magick\_file\_column (about 85) from:
> 
> File.open(dest\_path, “wb”, options[:permissions]) {|f| img.write f }
> 
> to
> 
> File.open(dest\_path, “wb”, options[:permissions]) {|f|  
> f.write(img.to\_blob) }

the reason I do not want to commit this is that it requires extra main  
memory as to\_blob returns the complete file as one large chunk. The  
whole thing looks like a RMagick bug to me, but let’s investigate.

Can you try to following on a (windows) ruby console?

- Load an image with RMagick
- Write it in the same way, file\_column does, e.g.  
File.open(“/some/file.jpg”, “wb”, 0644) { |f| img.write f }  
Does this crash?
- What if you leave out the 0644 parameter?

Sebastian

---

<div class="post-metadata">

**Author:** ![rjlyders](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@rjlyders](https://www.ruby-forum.com/u/rjlyders)\
**Post date:** [January 6, 2006, 2:29pm UTC](https://www.ruby-forum.com/t/file-column-crashing-webrick-when-using-magick-options/89665/6 "2006-01-06T14:29:02Z")

</div>

Richard L. wrote:

> I changed this line in magick\_file\_column (about 85) from:
> 
> File.open(dest\_path, “wb”, options[:permissions]) {|f| img.write f }

This helped me too. I am using webrick on windows xp and :magick resize  
options game me this error:

script/server: No such file or directory - file -bi  
“./script/…/config/…/public/entry/kuva/tmp/113  
6553849.406000.696/Water\_lilies.jpg”  
./script/…/config/…/vendor/plugins/file\_column/lib/magick\_file\_column.rb:85:  
[BUG] Segmentation fault  
ruby 1.8.2 (2004-12-25) [i386-mswin32]

This application has requested the Runtime to terminate it in an unusual  
way.  
Please contact the application’s support team for more information.
