Skip to content
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

有内存泄漏问题 #4

Open
GoogleCodeExporter opened this issue Apr 19, 2016 · 11 comments
Open

有内存泄漏问题 #4

GoogleCodeExporter opened this issue Apr 19, 2016 · 11 comments

Comments

@GoogleCodeExporter
Copy link

用了一段时间发现有内存泄漏 
,现象是每一次get都会有20byte的内存泄漏。
查了一下代码,发现了泄漏点
以 r28版为例,

在magent.c文件的 1595行,   b = buffer_init_size(len + 3);  
分配了一个buffer

但在1733行 ,退出了函数,虽然1732行有conn_close(c); 
但因为1595分配的buffer 还没有加入到c->request(这个加入
动作要到1745行完成), 
所以1732行的conn_close(c)并没有释放1595行分配的buffer

另外,在使用中发现,因为mamagent没有考虑超过机制,memagent在��
�台memcached突然死掉的情况下,会造成
memagent长久等待,这样所有的客户端都会卡死,造成整个web前
台死掉,这是很难让人接受的,我对代码临时加了
一些超时机制,但无法保证都加对了,我并在附件中了,因��
�联系不上作者,如果作者有兴趣,请联系我 
gnujava[at]gmail.com


Original issue reported on code.google.com by [email protected] on 18 May 2010 at 12:43

Attachments:

@GoogleCodeExporter
Copy link
Author

"因为mamagent没有考虑超过机制" 改成 
"因为mamagent没有考虑超时机制"

Original comment by [email protected] on 18 May 2010 at 1:14

@GoogleCodeExporter
Copy link
Author

你说的内存泄露问题确实存在,多谢指正


memagent没有考虑超时机制的大概意思我了解,我会看看你提交
的代码

Original comment by [email protected] on 6 Jul 2010 at 9:24

@GoogleCodeExporter
Copy link
Author

请问现在的版本已经解决了“超时”+“内存泄漏”的问题了�
��?

Original comment by [email protected] on 2 Sep 2011 at 3:04

@GoogleCodeExporter
Copy link
Author

内存泄漏在r29版本就已经解决了。
超时问题要大改,所以到目前为止r31没见作者动手

Original comment by [email protected] on 2 Sep 2011 at 3:17

@GoogleCodeExporter
Copy link
Author

为何不直接用libmemcached呢?能解决这个工程能解决的问题。

Original comment by [email protected] on 24 Nov 2011 at 3:44

@GoogleCodeExporter
Copy link
Author

都好久没有更新了,不知道什么时候修复这个问题呢?

Original comment by [email protected] on 5 Jun 2012 at 2:56

@GoogleCodeExporter
Copy link
Author

怎么感觉 0.6 版本更不稳定,我现在测试直接 telnet 上 magent 
后 set 第二次就死在那了,以后再也无法登陆上。

Original comment by [email protected] on 5 Jun 2012 at 3:45

@GoogleCodeExporter
Copy link
Author

关于 0.6 版本,set key 值第二次失败问题;
这个问题的关键点在于作者写 pool_server_handler 用意;
搭建环境多次启停主数据服务器(memcached)和备份服务器(memcache
d);该部分源码均未被调用;该事件也未被触发;
同时因为s->sfd对应的事件机制上add了pool_server_handler的read触发
条件;
影响了s->sfd接收下次set key 命令;

提供一种解决方法:
注释掉 函数 static void pool_server_handler(const int fd,const short 
which, void* argv);
注释掉 put_server_into_pool(void *s) 中:
        event_del(&(s->ev));  /*注意保留*/
                /*
        event_set(&(s->ev), s->sfd, EV_READ|EV_PERSIST, pool_server_handler, (void *) s);
        event_add(&(s->ev), 0);
        */
如上方法已经测试过;原因不解释;

Original comment by [email protected] on 4 Jun 2013 at 2:17

@GoogleCodeExporter
Copy link
Author

从 pool_server_handler 源码分析可知;
pool_server_handler 
功能是用来当memcached服务器断链时,清理matrix->pool中对应的se
rver(s->sfd)的;
若不清理,matrix->used对应的可用fd持续增加;
pool_server_handler 通过 read 
memcached服务器发送报文来判断server对应fd是否可用: 
这个问题或许可以通过修订源码来解决,非通过事件处理方��
�来解决;

Original comment by [email protected] on 4 Jun 2013 at 2:50

@GoogleCodeExporter
Copy link
Author

where is the author?can you slove this problem about telnet error?

Original comment by [email protected] on 3 Mar 2014 at 2:27

@GoogleCodeExporter
Copy link
Author

I fellow you step. Comments the pool_server_handler method and the code blok
/*evernt_set(&(s->ev)...);event_add(&(s->ev),0)*/.
But when write command "I set key1 0 0 1;1 " not response also.
Have you encounter this problem.
Could you show me the detail solution about this problem.
Thanks very much.

Original comment by [email protected] on 8 Oct 2014 at 3:14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant