Re: [Mongrel] mongrel thread safety and global variables

2006-09-04 Thread hemant
Well, I think i have figured out the problem with my code (*but i am not entirely sure..so please correct me if i am wrong)If you look at above code, then you will see:  begin   timeout(6) do     # read from socket   end rescue Timeout::Error  # error handling endMy assertion says, sometimes for ce

Re: [Mongrel] mongrel thread safety and global variables

2006-09-02 Thread Zed Shaw
On Sat, 2006-09-02 at 17:00 +0530, hemant wrote: > Yes...its a multithreaded and supposed to server request flawlessly. > > BTW, as a quick check...i wrote a ruby program to fetch data for some > 1 iterations and and append it to a CSV file...and didn't get a > single data mangling error. >

Re: [Mongrel] mongrel thread safety and global variables

2006-09-02 Thread hemant
Yes...its a multithreaded and supposed to server request flawlessly.   BTW, as a  quick check...i wrote a ruby program to fetch data for some 1 iterations and and append it to a CSV file...and didn't get a single data mangling error.   Next step, I will try 100 simultaneous threads, fetching th

Re: [Mongrel] mongrel thread safety and global variables

2006-09-01 Thread Luis Lavena
On 9/1/06, hemant <[EMAIL PROTECTED]> wrote: > > We initially chose UNIXSocket over TCPSockets, because of performance > reasons. > > As it turns out, its not so scalabale..so we may scrap it. Ok, is your UNIXServer implemented in a multithread fashion? (so it could hadle multiple clients to conne

Re: [Mongrel] mongrel thread safety and global variables

2006-09-01 Thread hemant
We initially chose UNIXSocket over TCPSockets, because of performance reasons.   As it turns out, its not so scalabale..so we may scrap it.  On 9/2/06, Luis Lavena <[EMAIL PROTECTED]> wrote: On 9/1/06, hemant <[EMAIL PROTECTED]> wrote:[snip] > So, can't be a issue with my ConnectionClass, right?>>

Re: [Mongrel] mongrel thread safety and global variables

2006-09-01 Thread Luis Lavena
On 9/1/06, hemant <[EMAIL PROTECTED]> wrote: [snip] > So, can't be a issue with my ConnectionClass, right? > > Basically this UNIXSocket that i connect(sorry for confusion, its actually a > UNIXSocket ) , is a proxy between actual data vending servers and rails.It > serves multiple clients(not only

Re: [Mongrel] mongrel thread safety and global variables

2006-09-01 Thread hemant
Well, Mongrel locks Rails with a Sync (Mutex caused leaks on someplatforms) so there should be only one user of your global variable at any one time.  Also, the threads aren't using your global after therequest is finished and the lock is released since rails is donedispatching.But, if you're runni

Re: [Mongrel] mongrel thread safety and global variables

2006-09-01 Thread Zed Shaw
On Fri, 2006-09-01 at 17:36 +0530, hemant wrote: > > In environment.rb file, I initialize a connection to some data vending > servers, through TCP sockets. > > As i know, mongrel serves requests on new threads, so what happens to > this global variable that is shared among the threads.Is there

Re: [Mongrel] mongrel thread safety and global variables

2006-09-01 Thread hemant
Will, mutex solve the problem?I tried using them and seem to work.But as i said, the problem occurs very less often.There is another problem, if i use Mutex to synchronize, calls, then some calls would take long and time and some would return immediately.so, a request that takes long time, will bl

Re: [Mongrel] mongrel thread safety and global variables

2006-09-01 Thread hemant
On 9/1/06, hemant <[EMAIL PROTECTED]> wrote: In environment.rb file, I initialize a connection to some data vending servers, through TCP sockets.The connection object is global and hence the code: #environment.rb$generic_connection = ConnectionClass.instance (singleton class) $generic_connection.

[Mongrel] mongrel thread safety and global variables

2006-09-01 Thread hemant
In environment.rb file, I initialize a connection to some data vending servers, through TCP sockets.The connection object is global and hence the code: #environment.rb$generic_connection = ConnectionClass.instance (singleton class) $generic_connection.connect_me( this call will make the connection)