Memcached 1.4.4 and NHibernate 2.1.2

66 views
Skip to first unread message

zvolkov

unread,
Jun 16, 2010, 9:06:09 AM6/16/10
to NHibernate Contrib - Development Group
Looks like Memcached ClientLibrary used in the Memcached Cache
Provider that shipped with NHibernate 2.1.2 (and older) has issues
with Memcached 1.4.4 (and newer)

Here's the error I'm getting:
1.Error deleting key: XXXX@YYYY#121271. Server response: CLIENT_ERROR
bad command line format. Usage: delete <key> [noreply]

From what I read in memcached release notes 1.4.4, looks like
Memcached 1.2.x used to support so called lingering delete. This is
when the client sends the delete command with an optional timeout
parameter set to a non-zero value. This causes the server to flag the
item as deleted but still keep in the cache (until the timeout
expires) -- this way the subsequent add operations would fail. This
rather obscure feature was removed completely in 1.4.0, but 1.4.4
introduced a backwards compatibility change that allows the timeout
value of 0 (i.e. non-lingering delete), while continuing to reject
others.

But why would Memcached ClientLibrary use the lingering delete
feature?! Looking at the sources here's what I see:
1.public bool Delete(string key)
2.{
3. return this.Delete(key, null, DateTime.MaxValue);
4.}

Clearly the DateTime.MaxValue is a problem. Looking at
http://sourceforge.net/projects/memcacheddotnet/ SVN I don't see this
fixed yet. What is the procedure for submitting a patch or getting
write access to memcacheddotnet repo?

zvolkov

unread,
Jun 17, 2010, 9:35:51 PM6/17/10
to NHibernate Contrib - Development Group
Actually, I just realized it might better be fixed in
NHibernate.Caches.MemCache.MemCacheClient provider rather than in the
Memcached.ClientLibrary.MemcachedClient library.

I thought NH wrapper calls the default method Delete(string key) which
sends DateTime.MaxValue but it turns out DateTime.MaxValue is actually
treated by the actual Delete method as a signal not to send any
expiration date to memcached server. Which made me think the NH
wrapper can't possibly be invoking Delete(string key).

Indeed, looking at NHibernate.Caches.MemCache.MemCacheClient's method
Remove(object key) I see the following line:
this.client.Delete(this.KeyAsString(key),
DateTime.Now.AddSeconds((double) this.expiry));

So rather than keeping NH wrapper supply an expiration date and making
Memcached.ClientLibrary.MemcachedClient ignore, which is kinda silly,
I think we should modify NHibernate.Caches.MemCache.MemCacheClient to
not supply expiration date instead. Right?

zvolkov

unread,
Jun 17, 2010, 9:48:29 PM6/17/10
to NHibernate Contrib - Development Group
Alright, I'm definitely inclined to have this fixed on the
NHibernate.Caches.MemCache.MemCacheClient side, but I also think it
should be an opt-in feature (=disabled by default). So the question
becomes: what should this option be called? no_lingering_delete?
lingering_delete_disabled?

Fabio Maulo

unread,
Jun 19, 2010, 2:16:45 PM6/19/10
to nhc...@googlegroups.com
Please use our JIRA for your proposal (patch).
Thanks.


--
You received this message because you are subscribed to the Google Groups "NHibernate Contrib - Development Group" group.
To post to this group, send email to nhc...@googlegroups.com.
To unsubscribe from this group, send email to nhcdevs+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhcdevs?hl=en.




--
Fabio Maulo

zvolkov

unread,
Jun 23, 2010, 9:41:43 PM6/23/10
to NHibernate Contrib - Development Group
Created ticket, attached patch with failing unit-test and the proposed
fix: http://216.121.112.228/browse/NHCH-27
BTW the patch in NHCH-26 eliminates the need for this fix, since it
uses new client (Enyim.Caching.Memcached) and so the Remove method in
it is rewritten to not use lingering delete.


On Jun 19, 2:16 pm, Fabio Maulo <fabioma...@gmail.com> wrote:
> Please use our JIRA for your proposal (patch).
> Thanks.
>
>
>
> On Thu, Jun 17, 2010 at 10:48 PM, zvolkov <zvol...@gmail.com> wrote:
> > Alright, I'm definitely inclined to have this fixed on the
> > NHibernate.Caches.MemCache.MemCacheClient side, but I also think it
> > should be an opt-in feature (=disabled by default). So the question
> > becomes: what should this option be called? no_lingering_delete?
> > lingering_delete_disabled?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "NHibernate Contrib - Development Group" group.
> > To post to this group, send email to nhc...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > nhcdevs+u...@googlegroups.com<nhcdevs%2Bunsu...@googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages