[Ruby] memcache-client issue

Joe Van Dyk joevandyk at gmail.com
Thu Oct 5 15:10:07 PDT 2006


Hm, that still has issues with multithreading turned on, sorry.  But I
don't have time to look at it at the moment.

On 10/5/06, Joe Van Dyk <joevandyk at gmail.com> wrote:
> --- /usr/lib/ruby/gems/1.8/gems/memcache-client-1.1.0/lib/memcache.rb
>  2006-10-04 09:32:58.000000000 -0700
> +++ /usr/lib/ruby/gems/1.8/gems/memcache-client-1.1.0/lib/memcache.rb.new
>       2006-10-04 09:32:45.000000000 -0700
> @@ -186,10 +186,16 @@ class MemCache
>      command = "set #{cache_key} 0 #{expiry}
> #{marshaled_value.size}\r\n#{marshaled_value}\r\n"
>
>      begin
> -      @mutex.synchronize do
> +     if @mutithread
> +       @mutex.synchronize do
> +         sock.write command
> +         sock.gets
> +       end
> +     else
>          sock.write command
>          sock.gets
> -      end
> +     end
> +
>      rescue SystemCallError, IOError => err
>        server.close
>        raise MemCacheError, err.message
>
>
> On 10/5/06, Joe Van Dyk <joevandyk at gmail.com> wrote:
> > Hi,
> >
> > So, playing around with memcache.  Installed the memcached-client gem.
> >  Started up a memcached server on the localhost.
> >
> > I created a MemCache object and tried to set some data in it.  I got
> > an error about nil not having a sychrnoized method on line 189 of
> > /usr/lib/ruby/gems/1.8/gems/memcache-client-1.1.0/lib/memcache.rb.
> >
> > I didn't turn on the multithread attribute.  From looking at the code,
> > it looks like it doesn't check to see if multithread is on before
> > using the @mutex variable.  I guess it should, right?
> >
>


More information about the Ruby mailing list