Bug 44910

Summary: TCP Sampler "isReUseConnection" issue.
Product: JMeter - Now in Github Reporter: Dmitry Kudrenko <dmitry>
Component: HTTPAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 2.3.1   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Dmitry Kudrenko 2008-04-30 05:34:30 UTC
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
Comment 1 Sebb 2008-04-30 05:45:54 UTC
Good catch.

Fix applied to SVN:

URL: http://svn.apache.org/viewvc?rev=652380&view=rev
Log:
Bug 44910 - close previous socket (if any) in TCP Sampler
Comment 2 The ASF infrastructure team 2022-09-24 20:37:41 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2105