[Mongrel] mongrel thread safety and global variables
gethemant at gmail.com
Mon Sep 4 14:24:53 EDT 2006
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:
# read from socket
# error handling
My assertion says, sometimes for certain protocol codes, the time to read
from the socket is more than 6 seconds and hence that "gets request" is
timed out there. Now..in the next call, when i put some new request to the
socket...i get response for the previous request, because socket still
contains data that was written to it after the timeout. Ugly,right?
Solution I have thought is:
1. Send a unique GUID as a extended modifier with each request and expect
that proxy will echo it to us.
2. Somehow clear the socket, before read...not entirely sure abt
this.Somebody on ruby-lang also suggested that, use Eventmachine.
On 9/2/06, Zed Shaw <zedshaw at zedshaw.com> wrote:
> 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
> > 10000 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 the data and
> > see if there is a mis-match.
> And randomize it. Ruby's threads work fairly predictably so without a
> random short think time to mix things up you won't get good results.
> Zed A. Shaw
> http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
nothing much to talk
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mongrel-users