You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2011/12/04 11:40:39 UTC

DO NOT REPLY [Bug 52284] New: StringFromFile does not respect its contract : JMeter instantiates a copy of each function for every reference in a Sampler or elsewhere; each instance will open its own copy of the the file

https://issues.apache.org/bugzilla/show_bug.cgi?id=52284

             Bug #: 52284
           Summary: StringFromFile does not respect its contract : JMeter
                    instantiates a copy of each function for every
                    reference in a Sampler or elsewhere; each instance
                    will open its own copy of the the file
           Product: JMeter
           Version: 2.5.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main
        AssignedTo: issues@jmeter.apache.org
        ReportedBy: p.mouawad@ubik-ingenierie.com
    Classification: Unclassified


Created attachment 28023
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28023
Test plan

I think there is an issue in StringFromFile function.
In the docs and javadocs it is said that:
- JMeter instantiates a copy of each function for every reference in a Sampler
or elsewhere; each instance will open its own copy of the the file

But debugging the attached Test Case , I see only one instance of
StringFromFile shared by the 3 threads.
So this leads to a buggy result.
Expected result shoud be that each time threadNum should match file Num (not
the case)
And each file should be read, depending on execution some files are not read at
all.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52284] StringFromFile: Behaviour not clear with more than one Thread if file name depends on Thread (__threadNum in the file name)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52284

Sebb <se...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from Sebb <se...@apache.org> 2011-12-11 12:08:58 UTC ---
Docs updated.

URL: http://svn.apache.org/viewvc?rev=1212996&view=rev
Log:
Clarify docs (Bug 52284)

Modified:
   jmeter/trunk/src/functions/org/apache/jmeter/functions/StringFromFile.java
   jmeter/trunk/xdocs/usermanual/functions.xml

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52284] StringFromFile: Behaviour not clear with more than one Thread if file name depends on Thread (__threadNum in the file name)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52284

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|StringFromFile: Behaviour   |StringFromFile: Behaviour
                   |not clear with more than    |not clear with more than
                   |one Thread                  |one Thread if file name
                   |                            |depends on Thread
                   |                            |(__threadNum in the file
                   |                            |name)
           Severity|normal                      |enhancement

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52284] StringFromFile: Behaviour not clear with more than one Thread if file name depends on Thread (__threadNum in the file name)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52284

--- Comment #4 from Sebb <se...@apache.org> 2011-12-11 11:38:39 UTC ---
Function references are only instantiated once per occurrence in the test Plan.

So if a sampler references StringFromFile, all threads will use the same
instance of the function.

This allows the same data file to be shared between threads.

The file is opened once, on the first reference, so will use whatever thread
number happens to run the first sample.

This is similar to how the global counter (IterationCounter) works.

StringFromFile was designed to share the data across threads.

CSV Dataset can be used for per-thread data files.

It would be possible to implement a per-thread version of StringFromFile by
using ThreadLocal storage for the file details. However I'm not sure there's a
good use case for it, given that we already have CSV Dataset.

I'll update the Javadoc and function desc.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52284] StringFromFile does not respect its contract : JMeter instantiates a copy of each function for every reference in a Sampler or elsewhere; each instance will open its own copy of the the file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52284

--- Comment #1 from Philippe Mouawad <p....@ubik-ingenierie.com> 2011-12-04 10:41:05 UTC ---
Created attachment 28024
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28024
Run result

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52284] StringFromFile: Behaviour not clear with more than one Thread

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52284

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |p.mouawad@ubik-ingenierie.c
                   |                            |om
            Summary|StringFromFile does not     |StringFromFile: Behaviour
                   |respect its contract :      |not clear with more than
                   |JMeter instantiates a copy  |one Thread
                   |of each function for every  |
                   |reference in a Sampler or   |
                   |elsewhere; each instance    |
                   |will open its own copy of   |
                   |the the file                |

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52284] StringFromFile does not respect its contract : JMeter instantiates a copy of each function for every reference in a Sampler or elsewhere; each instance will open its own copy of the the file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52284

--- Comment #2 from Philippe Mouawad <p....@ubik-ingenierie.com> 2011-12-04 10:42:37 UTC ---
Created attachment 28025
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28025
Test data

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52284] StringFromFile: Behaviour not clear with more than one Thread

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52284

--- Comment #3 from Philippe Mouawad <p....@ubik-ingenierie.com> 2011-12-04 11:23:59 UTC ---
(In reply to comment #0)
> Created attachment 28023 [details]
> Test plan
> 
> I think there is an issue in StringFromFile function.
> In the docs and javadocs it is said that:
> - JMeter instantiates a copy of each function for every reference in a Sampler
> or elsewhere; each instance will open its own copy of the the file
> 
This part is OK in fact, I mixed up Thread and multiple usage

> But debugging the attached Test Case , I see only one instance of
> StringFromFile shared by the 3 threads.
> So this leads to a buggy result.
> Expected result shoud be that each time threadNum should match file Num (not
> the case)
> And each file should be read, depending on execution some files are not read at
> all.


The issue is more in Synchronisation as described in Test Plan

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.