
그런데 memcached 옵션을 켜면 로그아웃이 되지 않는 문제가 발생하여 조사에 착수하게 되었다. 우선 텍스트큐브의 디버깅 옵션을 켜고 웹 브라우저로 홈 페이지를 열어보았다.

그러자 아래와 같은 디버깅 정보를 화면 상단에 불 수 있어 문제해결의 실마리를 찾을 수 있었다.
MemcachePool::delete() [memcachepool.delete]: Server localhost (tcp 11211, udp 0) failed with: CLIENT_ERROR bad command line format. Usage: delete <key> [noreply] (0)(8)
File: framework/cache/Memcache.php:49
즉 텍스트큐브에서 memcached 서버에 삭제를 요청하는 부분에서 문제가 생긴 것이다. 이와 유사한 다른 예를 찾기 위해 구글로 검색해 보니 Item deletion bug in PECL memcache package [1]라는 글을 찾을 수 있었다. memcache 삭제 요구에서 문제가 생기는 이유는 pecl-memcache 버그 #16927 댓글에 적힌 것 처럼 memcache 서버 버전에 따라 삭제 프로토콜이 변경 되었기 때문이다. 즉 memcache 서버 버전 1.3 이후부터는 삭제 명령에서 시간이 빠지는데 pecl-memcache에서는 시간을 보내는 옛날 프로토콜을 그대로 쓰기 위해 나오는 생긴 문제가 되겠다.
memcache 1.2까지는
# delete <key> <time> [noreply]\r\n
memcache 1.3부터는
# delete <key> [noreply]\r\n
그러므로 pecl-memcache 소스코드를 약간 손봐야 할 필요가 생기는데, 참고글 [1]에 나온 패치를 적용하면 memcache문제가 해결된다. 패치는 memcache_ascii_protocol.c와 memcache_binary_protocol.c 두 파일에 적용하는데 아래 내용과 같이 간단한 패치이다.
--- memcache_ascii_protocol.c.orig 2009-02-22 11:01:43.000000000 -0500
+++ memcache_ascii_protocol.c 2010-04-22 20:07:48.000000000 -0400
@@ -323,10 +323,10 @@
smart_str_appendl(&(request->sendbuf.value), " ", 1);
smart_str_appendl(&(request->sendbuf.value), key, key_len);
- if (exptime > 0) {
+ /*if (exptime > 0) {
smart_str_appendl(&(request->sendbuf.value), " ", 1);
smart_str_append_unsigned(&(request->sendbuf.value), exptime);
- }
+ }*/
smart_str_appendl(&(request->sendbuf.value), "\r\n", sizeof("\r\n")-1);
}
--- memcache_binary_protocol.c.orig 2009-02-22 11:01:43.000000000 -0500
+++ memcache_binary_protocol.c 2010-04-22 20:07:48.000000000 -0400
@@ -486,7 +486,7 @@
req->next_parse_handler = mmc_request_read_response;
mmc_pack_header(&(header.base), MMC_OP_DELETE, 0, key_len, sizeof(header) - sizeof(header.base), 0);
- header.exptime = htonl(exptime);
+ /*header.exptime = htonl(exptime);*/
smart_str_appendl(&(request->sendbuf.value), (const char *)&header, sizeof(header));
smart_str_appendl(&(request->sendbuf.value), key, key_len);
- if (exptime > 0) {
+ /*if (exptime > 0) {
smart_str_appendl(&(request->sendbuf.value), " ", 1);
smart_str_append_unsigned(&(request->sendbuf.value), exptime);
- }
+ }*/
smart_str_appendl(&(request->sendbuf.value), "\r\n", sizeof("\r\n")-1);
}
이렇게 패치를 적용한 pecl-memcache를 설치하고 웹 서버를 다시 시작하면 텍스트큐브는 정상적으로 동작한다.
주의: 이 글에 소개된 방법은 Textcube 1.8.3.1, Memcache 서버 1.4.4, PECL memcache 3.0.4 환경에서만 적용될 수 있다.
Trackback URL : http://par.sarang.net/trackback/470
Trackback RSS : http://par.sarang.net/rss/trackback/470
Trackback ATOM : http://par.sarang.net/atom/trackback/470





























당신의 의견을 작성해 주세요.