Apache 2 & global variables question

P

Pascal Meunier

In Ruby under Apache 2 threads, is a global variable global to all instances
of scripts simultaneously?

I'm asking because this is the only way I've found to (partially) explain
some disturbing behavior when running our Ruby scripts under Apache.
Yesterday I made a post regarding some problems I had with the value of a
global variable. This morning this problem didn't happen anymore, no matter
what I tried. That is, until I started executing identical copies of the
scripts from two different locations. Then the same behavior and errors
re-appeared! Yesterday, someone else was working on his own cvs-checked out
copy of the scripts at the same time I was. This morning I was alone
working on the scripts. With two copies running at once, each setting
different values for the global variable, we were seeing strange things. It
still doesn't explain everything we saw, but it would start making some
sense.

Thanks,
Pascal
 
A

Ara.T.Howard

Or is it that Ruby 1.8.2 isn't compatible with Apache 2?

are you using mod_ruby or fastcgi?

-a
--
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| Your life dwells amoung the causes of death
| Like a lamp standing in a strong breeze. --Nagarjuna
===============================================================================
 
P

Pascal Meunier

are you using mod_ruby or fastcgi?

Neither. Just "#!/usr/bin/ruby -w" at the beginning of each script. Speed
is not important; correctness is.


Thanks,
Pascal
 
A

Ara.T.Howard

Neither. Just "#!/usr/bin/ruby -w" at the beginning of each script. Speed
is not important; correctness is.

then apache2 has noting to do with it.

i looked at your post about $load_path the other day and thought it odd. can
you post all the code (the loaded files too) - preferably reducing them to the
smallest possible tloc that exhibits the problem. it's clearly an issue in
the scripts and their use of $load_path.

cheers.
Thanks,
Pascal

-a
--
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| Your life dwells amoung the causes of death
| Like a lamp standing in a strong breeze. --Nagarjuna
===============================================================================
 
P

Pascal Meunier

then apache2 has noting to do with it.

i looked at your post about $load_path the other day and thought it odd. can
you post all the code (the loaded files too) - preferably reducing them to the
smallest possible tloc that exhibits the problem. it's clearly an issue in
the scripts and their use of $load_path.

cheers.

I tried reducing the scripts as you suggested, but here's what happens.
Almost any change I make to the script removes the error "string contains
null byte (ArgumentError)". Irrelevant changes in the main script, long
after all the load statements, make the load error go away. If I change the
first line to "#!/usr/bin/ruby", removing the "-w" option, the *error* (not
a warning) goes away. How could not printing warnings remove an error? The
error doesn't happen if I build up an example from scratch, instead of
reducing, until I have the same script again. I have many other scripts
doing similar load operations using $load_path without errors, at the very
time this script fails. My head hurts.

I am hesitant to post all the scripts involved because there are a lot.
Perhaps I could email them directly to you or anyone interested to avoid
generating too much noise on this list. Such a peculiar and brittle
situation is probably not of interest to many.

Thanks,
Pascal
 
A

Ara.T.Howard

I tried reducing the scripts as you suggested, but here's what happens.
Almost any change I make to the script removes the error "string contains
null byte (ArgumentError)". Irrelevant changes in the main script, long
after all the load statements, make the load error go away. If I change the
first line to "#!/usr/bin/ruby", removing the "-w" option, the *error* (not
a warning) goes away. How could not printing warnings remove an error? The
error doesn't happen if I build up an example from scratch, instead of
reducing, until I have the same script again. I have many other scripts
doing similar load operations using $load_path without errors, at the very
time this script fails. My head hurts.

I am hesitant to post all the scripts involved because there are a lot.
Perhaps I could email them directly to you or anyone interested to avoid
generating too much noise on this list. Such a peculiar and brittle
situation is probably not of interest to many.

post them online perhaps - the more eyes the better.

regards.

-a
--
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| Your life dwells amoung the causes of death
| Like a lamp standing in a strong breeze. --Nagarjuna
===============================================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,968
Members
47,524
Latest member
ecomwebdesign

Latest Threads

Top