fuimaz / spserver

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

memory leak 问题 #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.用ab进行压力测试. ab -c 100 -n 1000 http://192.168.13.38:8080/
2.调用 shutdown()关机
3.产生泄露
{91756} normal block at 0x00AC9428, 16 bytes long.
 Data: <0 B  RB         > 30 FF 42 00 90 52 42 00 00 00 00 00 01 00 00 00 
{642} normal block at 0x0155CDD8, 24 bytes long.
 Data: <             RB > E8 13 00 00 20 06 00 00 10 06 00 00 90 52 42 00 

What is the expected output? What do you see instead?
泄露只是在多用户情况下出现,单线程时没有问题.另外有时候
,服务不能退出.阻塞在
SP_IocpServer :: ~SP_IocpServer()
{
...
    for( ; mIsRunning; ) sleep( 1 );
}
What version of the product are you using? On what operating system?

ver 0.9.4

Please provide any additional information below.

Original issue reported on code.google.com by xiaoxi.p...@gmail.com on 7 Apr 2009 at 11:19

GoogleCodeExporter commented 9 years ago
0.9.4 发布之后,的确又发现了有 memory leak 的问题,已经 
checkin 到了 svn ,请从 svn
上 update 最新的代码再试试。如果还有问题,请再反馈。

不能 shutdown 的问题,改成
+       for( ; mIsRunning; ) {
+               shutdown();
+               sleep( 1 );
+       }

也 checkin 到了 svn 。

Original comment by stephen....@gmail.com on 7 Apr 2009 at 1:27

GoogleCodeExporter commented 9 years ago
ok , 感谢快速响应.:)
有一种泄露的情况是这样:在响应请求的过程中(ab未执行完),��
�执行了shutdown(),就会产生泄
露,好像是response 和 request 
中的数据没有释放,这部分应该如何释放为好? 谢谢

Original comment by xiaoxi.p...@gmail.com on 7 Apr 2009 at 2:26

GoogleCodeExporter commented 9 years ago
看具体的情况,一般来说,一个 server 
实例都是始终在运行的,当 server 实例 shutdown 的
时候,也是程序退出的时候了,这时候可以依靠 os 
的机制把所有资源回收。
如果是不断地创建一个 server 实例,然后又 shutdown 
,然后又创建,那么就需要处理这种泄
漏情况,不过很难想象会有这样的做法。

Original comment by stephen....@gmail.com on 7 Apr 2009 at 2:34

GoogleCodeExporter commented 9 years ago
明白你的意思,不过在嵌入式应用时,有时会仅仅停下spserver,然
后再启动,而不退出整个程序.
这时,就想要知道shutdown时,没有发出的response保存在哪里?我可�
��自行删除.

Original comment by xiaoxi.p...@gmail.com on 7 Apr 2009 at 2:55

GoogleCodeExporter commented 9 years ago
这倒是一个没想过的场景。应该可以针对这个场景做一些改��
�,避免内存泄漏。
这里可能还存在一些其他的问题,比如准备停下来的时候,��
�立即就停,然后把未发出的
response 释放掉,还是先停止 accept ,然后尽量等待 response 
发送完毕再完全停下来?

Original comment by stephen....@gmail.com on 7 Apr 2009 at 3:05

GoogleCodeExporter commented 9 years ago
我在我这里修改了一下,是停止accept,然后等response发送完再真�
��退出.
泄露是没有了,不过退出速度比较慢.
有时间还是完善一下,给个更好的办法吧.

Original comment by xiaoxi.p...@gmail.com on 9 Apr 2009 at 4:13

GoogleCodeExporter commented 9 years ago
accept好像是一个 for(;;){}的死循环,无法退出。

Original comment by ollye...@126.com on 10 Dec 2009 at 2:09