ryusun / memcachedb

Automatically exported from code.google.com/p/memcachedb
Other
0 stars 0 forks source link

>9 SERVER_ERROR out of memory #6

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. ./configure && make && make install
2. /usr/local/bin/memcachedb -l 127.0.0.1  -u nobody -vv -f
/var/cache/memcachedb/default.db -H /var/cache/memcachedb 
3. <9 set b0779a1737d196b5536656a5321243aade7df486 0 86400 13989

What is the expected output? What do you see instead?

The expected output is:

>9 STORED
<9 connection closed.

I get:

>9 SERVER_ERROR out of memory

What version of the product are you using? On what operating system?

memcachedb-1.0.2-beta with:

Kubuntu 7.10, db4.6, libevent (the latest in Ubuntu).

Please provide any additional information below.

I'm trying to use memcachedb as a session storage for PHP, using the
memcache extension of PHP. Something like this works:

<9 set 47e33a215d3f30195bfc511174299c0572ada092 0 86400 332
>9 STORED

but this doesn't:

<9 set 47e33a215d3f30195bfc511174299c0572ada092 0 86400 13961
>9 SERVER_ERROR out of memory

I tracked the problem up to memcachedb.c line 1154:

    it = item_alloc(key, nkey, flags, vlen+2);

    if (it == 0) {
        out_string(c, "SERVER_ERROR out of memory");
        /* swallow the data line */
        c->write_and_go = conn_swallow;
        c->sbytes = vlen + 2;
        return;
    }

but after that I'll need some help. Thanks.

Original issue reported on code.google.com by rodolfo....@gmail.com on 4 Mar 2008 at 4:40

GoogleCodeExporter commented 8 years ago
The default item buffer is 1K, so when you wanna store 13961 bytes data, it is 
of
course out of memory. Use -b option to specify suitable buffer size. 

Following this formula:
item_buffer_size(-b) = key_size + data_size + 37(Max)

By the way, why not use memcached for session storage, there's no expiration in
memcachedb, so I guess the session storage will become larger and larger.

Original comment by stv...@gmail.com on 5 Mar 2008 at 1:41

GoogleCodeExporter commented 8 years ago
Thank you stvchu, it worked with the -b switch, but again, my session is 
growing too
much :/

I'm trying memcachedb because of the 1 Mb limit in memcached. I need to store 
session
data larger than 1 Mb. But maybe I should change my framework's (PRADO) way of
storing viewstate data, so it doesn't store everything in just a session 
variable.

As for the expiration, I thought it was managed by PHP's session handler with 
the gc
setting...

Thanks again.

Original comment by rodolfo....@gmail.com on 5 Mar 2008 at 2:44