-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"error 37 from memcached_set: SUCCESS" when setting value > 1 MB #184
Comments
Hello @jwhitlock! Sadly, as is the case for #180, this is not something we can realistically do anything about. Perhaps it's time we rolled up our sleeves and started taking on active development of libmemcached. Until that time I'm afraid I can't do much for the sometimes confusing error messages and other behaviors in libmemcached. Other than that I am open to ideas! |
c and bzr and launchpad - that's a bit of a technical hill to climb, and I feel I'd need to get comfortable with Another thing that might help is exposing the value serialization, so that I can add the length of the value to exceptions, with extra emphasis if they go over the 1 MB limit. That might be |
Is it possible to increase the max value size to be larger than 1MB? I could not find this in the docs |
Sorry, no, it's not really something we defined a limit for. I'm not sure if it's from the protocol itself or just libmemcached, though. |
It's the famous 1MB upper limit in memcached itself. I had to dig into this a few years ago, when the project was hosted on code.google.com and there was a FAQ with the explanation of why. I seem to remember it boiling down to "if you need to cache something that big, you are doing it wrong", that TCP overhead would start to get ridiculous. It looks like you can increase it up to 128MB on the command line, if you have that server access, with something like |
Understood, thank you. |
It seems to me that we can't do much about this; closing for lack of means of resolution. |
Hi all, sorry for posting on a closed thread, but does anyone know if this "error 37 from memcached_set: SUCCESS" error with libmemcached persists? I see references across the web of this error, but I can't reproduce it. If it still exists, I have to handle it gracefully in my application logic, but I'm wondering if it's actually been fixed in a recent update to libmemcached? |
Yes, it reproduces for me, running the above code, with:
|
Thanks! I ended up using django_pylibmc to configure memcached with my application, and it handles this error gracefully by default. |
|
Hm, sounds like a poor strategy to silence an error. No warnings, nothing? |
The best I opened this bug in the hope that |
Right, I see the problem, it’s just that pylibmc is in essentially the same situation: we don’t have the information needed to give you a proper error, likely because memcached doesn’t even send an error but rather just closes the connection or something. I’m not sure but I would suspect it to be this way given how the error comes up.
|
So curiosity got the better of me, here are my findings:
Works well.
Don't work so well. The first one is 2^31, the second one is one less, the third one is 2^30 - 1. It turns out the breakpoint is at exactly 2^30 - 16 -- presumably 16 bytes of bookkeeping is included in the size limit. |
Surprisingly, this is a very detectable and reportable error. It should in fact be triggering |
Also, the error pylibmc triggers for 2^31 byte values:
Whereas for 2^30 byte values, we get
|
Well, maybe I got your hopes up with my last message. However, as it turns out, I can really only fix the latter of the previous two cases, the midpoint case. It also turns out my math was off somehow, it seems memcached gives a server error when It also seems that when memcached sends a SERVER_ERROR, it also disconnects you. This is why we get "socket is not connected." |
So I think this is all I can do for now. The following program now works with libmemcached 1.0.2 and above: import pylibmc
v = 'h'*(2**30)
mc = pylibmc.Client(['127.0.0.1:11211'])
try:
mc.set('a', v)
except pylibmc.TooBig:
print('(sad trumpet) value was too big') |
With libmemcached 1.0.18 (OS X, with homebrew patches), I get an unexpected error value when attempting to set a value greater than 1 MB:
I'm expecting an error, because of the 1 MB limit, but I was hoping for a more specific error, and maybe one that includes the length of the value after serialization and compression (see django-pylibmc/django-pylibmc#29).
This sounds like a similar issue as #180, but without the binary protocol and behaviors used in that test case.
The text was updated successfully, but these errors were encountered: