Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > FSDB, Apache, FastCGI - ERROR: FSDB::Database::DirIsImmutableError

Reply
Thread Tools

FSDB, Apache, FastCGI - ERROR: FSDB::Database::DirIsImmutableError

 
 
Jonas Hartmann
Guest
Posts: n/a
 
      06-24-2005
when I run a script [1] from the command line, it works. it asks for
cgi pairs - key/value - cause it is in offline mode.

when i run it through mod_fastcgi => ruby it does not work.

a ruby script printing out the http_enviroment via FastCGI works (so
FastCGI works).

If i run the script via browser (on
http://localhost/ruby/db_connect.rb) I get the following error +
backtrace:

-- ERROR: FSDB:atabase:irIsImmutableError
-- BACKTRACE:
/fsdb/lib/fsdb/database.rb:404:in `open_write_lock
/fsdb/lib/fsdb/database.rb:620:in `[]=
/fsdb/lib/fsdb/database.rb:619:in `object_exclusive
/fsdb/lib/fsdb/database.rb:358:in `sync_object_exclusive
/fsdb/lib/fsdb/database.rb:102:in `synchronize
/fsdb/lib/fsdb/database.rb:102:in `sync_object_exclusive
/fsdb/lib/fsdb/database.rb:358:in `object_exclusive
/fsdb/lib/fsdb/database.rb:357:in `use_cache_entry
/fsdb/lib/fsdb/database.rb:357:in `object_exclusive
/fsdb/lib/fsdb/database.rb:619:in `[]=
/Library/WebServer/Documents/ruby/db_connect.rb:10/usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in
`load
/usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler

It seems to mean that I cannot change/write to the dir, right?

I have no clue what I should do about that. How can i make the script
access the dir /tmp/my-data correctly? What is causing this error?

It should just print "Hello world, and hello database!\n" (and does
that in offlinemode via "ruby db_connect.rb" + CTRL+D


[1]: http://rafb.net/paste/results/6VIFri64.html


 
Reply With Quote
 
 
 
 
Jonas Hartmann
Guest
Posts: n/a
 
      06-24-2005
The test scripts, that are supplied by FSDB throw some errors as well;
see: http://rafb.net/paste/results/9gxy2a55.html

again: how do i start debugging, whats the way to go?

Jonas


 
Reply With Quote
 
 
 
 
Ara.T.Howard
Guest
Posts: n/a
 
      06-24-2005
On Sat, 25 Jun 2005, Jonas Hartmann wrote:

> when I run a script [1] from the command line, it works. it asks for cgi
> pairs - key/value - cause it is in offline mode.
>
> when i run it through mod_fastcgi => ruby it does not work.
>
> a ruby script printing out the http_enviroment via FastCGI works (so FastCGI
> works).
>
> If i run the script via browser (on http://localhost/ruby/db_connect.rb) I
> get the following error + backtrace:
>
> -- ERROR: FSDB:atabase:irIsImmutableError
> -- BACKTRACE:
> ./fsdb/lib/fsdb/database.rb:404:in `open_write_lock
> ./fsdb/lib/fsdb/database.rb:620:in `[]=
> ./fsdb/lib/fsdb/database.rb:619:in `object_exclusive
> ./fsdb/lib/fsdb/database.rb:358:in `sync_object_exclusive
> ./fsdb/lib/fsdb/database.rb:102:in `synchronize
> ./fsdb/lib/fsdb/database.rb:102:in `sync_object_exclusive
> ./fsdb/lib/fsdb/database.rb:358:in `object_exclusive
> ./fsdb/lib/fsdb/database.rb:357:in `use_cache_entry
> ./fsdb/lib/fsdb/database.rb:357:in `object_exclusive
> ./fsdb/lib/fsdb/database.rb:619:in `[]=
> /Library/WebServer/Documents/ruby/db_connect.rb:10/usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in
> `load
> /usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler
>
> It seems to mean that I cannot change/write to the dir, right?
>
> I have no clue what I should do about that. How can i make the script access
> the dir /tmp/my-data correctly? What is causing this error?


you ran once as normal user - now user www (or whatever) can't access it.
blow away the dir and try again OR do a recursive chown of the dir to apache
as root.

>
> It should just print "Hello world, and hello database!\n" (and does that in
> offlinemode via "ruby db_connect.rb" + CTRL+D
>
>
> [1]: http://rafb.net/paste/results/6VIFri64.html
>


-a
--
================================================== =============================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| My religion is very simple. My religion is kindness.
| --Tenzin Gyatso
================================================== =============================



 
Reply With Quote
 
Joel VanderWerf
Guest
Posts: n/a
 
      06-24-2005
Jonas Hartmann wrote:
> The test scripts, that are supplied by FSDB throw some errors as well;
> see: http://rafb.net/paste/results/9gxy2a55.html
>
> again: how do i start debugging, whats the way to go?
>
> Jonas


Aside from the file ownership issue, the EISDIR is a real problem.
You're running on OS X, I see? A few months ago, a Tristan O'Tierney was
trying to run FSDB on OSX and ran into the same thing: flock() on a dir
raises EISDIR.

Here's a suggestion that seemed to solve the problem for him:

> I've never had a chance to try fsdb on darwin, but I suspect that
> there are the usual minor variations in what the file system allows
> and what errors it reports. There's already some code in fsdb to
> account for the difference between WinME, Win2K, Linux, and Solaris.
> Locking is especially hard to do portably.
>
> One thing you might try first is to use fcntl locks instead of flock.
> It's easy to switch--just create your database like this:
>
> require 'fsdb/fcntl_lock' # this will be unnnecessary in future FSDB
> versions
>
> db = FSDB:atabase.new dir, :lock_type => :fcntl_lock
>
> Whether that works or not, it's probably a good idea for me to patch
> the locking code to avoid trying to lock dirs, if that operation
> fails on darwin. Or it could just always use fcntl, if that works.
>
> The odd thing is that I don't see anything on the man pages
> (http://www.manpages.info/macosx/flock.2.html) saying that flock
> fails on dirs.


But I'm not sure that completely solved the problem, and I haven't been
able to get a darwin machine to test on. Would you mind trying the above
suggestion?

One thing to watch out for: the fcntl-lock is a C extension (code thanks
to Ara!), which is why it's not the default. But I dunno if it builds on
darwin. So, if the suggestion above doesn't work, let me know what
output you get for the config/setup process.

Thanks!


 
Reply With Quote
 
Jonas Hartmann
Guest
Posts: n/a
 
      06-25-2005
Ara.T.Howard wrote:
> On Sat, 25 Jun 2005, Jonas Hartmann wrote:
>
>> when I run a script [1] from the command line, it works. it asks for
>> cgi pairs - key/value - cause it is in offline mode.
>>
>> when i run it through mod_fastcgi => ruby it does not work.
>>
>> a ruby script printing out the http_enviroment via FastCGI works (so
>> FastCGI works).
>>
>> If i run the script via browser (on
>> http://localhost/ruby/db_connect.rb) I get the following error +
>> backtrace:
>>
>> -- ERROR: FSDB:atabase:irIsImmutableError
>> -- BACKTRACE:
>> ./fsdb/lib/fsdb/database.rb:404:in `open_write_lock
>> ./fsdb/lib/fsdb/database.rb:620:in `[]=
>> ./fsdb/lib/fsdb/database.rb:619:in `object_exclusive
>> ./fsdb/lib/fsdb/database.rb:358:in `sync_object_exclusive
>> ./fsdb/lib/fsdb/database.rb:102:in `synchronize
>> ./fsdb/lib/fsdb/database.rb:102:in `sync_object_exclusive
>> ./fsdb/lib/fsdb/database.rb:358:in `object_exclusive
>> ./fsdb/lib/fsdb/database.rb:357:in `use_cache_entry
>> ./fsdb/lib/fsdb/database.rb:357:in `object_exclusive
>> ./fsdb/lib/fsdb/database.rb:619:in `[]=
>> /Library/WebServer/Documents/ruby/db_connect.rb:10/usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in
>> `load
>> /usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler
>>
>> It seems to mean that I cannot change/write to the dir, right?
>>
>> I have no clue what I should do about that. How can i make the script
>> access the dir /tmp/my-data correctly? What is causing this error?

>
>
> you ran once as normal user - now user www (or whatever) can't access it.

to extend this case.

I can delete the temporary directories and run it via www user the
first time and the www user won't be able to access it.

To make it simple I exchanged:

db = FSDB:atabase.new('/tmp/my-data')
# notice
^
with

db = FSDB:atabase.new('tmp/my-data')

i ran it again via normal user/terminal on darwin - it again works.
then i deleted the tmp directory that had been created, and after
that ran it again via browser/webserver:

it now says:

-- ERROR: Insecure operation - directory?
-- BACKTRACE:
/usr/local/lib/ruby/1.8/ftools.rb:204:in `directory?
/usr/local/lib/ruby/1.8/ftools.rb:204:in `makedirs
/usr/local/lib/ruby/1.8/ftools.rb:202:in `each
/usr/local/lib/ruby/1.8/ftools.rb:202:in `makedirs
/usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:147:in `initialize
/Library/WebServer/Documents/ruby/db_connect.rb:8:in `new
/Library/WebServer/Documents/ruby/db_connect.rb:8/usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in
`load
/usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler

> blow away the dir

I have already tried that. gives this error:

-- ERROR: undefined method `close' for nil:NilClass
-- BACKTRACE:
/usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:318:in `inc_version_of
/usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:622:in `[]=
/usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:620:in `open_write_lock
/usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:620:in `[]=
/usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:619:in
`object_exclusive
/usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:358:in
`sync_object_exclusive
/usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:102:in `synchronize
/usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:102:in
`sync_object_exclusive
/usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:358:in
`object_exclusive
/usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:357:in `use_cache_entry
/usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:357:in
`object_exclusive
/usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:619:in `[]=
/Library/WebServer/Documents/ruby/db_connect.rb:10/usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in
`load
/usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler

> and try again OR do a recursive chown of the dir to
> apache
> as root.
>
>>
>> It should just print "Hello world, and hello database!\n" (and does
>> that in offlinemode via "ruby db_connect.rb" + CTRL+D
>>
>>
>> [1]: http://rafb.net/paste/results/6VIFri64.html
>>

>
> -a




 
Reply With Quote
 
Jonas Hartmann
Guest
Posts: n/a
 
      06-25-2005
Jonas Hartmann wrote:
> Ara.T.Howard wrote:
>
>> On Sat, 25 Jun 2005, Jonas Hartmann wrote:
>>
>>> when I run a script [1] from the command line, it works. it asks for
>>> cgi pairs - key/value - cause it is in offline mode.
>>>
>>> when i run it through mod_fastcgi => ruby it does not work.
>>>
>>> a ruby script printing out the http_enviroment via FastCGI works (so
>>> FastCGI works).
>>>
>>> If i run the script via browser (on
>>> http://localhost/ruby/db_connect.rb) I get the following error +
>>> backtrace:
>>>
>>> -- ERROR: FSDB:atabase:irIsImmutableError
>>> -- BACKTRACE:
>>> ./fsdb/lib/fsdb/database.rb:404:in `open_write_lock
>>> ./fsdb/lib/fsdb/database.rb:620:in `[]=
>>> ./fsdb/lib/fsdb/database.rb:619:in `object_exclusive
>>> ./fsdb/lib/fsdb/database.rb:358:in `sync_object_exclusive
>>> ./fsdb/lib/fsdb/database.rb:102:in `synchronize
>>> ./fsdb/lib/fsdb/database.rb:102:in `sync_object_exclusive
>>> ./fsdb/lib/fsdb/database.rb:358:in `object_exclusive
>>> ./fsdb/lib/fsdb/database.rb:357:in `use_cache_entry
>>> ./fsdb/lib/fsdb/database.rb:357:in `object_exclusive
>>> ./fsdb/lib/fsdb/database.rb:619:in `[]=
>>> /Library/WebServer/Documents/ruby/db_connect.rb:10/usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in
>>> `load
>>> /usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler
>>>
>>> It seems to mean that I cannot change/write to the dir, right?
>>>
>>> I have no clue what I should do about that. How can i make the script
>>> access the dir /tmp/my-data correctly? What is causing this error?

>>
>>
>>
>> you ran once as normal user - now user www (or whatever) can't access it.

>
> to extend this case.
>
> I can delete the temporary directories and run it via www user the first
> time and the www user won't be able to access it.
>
> To make it simple I exchanged:
>
> db = FSDB:atabase.new('/tmp/my-data')
> # notice
> ^
> with
>
> db = FSDB:atabase.new('tmp/my-data')
>
> i ran it again via normal user/terminal on darwin - it again works.
> then i deleted the tmp directory that had been created, and after that
> ran it again via browser/webserver:
>
> it now says:
>
> -- ERROR: Insecure operation - directory?
> -- BACKTRACE:
> /usr/local/lib/ruby/1.8/ftools.rb:204:in `directory?
> /usr/local/lib/ruby/1.8/ftools.rb:204:in `makedirs
> /usr/local/lib/ruby/1.8/ftools.rb:202:in `each
> /usr/local/lib/ruby/1.8/ftools.rb:202:in `makedirs
> /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:147:in `initialize
> /Library/WebServer/Documents/ruby/db_connect.rb:8:in `new
> /Library/WebServer/Documents/ruby/db_connect.rb:8/usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in
> `load
> /usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler
>
>> blow away the dir

>
> I have already tried that. gives this error:
>
> -- ERROR: undefined method `close' for nil:NilClass
> -- BACKTRACE:
> /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:318:in `inc_version_of
> /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:622:in `[]=
> /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:620:in `open_write_lock
> /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:620:in `[]=
> /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:619:in `object_exclusive
> /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:358:in
> `sync_object_exclusive
> /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:102:in `synchronize
> /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:102:in
> `sync_object_exclusive
> /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:358:in `object_exclusive
> /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:357:in `use_cache_entry
> /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:357:in `object_exclusive
> /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:619:in `[]=
> /Library/WebServer/Documents/ruby/db_connect.rb:10/usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in
> `load
> /usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler
>
>> and try again OR do a recursive chown of the dir to apache
>> as root.
>>
>>>
>>> It should just print "Hello world, and hello database!\n" (and does
>>> that in offlinemode via "ruby db_connect.rb" + CTRL+D
>>>
>>>
>>> [1]: http://rafb.net/paste/results/6VIFri64.html
>>>

>>
>> -a


besides that: all directories are being created as told (but that
process thows a lot of errors by calling via terminal).

besides all that I notice that the file: "..fsdb.meta.myself" is not
beeing created by the www call of the script, while it is being
created by the non terminal call/user call. atleast the file "myself"
is beeing created in both cases, holding the data inserted in both cases.


 
Reply With Quote
 
Jonas Hartmann
Guest
Posts: n/a
 
      06-25-2005
Joel VanderWerf wrote:
> Jonas Hartmann wrote:
>
>> The test scripts, that are supplied by FSDB throw some errors as well;
>> see: http://rafb.net/paste/results/9gxy2a55.html
>>
>> again: how do i start debugging, whats the way to go?
>>
>> Jonas

>
>
> Aside from the file ownership issue, the EISDIR is a real problem.
> You're running on OS X, I see? A few months ago, a Tristan O'Tierney was
> trying to run FSDB on OSX and ran into the same thing: flock() on a dir
> raises EISDIR.
>
> Here's a suggestion that seemed to solve the problem for him:
>
>> I've never had a chance to try fsdb on darwin, but I suspect that
>> there are the usual minor variations in what the file system allows
>> and what errors it reports. There's already some code in fsdb to
>> account for the difference between WinME, Win2K, Linux, and Solaris.
>> Locking is especially hard to do portably.
>>
>> One thing you might try first is to use fcntl locks instead of flock.
>> It's easy to switch--just create your database like this:
>>
>> require 'fsdb/fcntl_lock' # this will be unnnecessary in future FSDB
>> versions
>>
>> db = FSDB:atabase.new dir, :lock_type => :fcntl_lock
>>
>> Whether that works or not, it's probably a good idea for me to patch
>> the locking code to avoid trying to lock dirs, if that operation
>> fails on darwin. Or it could just always use fcntl, if that works.
>>
>> The odd thing is that I don't see anything on the man pages
>> (http://www.manpages.info/macosx/flock.2.html) saying that flock
>> fails on dirs.

>
>
> But I'm not sure that completely solved the problem, and I haven't been
> able to get a darwin machine to test on. Would you mind trying the above
> suggestion?
>
> One thing to watch out for: the fcntl-lock is a C extension (code thanks
> to Ara!), which is why it's not the default. But I dunno if it builds on
> darwin. So, if the suggestion above doesn't work, let me know what
> output you get for the config/setup process.
>
> Thanks!


Warning: I have no clue how to use C-Extensions in ruby. I did not
plan to do so soon ;-(.

I have modified the code in my "db_connect.rb" (within that folder
there is a fsdb folder that holds the complete fsdb 0.4 directory as
in previous examples)

$LOAD_PATH.insert(-1, "./fsdb/lib")
require 'fsdb.rb'
require 'fsdb/ext/fsdb/fcntl_lock' # this will be unnnecessary in
# future FSDB versions

db = FSDB:atabase.new('tmp/my-data', :lock_type => :fcntl_lock)
# added ^^^^^^^^^^^^^^^^^^^^^^^^^^^

I don't know if I did that right... it throws no error on terminal.
But it does throw one via www user:

-- ERROR: Insecure operation - directory?
-- BACKTRACE:
/usr/local/lib/ruby/1.8/ftools.rb:204:in `directory?
/usr/local/lib/ruby/1.8/ftools.rb:204:in `makedirs
/usr/local/lib/ruby/1.8/ftools.rb:202:in `each
/usr/local/lib/ruby/1.8/ftools.rb:202:in `makedirs
/usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:147:in `initialize
/Library/WebServer/Documents/ruby/db_connect.rb:9:in `new
/Library/WebServer/Documents/ruby/db_connect.rb:9/usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in
`load
/usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
fastcgi: how to accept HTTP requests, and return a result thorley@gmail.com Python 0 07-06-2006 03:55 PM
Attempting to get lighttpd, fastcgi & python working venkatbo@yahoo.com Python 0 03-24-2006 07:34 PM
fastcgi jason_ Python 0 04-06-2005 05:50 AM
how to run FastCGI on IIS and Apachi? JeffLiu Python 0 07-12-2004 02:56 AM
running fastcgi on windows? wolf Python 1 02-21-2004 04:23 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57