Bug 46901 - HTTP Sampler does not process var/func refs correctly in first file parameter
HTTP Sampler does not process var/func refs correctly in first file parameter
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
2.3.4
PC Windows XP
: P1 blocker with 2 votes (vote)
: ---
Assigned To: JMeter issues mailing list
:
: 49223 (view as bug list)
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2009-03-24 04:19 UTC by Mandar K Nadgouda
Modified: 2010-04-29 11:04 UTC (History)
2 users (show)



Attachments
Script to upload location (66.24 KB, application/octet-stream)
2009-03-24 04:36 UTC, Mandar K Nadgouda
Details
Sample test plan (5.31 KB, text/plain)
2009-06-16 16:25 UTC, Sebb
Details
Sample test data (7 bytes, text/plain)
2009-06-16 16:26 UTC, Sebb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mandar K Nadgouda 2009-03-24 04:19:10 UTC
Hi,

I have a script to upload a file. I have modified the file path to pick it from the csv file instead. Though the csv file have multiple rows the script is not proceeding to the second row i.e the same file is being sent in the request for each iteration/loop.  

This was working fine with version 2.3.1. Please let me know the changes to be made in case I need to fix this one.
Comment 1 Sebb 2009-03-24 04:25:18 UTC
How are you reading the CSV file?

Please attach a simple test plan that works under 2.3.1 and fails under 2.3.2. Remove any sensitive data first.
Comment 2 Mandar K Nadgouda 2009-03-24 04:36:53 UTC
Created attachment 23406 [details]
Script to upload location

The "Submit File for Upload" HTTP Request uses send files with the request to upload files. The ${importFile} is being picked up from the "CSV Data Set Config"

The first file name is passed to all the "Import Location" iterations in JMeter 2.3.2 r665936. The second iteration should move on to the next row within "CSV Data Set Config"
Comment 3 Mandar K Nadgouda 2009-03-24 04:39:46 UTC
Added a script as attachment. I am using JMeter 2.3.2 r665936. The attached script fails on this release since the same file name mentioned in row 1 of the CSV Data Config is picked up by all iterations.

The same file works on 2.3.1. I cannot use 2.3.1 for other scripts developed due to some other issues.
Comment 4 Sebb 2009-03-24 04:45:53 UTC
The test plan is not exactly "simple".

Which sampler is failing?
Comment 5 Mandar K Nadgouda 2009-03-24 04:52:57 UTC
To put it precisely any HTTP Request with at least one file in the "Send Files With the Request" fails when I parameterize the File path as in ${importFile} and then run it through iterations. The ${importFile} gets replaced for the first iteration with appropriate file name but for next iteration picks the same file path instead of proceeding further.
Comment 6 Sebb 2009-03-24 05:01:37 UTC
I think this has been fixed in SVN - could you try the nightly build and see if that works for you?
Comment 7 Mandar K Nadgouda 2009-03-24 05:41:11 UTC
No its still giving me the same issue both the first iteration and second iteration are picking the same file.
Comment 8 Mandar K Nadgouda 2009-03-24 05:42:02 UTC
I have tried with jakarta-jmeter-r753086.
Comment 9 Mandar K Nadgouda 2009-03-24 05:50:41 UTC
Please note: I do have some other parameters along with the File to be sent with the request as well
Comment 10 Mandar K Nadgouda 2009-03-27 04:20:06 UTC
Any updates on this. When is the next release of Jmeter? Will this be fixed by then? Is there any alternative I can go ahead with?
Comment 11 Sebb 2009-03-27 06:33:48 UTC
I have found that the problem does exist - I thought it was solved in the current nightlies, but not so.

It's not yet clear how to fix this, so I can't say when a fix will be released.

However, I have found that the problem only affects the first file in the list, which is treated differently for compatibility reasons.

If you can put up with sending a dummy file as well, then you can use JMeter 2.3.2 or a nightly. Otherwise you will have to use JMeter 2.3.1.
Comment 12 Sebb 2009-05-01 11:28:21 UTC
This seems to be working OK now.

Please test one of the nightlies and report back.
Comment 13 muru 2009-05-31 10:18:24 UTC
I tried to verify this issue against the release jmeter version 2.3.3 
and it is still exist. It always pick up the first file name. 

But, the same script works like charm in 2.3.1 version. I am not sure what got fixed in 2.3.3 because the behavoir still the same as in 2.3.2

I need to do diff in source to see what changes were made between 2.3.1 to 2.3.3
Comment 14 Sebb 2009-06-16 16:25:57 UTC
Created attachment 23821 [details]
Sample test plan
Comment 15 Sebb 2009-06-16 16:26:21 UTC
Created attachment 23822 [details]
Sample test data
Comment 16 Sebb 2009-06-16 16:28:08 UTC
It works fine for me with the attached test plan and CSV file.

Create 3 dummy files - f1.tmp, f2.tmp, f3.tmp and start the mirror-server.

You should see that the files are correctly uploaded.
Comment 17 SteveH 2009-07-16 16:33:35 UTC
I'm seeing this bug on v2.3.3 and v2.3.4.

I'm using HTTP Request HTTPClient Sampler.  I'm using a variable name for "File Path".  The variable is changed in a BeanShell preprocessor.  In a loop I'm posting a file to a server.  The first file name generated in the beanshell keeps getting posted over and over even though I verified that the variable is getting changed.
Comment 18 SteveH 2009-07-17 09:37:58 UTC
I verified that it works correctly on 2.3.1 and is broken on all releases after that.
Comment 19 SteveH 2009-09-03 15:00:41 UTC
BUMP
Comment 20 muru 2009-11-07 19:27:25 UTC
please, fix this issue soon
Comment 21 Sebb 2010-02-01 17:05:37 UTC
This has taken a long while to fix, but as can be seen from the change it was not trivial. [It might have been fixed earlier had there been a simple test case.]

The changes will be in nightly builds from r905484.

URL: http://svn.apache.org/viewvc?rev=905484&view=rev
Log:
Bug 46901 - HTTP Sampler does not process var/func refs correctly in first file parameter
Simplify file handling at run-time by using only a single list which is merged at start-up if necessary.

Added:
   jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBaseConverter.java   (with props)
Modified:
   jakarta/jmeter/trunk/bin/saveservice.properties
   jakarta/jmeter/trunk/bin/testfiles/AssertionTestPlan.jmx
   jakarta/jmeter/trunk/bin/testfiles/AuthManagerTestPlan.jmx
   jakarta/jmeter/trunk/bin/testfiles/GuiTest.jmx
   jakarta/jmeter/trunk/bin/testfiles/GuiTest231.jmx
   jakarta/jmeter/trunk/bin/testfiles/HeaderManagerTestPlan.jmx
   jakarta/jmeter/trunk/bin/testfiles/InterleaveTestPlan.jmx
   jakarta/jmeter/trunk/bin/testfiles/InterleaveTestPlan2.jmx
   jakarta/jmeter/trunk/bin/testfiles/LoopTestPlan.jmx
   jakarta/jmeter/trunk/bin/testfiles/Modification Manager.jmx
   jakarta/jmeter/trunk/bin/testfiles/OnceOnlyTestPlan.jmx
   jakarta/jmeter/trunk/bin/testfiles/SimpleTestPlan.jmx
   jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
   jakarta/jmeter/trunk/xdocs/changes.xml
Comment 22 Sebb 2010-04-29 11:04:24 UTC
*** Bug 49223 has been marked as a duplicate of this bug. ***