yahaosoft / apjp

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

线程回收有问题, 已解决 #76

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
...
正常使用 APJP 一段时间(访问 youtube 
以及其他一些网站几分钟) 
...
用 netstat -an | grep 8088 查看浏览器与 apjp 
间的的连接数量,发现浏览器实际连接只有几个
用 netstat -an | grep 10100 或者 10200 查看 127.0.0.1 ESTABLISHED 
的数量确有上千个!
用 ps -amH | grep APJP 有上千个线程。
...
在用一段时间后
...unable create native thread.

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

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

Please provide any additional information below.

Original issue reported on code.google.com by bsdi...@gmail.com on 13 Jun 2012 at 12:44

GoogleCodeExporter commented 9 years ago
It seems your OS is FreeBSD-i386 with OpenJDK.

Sorry, we have not tested APJP on it and I am not familiar with FreeBSD.

(TO @jvansteirteghem, are you familiar with FreeBSD? I'm afraid not. However, 
he has GoAgent to use now. So it is not an emergency. :P )

I just have tested that APJP works fine with OpenJDK.

What' worse, we are being busy this month. When I have some time, I will test 
it.

BTW, since you are not bad in English, why not chat directly with 
@jvansteirteghem in English?

Original comment by goknmuse on 13 Jun 2012 at 3:49

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
OS: Ubuntu 12.04

看了下你的代码. 在几个 Worker 线程的 run 里面都有两个线程 
thread1, thread2.
...
thread1.start()
...
thread2.start()
...
thread1.join();
thread2.join();
...

如果改成

Condition pipeBreak

...thread1 {
   pipeBreak.signal();
}
...thread2 {
   pipeBreak.signal();
}

pipeBreak.await();
thread1.stop();
thread2.stop();

驻留线程数量有一定减少,但还是无法完全清理。

Original comment by bsdi...@gmail.com on 14 Jun 2012 at 1:36

GoogleCodeExporter commented 9 years ago
What version browser do you have?
What version JDK/OpenJDK do you have?

Can you reproduce the problem on Windows?
Can you upload your logs?
Can you upload your patched source code?

Thanks :)

Original comment by jeroen.v...@gmail.com on 14 Jun 2012 at 6:08

GoogleCodeExporter commented 9 years ago
1. 我只是帮助作者维护WIKI的, 实际对编程了解不多的. 
而APJP作者@jvansteirteghem, 不懂一点中文的, 所以能用英语, 
尽量用英语交流.

2. I have tested APJP on Ubuntu 12.04 with OpenJDK and it works fine in my 
virtual machine.

3."用 netstat -an | grep 10100 或者 10200 查看 127.0.0.1 ESTABLISHED 
的数量确有上千个!" I tested it yesterday and it maybe be about 100.

"用 ps -amH | grep APJP 有上千个线程。" It is also about 100 in my 
tests.

However, in my tests, "unable create native thread" never shows up. Though, 
when watching videos on the youtube with APJP on CloudFoundry, it maybe have 
some problems, it is highly possible that too many people to use CloudFoundry, 
which causes CloudFoundry performance not that well.

4. Since you have problems with APJP, why not show what you found, then it will 
be easy for us to solve your problems. 
(既然在你的OS上使用APJP出现问题, 
但你又不将你的发现一起发出来, 
我们怎么能帮你找出问题原因? "用 netstat -an | grep 10100 或者 
10200 查看 127.0.0.1 ESTABLISHED 的数量确有上千个!
用 ps -amH | grep APJP 有上千个线程。" 
将其输出到两个文本文件中, 然后贴出来. APJP 
的log也输出到一个文本文件, 贴出来.)

5. APJP作者只是对Linux有一点基础的了解, 
其主要工作平台是Windows的. 
还有不要选择性,*无视*一些英文句子. 既然你在几年前, 
都可以用英文问一些关于FreeBSD的事情, 
我感觉你的英文并不差的哇! 或许, 是我的错觉, 但还有Google 
Translate翻译一下嘛!

6. TO @jvansteirteghem, you can ignore those paragraphs in Chinese. I have to 
focus on preparations for my exams, so it is my last one response until at the 
beginning of September. :P

Original comment by goknmuse on 15 Jun 2012 at 1:40

GoogleCodeExporter commented 9 years ago

Sorry.
i saw your site's page most be chinese. I'm surprised that you are foreigners

begin test.
$ ./APJP.sh >APJP.log 2>&1
...
open Chrome
access youtube.com and open many video links.
access facebook.com
access dropbox.com
above test about 5 minutes.
....

=======================================================================
ven@hong-work:~$ netstat -an |grep 8088 |grep -i est |wc -l
64
ven@hong-work:~$ netstat -an |grep 10100 |grep -i est |wc -l
692
ven@hong-work:~$ netstat -an |grep 10200 |grep -i est |wc -l
812
ven@hong-work:~$ netstat -an |grep 10300 |grep -i est |wc -l
14
ven@hong-work:~$ netstat -an |grep 10400 |grep -i est |wc -l
2
ven@hong-work:~$ ps -amH |grep APJP |wc -l
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
2362
=======================================================================

port 8088 is my APJP's listen port.
you can see that connections between Chrome with APJP is 64. 
but apjp thread already 2362 now.

attachment is my APJP's stdout and stderr.

The wishes APJP getting better and better.

Original comment by bsdi...@gmail.com on 15 Jun 2012 at 3:13

Attachments:

GoogleCodeExporter commented 9 years ago
I do not understand chinese, sorry about that :P
Can you reproduce the problem with firefox?

@goknmuse Thanks for the help :)

Original comment by jeeto.je...@gmail.com on 15 Jun 2012 at 5:37

GoogleCodeExporter commented 9 years ago
I think I have corrected the problem.
Can you test attached APJP.jar?

Original comment by jeroen.v...@gmail.com on 15 Jun 2012 at 9:13

Attachments:

GoogleCodeExporter commented 9 years ago
It's work!
thread leak is gone. 

Original comment by bsdi...@gmail.com on 15 Jun 2012 at 12:28

GoogleCodeExporter commented 9 years ago
Awesome :)

Thanks for your help!

Original comment by jeroen.v...@gmail.com on 15 Jun 2012 at 2:01

GoogleCodeExporter commented 9 years ago
改用新版本,運行命令 netstat -an | grep -i '..*:10000.*ESTABLISHED' | 
wc -l ,當youtube播放完後,明顯線程回收了

Original comment by twf...@gmail.com on 17 Jun 2012 at 3:42

GoogleCodeExporter commented 9 years ago

Original comment by goknmuse on 31 Oct 2012 at 5:33