📜 ⬆️ ⬇️

The history of one bug or why you should know not only PHP

It all started with the fact that the memkesh began to fall, or rather, memkeshB. And he fell somehow slyly. Reinstalling memkesh + memkeshdb + BerkeleyDb gave nothing. After some empirical calculations, it became clear that it falls on the MultiGet method, while the fact that the drop depends on the order of setting the keys and the number of keys must be more than 3 is very interesting.


Failure error: # 16 - incomplete data reception. Yeah, mean swag memocks. We climb into the logs, analyze the logs on the fly and see the cherished END - all content is given by logs. Here it is necessary to disclose some details of the exchange protocol.
There are two types of exchange protocol: binary and text. According to the text protocol, the message consists of and
header and body proper. Consider the two main commands that everyone may need when debugging: set and get.

set < > [noreply]\r\n
.... length

noreply, STORED\r\n ERROR\r\n
flags -
expiraton - ,
length -
length

get <>


: VALUE < > .... length
END

:

gets <1> <2> <3> ...


: VALUE \r\n
.... length
VALUE \r\n
.... length
VALUE \r\n
.... length
END

protokol.txt doc memcached

:
telnet localhost 11211


( END), . : " ?". . - , . , . - Ok!

# 2. , . :
memcached BerkeleyDb ( memcachedb ) libmemcache (c-) memcached pecl PHP.
PHP 10 , memcached :
-
- : "gets <1> <2> <3>"
- ( \r\n)
- , ,
- n-
- 3.

:
VALUE key_1 67 678 178468
VALUE key_2 67 526 178468
VALUE key_3 67 349 178468
END


1000 ( )
, , .

#3.
memcached . . , . . libmemcached.

#4 .
libmemcached. test . . Sigmentation fault. . . , , libmemcached, , ...

, ... , .
set < > [noreply]\r\n
.... length

noreply, STORED\r\n ERROR\r\n
flags -
expiraton - ,
length -
length

get <>


: VALUE < > .... length
END

:

gets <1> <2> <3> ...


: VALUE \r\n
.... length
VALUE \r\n
.... length
VALUE \r\n
.... length
END

protokol.txt doc memcached

:
telnet localhost 11211


( END), . : " ?". . - , . , . - Ok!

# 2. , . :
memcached BerkeleyDb ( memcachedb ) libmemcache (c-) memcached pecl PHP.
PHP 10 , memcached :
-
- : "gets <1> <2> <3>"
- ( \r\n)
- , ,
- n-
- 3.

:
VALUE key_1 67 678 178468
VALUE key_2 67 526 178468
VALUE key_3 67 349 178468
END


1000 ( )
, , .

#3.
memcached . . , . . libmemcached.

#4 .
libmemcached. test . . Sigmentation fault. . . , , libmemcached, , ...

, ... , .

')

Source: https://habr.com/ru/post/74643/


All Articles