apache / jmeter

Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services
https://jmeter.apache.org/
Apache License 2.0
8.41k stars 2.1k forks source link

TCP Sampler "isReUseConnection" issue. #2105

Closed asfimport closed 16 years ago

asfimport commented 16 years ago

Dmitry Kudrenko (Bug 44910): I tested application using JMeter TCP Sampler. This application closes session when TCP Socket is closed.

But when I use the isReUseConnection flag - new connection is started but old socket doesn't closed until JMeter is not closed.

TCPSampler closes connection in the finally block in the "sample" method if isReUseConnection set. But it closes new connection from the map but old connection is never closed.

I think connection should be closed every time when new connection created in the getSocket(). I added closeSocket() method to the getSocket() method:

... try { // line 141 closeSocket(); con = new Socket(getServer(), getPort()); ...

and it works for me correctly.

Thank you. -- Regards, Dmitry Kudrenko ARDAS group http://ardas.dp.ua

Severity: normal OS: All

asfimport commented 16 years ago

Sebb (migrated from Bugzilla): Good catch.

Fix applied to SVN:

URL: http://svn.apache.org/viewvc?rev=652380&view=rev Log: https://github.com/apache/jmeter/issues/2105 - close previous socket (if any) in TCP Sampler