-
Notifications
You must be signed in to change notification settings - Fork 326
Error during Memcached::get() masked by NOTFOUND #9
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
Comments
This is painful and almost caused me to abandon the memcached plugin. I have managed to find a work-around that seems to be working well for me. When Requesting a $cas token when making the get request suddenly the expected error messaging is provided. $result = $mc->get('foo', NULL, $cas ); I'm not sure why it silently just returns no result with just the get( ). Leaving a comment here in the hopes it helps someone else. |
Same here, $cas works and provides the correct message |
Unfortunately, the $cas workaround doesn't work for all cases. A connection timeout still returns "NOT FOUND" instead of "TIMEOUT". This is really bad, not only for debugging, but also for production error logging, because it's not possible to distinguish between a normal cache miss and an error condition. |
Fixed. |
From pecl-memcached Bug #61466:
Description:
If an error occurs while attempting to perform a Memcached::get(), the result code will be set to RES_NOTFOUND. However, that result is actually masking the more important error (such as connection failure, timed out, server is marked dead, etc...)
Replacing the Memcached::get() call with a Memcached::set() call results in the correct result code being reported.
Test script:
Expected result:
false; 3: CONNECTION FAILURE
false; 35: SERVER IS MARKED DEAD
false; 35: SERVER IS MARKED DEAD
false; 35: SERVER IS MARKED DEAD
false; 35: SERVER IS MARKED DEAD
false; 35: SERVER IS MARKED DEAD
false; 35: SERVER IS MARKED DEAD
false; 35: SERVER IS MARKED DEAD
false; 3: CONNECTION FAILURE
false; 35: SERVER IS MARKED DEAD
false; 35: SERVER IS MARKED DEAD
false; 35: SERVER IS MARKED DEAD
false; 35: SERVER IS MARKED DEAD
false; 35: SERVER IS MARKED DEAD
false; 35: SERVER IS MARKED DEAD
false; 35: SERVER IS MARKED DEAD
false; 3: CONNECTION FAILURE
...
Actual result:
false; 16: NOT FOUND
false; 35: SERVER IS MARKED DEAD
false; 16: NOT FOUND
false; 35: SERVER IS MARKED DEAD
false; 16: NOT FOUND
false; 35: SERVER IS MARKED DEAD
false; 16: NOT FOUND
false; 35: SERVER IS MARKED DEAD
false; 16: NOT FOUND
false; 35: SERVER IS MARKED DEAD
false; 16: NOT FOUND
false; 35: SERVER IS MARKED DEAD
false; 16: NOT FOUND
false; 35: SERVER IS MARKED DEAD
false; 16: NOT FOUND
false; 35: SERVER IS MARKED DEAD
...
Additional Info
Try commenting out the get() lines and see that the expected result is achieved (because set() does not mask the error). And commenting out the set() lines results in only "NOT FOUND" being printed.
The text was updated successfully, but these errors were encountered: