You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by Philippe Mouawad <ph...@gmail.com> on 2018/12/28 07:24:59 UTC

Re: svn commit: r1849687 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/FileRowColContainer.java test/src/org/apache/jmeter/functions/TestFileRowColContainer.java xdocs/changes.xml

Hello,
It seems this commit introduces random failures on nightly build:

https://ci.apache.org/builders/jmeter-nightly/builds/1264/steps/shell_5/logs/stdio

Regards




On Mon, Dec 24, 2018 at 2:13 PM <fs...@apache.org> wrote:

> Author: fschumacher
> Date: Mon Dec 24 13:13:31 2018
> New Revision: 1849687
>
> URL: http://svn.apache.org/viewvc?rev=1849687&view=rev
> Log:
> When using CSVRead search the script base path for files, too.
>
> Bugzilla Id: 63037
>
> Modified:
>
> jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColContainer.java
>
> jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java
>     jmeter/trunk/xdocs/changes.xml
>
> Modified:
> jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColContainer.java
> URL:
> http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
>
> ==============================================================================
> ---
> jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColContainer.java
> (original)
> +++
> jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColContainer.java
> Mon Dec 24 13:13:31 2018
> @@ -19,7 +19,6 @@
>  package org.apache.jmeter.functions;
>
>  import java.io.BufferedReader;
> -import java.io.File;
>  import java.io.FileNotFoundException;
>  import java.io.IOException;
>  import java.nio.charset.Charset;
> @@ -28,6 +27,7 @@ import java.util.ArrayList;
>  import java.util.List;
>  import java.util.StringTokenizer;
>
> +import org.apache.jmeter.services.FileServer;
>  import org.apache.jmeter.util.JMeterUtils;
>  import org.slf4j.Logger;
>  import org.slf4j.LoggerFactory;
> @@ -75,7 +75,7 @@ public class FileRowColContainer {
>
>      private void load() throws IOException, FileNotFoundException {
>          try (BufferedReader myBread =
> -                Files.newBufferedReader(new File(fileName).toPath(),
> +
> Files.newBufferedReader(FileServer.getFileServer().getResolvedFile(fileName).toPath(),
>
>                          Charset.defaultCharset())) {
>              String line = myBread.readLine();
>              /*
>
> Modified:
> jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java
> URL:
> http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
>
> ==============================================================================
> ---
> jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java
> (original)
> +++
> jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java
> Mon Dec 24 13:13:31 2018
> @@ -23,9 +23,14 @@ import static org.junit.Assert.assertNot
>  import static org.junit.Assert.assertTrue;
>  import static org.junit.Assert.fail;
>
> +import java.io.File;
>  import java.nio.file.NoSuchFileException;
>
>  import org.apache.jmeter.junit.JMeterTestCase;
> +import org.apache.jmeter.services.FileServer;
> +import org.apache.jmeter.util.JMeterUtils;
> +import org.junit.After;
> +import org.junit.Before;
>  import org.junit.Test;
>
>  /**
> @@ -35,7 +40,20 @@ import org.junit.Test;
>   */
>  public class TestFileRowColContainer extends JMeterTestCase {
>
> -    @Test(expected=NoSuchFileException.class)
> +    private String defaultBase = null;
> +
> +    @Before
> +    public void setUp() {
> +        defaultBase = FileServer.getDefaultBase();
> +        FileServer.getFileServer().setBase(new
> File(JMeterUtils.getJMeterHome() + "/bin"));
> +    }
> +
> +    @After
> +    public void tearDown() {
> +        FileServer.getFileServer().setBase(new File(defaultBase));
> +    }
> +
> +    @Test(expected = NoSuchFileException.class)
>      public void testNull() throws Exception {
>          new FileRowColContainer(findTestPath("testfiles/xyzxyz"));
>      }
> @@ -46,6 +64,20 @@ public class TestFileRowColContainer ext
>          assertNotNull(f);
>          assertEquals("Expected 4 lines", 4, f.getSize());
>
> +        assertEquals(0, f.nextRow());
> +        assertEquals(1, f.nextRow());
> +        assertEquals(2, f.nextRow());
> +        assertEquals(3, f.nextRow());
> +        assertEquals(0, f.nextRow());
> +
> +    }
> +
> +    @Test
> +    public void testRowNumRelative() throws Exception {
> +        FileRowColContainer f = new
> FileRowColContainer("testfiles/unit/TestFileRowColContainer.csv");
> +        assertNotNull(f);
> +        assertEquals("Expected 4 lines", 4, f.getSize());
> +
>          assertEquals(0, f.nextRow());
>          assertEquals(1, f.nextRow());
>          assertEquals(2, f.nextRow());
>
> Modified: jmeter/trunk/xdocs/changes.xml
> URL:
> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1849687&r1=1849686&r2=1849687&view=diff
>
> ==============================================================================
> --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
> +++ jmeter/trunk/xdocs/changes.xml [utf-8] Mon Dec 24 13:13:31 2018
> @@ -105,6 +105,7 @@ of previous time slot as a base. Startin
>
>  <h3>Functions</h3>
>  <ul>
> +  <li><bug>63037</bug>When using <code>CSVRead</code> search the script
> base path for files, too.</li>
>  </ul>
>
>  <h3>I18N</h3>
>
>
>

-- 
Cordialement.
Philippe Mouawad.

Re: svn commit: r1849687 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/FileRowColContainer.java test/src/org/apache/jmeter/functions/TestFileRowColContainer.java xdocs/changes.xml

Posted by sebb <se...@gmail.com>.
On Wed, 2 Jan 2019 at 19:12, Felix Schumacher
<fe...@internetallee.de> wrote:
>
>
> Am 01.01.19 um 21:40 schrieb sebb:
> > On Sun, 30 Dec 2018 at 16:12, Felix Schumacher
> > <fe...@internetallee.de> wrote:
> >>
> >> Am 29.12.18 um 12:15 schrieb Philippe Mouawad:
> >>> Hello Felix,
> >>> I made a commit yesterday illustrating what I was proposing.
> >>> Nightly builds passed but It may be too early to conclude.
> >>> Does it look ok to you ?
> >> I hadn't thought about that interface. It will probably lessen the
> >> chance that we hit the bug in our setup, but it is still present for all
> >> systems, that don't know about the semantic of that interface.
> > Huh?
> >
> > I don't follow.
> >
> > What bug are you referring to?
>
> We still have the bug I described, in my previous mails, that the script
> base might be set to null, when the test cases are ran concurrently. The
> interface marker we are using now is used by our test runner, only.

OK, I see.

There does not seem to be a standard way to flag JUnit tests that must
be run sequentially.
It looks like Maven Surefire can use @NotThreadSafe [1] but this does
not seem to fully solve all such issues.

Whilst the current solution works, it might perhaps be worth
considering using the annotation instead of the JMeter-specific
interface.

[The standard JCIP annotations use Retention=Runtime which means the
jar must be present at run-time.
That would be a nuisance for the main JMeter code, but not really an
issue for tests.]

Until such time as JUnit fully supports serial running, I suspect the
only way that works with all test runners would be to implement
locking for the tests that need to run serially.
This would be more complicated and would affect the parallelism, but
would potentially allow for several different locks where the tests
exercise un-related code.

[1] http://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html#Parallel_Test_Execution_and_Single_Thread_Execution

> Felix

<snip/>

Re: svn commit: r1849687 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/FileRowColContainer.java test/src/org/apache/jmeter/functions/TestFileRowColContainer.java xdocs/changes.xml

Posted by Felix Schumacher <fe...@internetallee.de>.
Am 01.01.19 um 21:40 schrieb sebb:
> On Sun, 30 Dec 2018 at 16:12, Felix Schumacher
> <fe...@internetallee.de> wrote:
>>
>> Am 29.12.18 um 12:15 schrieb Philippe Mouawad:
>>> Hello Felix,
>>> I made a commit yesterday illustrating what I was proposing.
>>> Nightly builds passed but It may be too early to conclude.
>>> Does it look ok to you ?
>> I hadn't thought about that interface. It will probably lessen the
>> chance that we hit the bug in our setup, but it is still present for all
>> systems, that don't know about the semantic of that interface.
> Huh?
>
> I don't follow.
>
> What bug are you referring to?

We still have the bug I described, in my previous mails, that the script 
base might be set to null, when the test cases are ran concurrently. The 
interface marker we are using now is used by our test runner, only.

Felix

>
>> Let us see, what the next nightlys might bring.
>>
>> Felix
>>
>>> Thanks
>>>
>>> On Fri, Dec 28, 2018 at 8:29 PM Philippe Mouawad <ph...@gmail.com>
>>> wrote:
>>>
>>>> Hi Felix,
>>>> Isn’t it fixed if we make test that touch base non parallel?
>>>>
>>>> It’s an interface to add .
>>>> Or did i not understand the problem ?
>>>>
>>>> Thanks
>>>>
>>>> On Friday, December 28, 2018, Felix Schumacher <
>>>> felix.schumacher@internetallee.de> wrote:
>>>>
>>>>> Am Freitag, den 28.12.2018, 17:41 +0000 schrieb sebb:
>>>>>> On Fri, 28 Dec 2018 at 12:59, Felix Schumacher
>>>>>> <fe...@internetallee.de> wrote:
>>>>>>> Am Freitag, den 28.12.2018, 11:32 +0000 schrieb sebb:
>>>>>>>> On Fri, 28 Dec 2018 at 10:35, Felix Schumacher
>>>>>>>> <fe...@internetallee.de> wrote:
>>>>>>>>> Am Freitag, den 28.12.2018, 08:24 +0100 schrieb Philippe
>>>>>>>>> Mouawad:
>>>>>>>>>> Hello,
>>>>>>>>>> It seems this commit introduces random failures on nightly
>>>>>>>>>> build:
>>>>>>>>>>
>>>>>>>>>>
>>>>> https://ci.apache.org/builders/jmeter-nightly/builds/1264/steps/shell_5/logs/stdio
>>>>>>>>> The test fails at
>>>>>>>>>
>>>>>>>>> 1)
>>>>>>>>> testColumns(org.apache.jmeter.functions.TestFileRowColContainer
>>>>>>>>> )
>>>>>>>>>        [java] java.lang.NullPointerException
>>>>>>>>>        [java]     at
>>>>>>>>> org.apache.jmeter.services.FileServer$FileEntry.access$200(File
>>>>>>>>> Serv
>>>>>>>>> er.j
>>>>>>>>> ava:534)
>>>>>>>>>        [java]     at
>>>>>>>>> org.apache.jmeter.services.FileServer.getResolvedFile(FileServe
>>>>>>>>> r.ja
>>>>>>>>> va:5
>>>>>>>>> 31)
>>>>>>>>>        [java]     at
>>>>>>>>> org.apache.jmeter.functions.FileRowColContainer.load(FileRowCol
>>>>>>>>> Cont
>>>>>>>>> aine
>>>>>>>>> r.java:78)
>>>>>>>>>        [java]     at
>>>>>>>>> org.apache.jmeter.functions.FileRowColContainer.<init>(FileRowC
>>>>>>>>> olCo
>>>>>>>>> ntai
>>>>>>>>> ner.java:73)
>>>>>>>>>        [java]     at
>>>>>>>>> org.apache.jmeter.functions.TestFileRowColContainer.testColumns
>>>>>>>>> (Tes
>>>>>>>>> tFil
>>>>>>>>> eRowColContainer.java:91)
>>>>>>>>>        [java]     at
>>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>>>>>>> Method)
>>>>>>>>>        [java]     at
>>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccesso
>>>>>>>>> rImp
>>>>>>>>> l.ja
>>>>>>>>> va:62)
>>>>>>>>>        [java]     at
>>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMetho
>>>>>>>>> dAcc
>>>>>>>>> esso
>>>>>>>>> rImpl.java:43)
>>>>>>>>>        [java]     at
>>>>>>>>> java.lang.reflect.Method.invoke(Method.java:498)
>>>>>>>>>        [java]     at
>>>>>>>>> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(Fra
>>>>>>>>> mewo
>>>>>>>>> rkMe
>>>>>>>>> thod.java:50)
>>>>>>>>>        [java]     at
>>>>>>>>> org.junit.internal.runners.model.ReflectiveCallable.run(Reflect
>>>>>>>>> iveC
>>>>>>>>> alla
>>>>>>>>> ble.java:12)
>>>>>>>>>        [java]     at
>>>>>>>>> org.junit.runners.model.FrameworkMethod.invokeExplosively(Frame
>>>>>>>>> work
>>>>>>>>> Meth
>>>>>>>>> od.java:47)
>>>>>>>>>        [java]     at
>>>>>>>>> org.junit.internal.runners.statements.InvokeMethod.evaluate(Inv
>>>>>>>>> okeM
>>>>>>>>> etho
>>>>>>>>> d.java:17)
>>>>>>>>>        [java]     at
>>>>>>>>> org.junit.internal.runners.statements.RunBefores.evaluate(RunBe
>>>>>>>>> fore
>>>>>>>>> s.ja
>>>>>>>>> va:26)
>>>>>>>>>        [java]     at
>>>>>>>>> org.junit.internal.runners.statements.RunAfters.evaluate(RunAft
>>>>>>>>> ers.
>>>>>>>>> java
>>>>>>>>> :27)
>>>>>>>>>        [java]     at
>>>>>>>>> org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>>>>>>>>>        [java]     at
>>>>>>>>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4Cl
>>>>>>>>> assR
>>>>>>>>> unne
>>>>>>>>> r.java:78)
>>>>>>>>>        [java]     at
>>>>>>>>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4Cl
>>>>>>>>> assR
>>>>>>>>> unne
>>>>>>>>> r.java:57)
>>>>>>>>>        [java]     at
>>>>>>>>> org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>>>>>>>>>        [java]     at
>>>>>>>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.j
>>>>>>>>> ava:
>>>>>>>>> 511)
>>>>>>>>>        [java]     at
>>>>>>>>> java.util.concurrent.FutureTask.run(FutureTask.java:266)
>>>>>>>>>        [java]     at
>>>>>>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExe
>>>>>>>>> cuto
>>>>>>>>> r.ja
>>>>>>>>> va:1149)
>>>>>>>>>        [java]     at
>>>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolEx
>>>>>>>>> ecut
>>>>>>>>> or.j
>>>>>>>>> ava:624)
>>>>>>>>>        [java]     at java.lang.Thread.run(Thread.java:748)
>>>>>>>>>
>>>>>>>>> Especially the concurrent access makes me believe, that this is
>>>>>>>>> a
>>>>>>>>> problem with the test case and not the implementation.
>>>>>>>>>
>>>>>>>>> Originally this test had no script base set. I added a script
>>>>>>>>> base
>>>>>>>>> before each test and reset it to the one found before after the
>>>>>>>>> test.
>>>>>>>>>
>>>>>>>>> Now, when those tests are run in parallel, it can happen, that
>>>>>>>>> the
>>>>>>>>> first test sets a script base and remembers the original one.
>>>>>>>>> The
>>>>>>>>> next
>>>>>>>>> one starts before the first is finished and remembers the "set"
>>>>>>>>> base.
>>>>>>>>> When this test finishes it will "reset" the script base to the
>>>>>>>>> "set"
>>>>>>>>> base, which would be wrong.
>>>>>>>>>
>>>>>>>>> There are at least two options to get around this:
>>>>>>>>>
>>>>>>>>>    a) revert to state before the fix
>>>>>>>>>    b) only set the script base and don't reset it after the tests
>>>>>>>>>
>>>>>>>>> I don't want to take option a), but option b) will change the
>>>>>>>>> environment for all tests that run after these tests.
>>>>>>>>>
>>>>>>>>> What is your opionion on this (options plus explanation :)
>>>>>>>> AIUI there is only one script base for the whole of JMeter - is
>>>>>>>> that
>>>>>>>> correct?
>>>>>>>> If so, then it does not make sense to allow tests to run in
>>>>>>>> parallel.
>>>>>>> Thats my understanding as well, that all tests basically share one
>>>>>>> script base.
>>>>>>>
>>>>>>>> Each test must be allowed to complete (and tidy up if necessary)
>>>>>>>> before the next one starts.
>>>>>>> That is what I tried, but I think it fails in the described manner.
>>>>>> In which case there is likely some other bug that needs
>>>>>> investigation.
>>>>>> Either in the test case or the main JMeter code.
>>>>> Well, I thought I described the mistake I made, but it seems, that I
>>>>> didn't do a good enough job. So let me try with a diagram:
>>>>>
>>>>>     Thread A                         Thread B
>>>>>     save old script base
>>>>>     set new base
>>>>>                                      Save old script base
>>>>>     run test
>>>>>                                      set new base
>>>>>     reset base
>>>>>                                      run test -> BOOM
>>>>>
>>>>>
>>>>> That is a slight variation of my text version above.
>>>>>
>>>>> So we could get around it by setting the script base for all tests, or
>>>>> make those tests synchronized in some kind of manner.
>>>>>
>>>>>>> I could try option b) hoping, that the assumption - that we only
>>>>>>> use
>>>>>>> one script base - holds.
>>>>>> Whether or not there is only one script base should be clear by
>>>>>> inspection of the code.
>>>>> And hope, that that inspection is thorough enough.
>>>>>
>>>>> Regards,
>>>>>    Felix
>>>>>
>>>>>>> Felix
>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>    Felix
>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Mon, Dec 24, 2018 at 2:13 PM <fs...@apache.org>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> Author: fschumacher
>>>>>>>>>>> Date: Mon Dec 24 13:13:31 2018
>>>>>>>>>>> New Revision: 1849687
>>>>>>>>>>>
>>>>>>>>>>> URL: http://svn.apache.org/viewvc?rev=1849687&view=rev
>>>>>>>>>>> Log:
>>>>>>>>>>> When using CSVRead search the script base path for files,
>>>>>>>>>>> too.
>>>>>>>>>>>
>>>>>>>>>>> Bugzilla Id: 63037
>>>>>>>>>>>
>>>>>>>>>>> Modified:
>>>>>>>>>>>
>>>>>>>>>>> jmeter/trunk/src/functions/org/apache/jmeter/functions/File
>>>>>>>>>>> RowC
>>>>>>>>>>> olCo
>>>>>>>>>>> ntainer.java
>>>>>>>>>>>
>>>>>>>>>>> jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
>>>>>>>>>>> owCo
>>>>>>>>>>> lCon
>>>>>>>>>>> tainer.java
>>>>>>>>>>>       jmeter/trunk/xdocs/changes.xml
>>>>>>>>>>>
>>>>>>>>>>> Modified:
>>>>>>>>>>> jmeter/trunk/src/functions/org/apache/jmeter/functions/File
>>>>>>>>>>> RowC
>>>>>>>>>>> olCo
>>>>>>>>>>> ntainer.java
>>>>>>>>>>> URL:
>>>>>>>>>>>
>>>>> http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
>>>>>>>>>>> ===========================================================
>>>>>>>>>>> ====
>>>>>>>>>>> ====
>>>>>>>>>>> ===========
>>>>>>>>>>> ---
>>>>>>>>>>> jmeter/trunk/src/functions/org/apache/jmeter/functions/File
>>>>>>>>>>> RowC
>>>>>>>>>>> olCo
>>>>>>>>>>> ntainer.java
>>>>>>>>>>> (original)
>>>>>>>>>>> +++
>>>>>>>>>>> jmeter/trunk/src/functions/org/apache/jmeter/functions/File
>>>>>>>>>>> RowC
>>>>>>>>>>> olCo
>>>>>>>>>>> ntainer.java
>>>>>>>>>>> Mon Dec 24 13:13:31 2018
>>>>>>>>>>> @@ -19,7 +19,6 @@
>>>>>>>>>>>    package org.apache.jmeter.functions;
>>>>>>>>>>>
>>>>>>>>>>>    import java.io.BufferedReader;
>>>>>>>>>>> -import java.io.File;
>>>>>>>>>>>    import java.io.FileNotFoundException;
>>>>>>>>>>>    import java.io.IOException;
>>>>>>>>>>>    import java.nio.charset.Charset;
>>>>>>>>>>> @@ -28,6 +27,7 @@ import java.util.ArrayList;
>>>>>>>>>>>    import java.util.List;
>>>>>>>>>>>    import java.util.StringTokenizer;
>>>>>>>>>>>
>>>>>>>>>>> +import org.apache.jmeter.services.FileServer;
>>>>>>>>>>>    import org.apache.jmeter.util.JMeterUtils;
>>>>>>>>>>>    import org.slf4j.Logger;
>>>>>>>>>>>    import org.slf4j.LoggerFactory;
>>>>>>>>>>> @@ -75,7 +75,7 @@ public class FileRowColContainer {
>>>>>>>>>>>
>>>>>>>>>>>        private void load() throws IOException,
>>>>>>>>>>> FileNotFoundException
>>>>>>>>>>> {
>>>>>>>>>>>            try (BufferedReader myBread =
>>>>>>>>>>> -                Files.newBufferedReader(new
>>>>>>>>>>> File(fileName).toPath(),
>>>>>>>>>>> +
>>>>>>>>>>> Files.newBufferedReader(FileServer.getFileServer().getResol
>>>>>>>>>>> vedF
>>>>>>>>>>> ile(
>>>>>>>>>>> fileName).toPath(),
>>>>>>>>>>>
>>>>>>>>>>>                            Charset.defaultCharset())) {
>>>>>>>>>>>                String line = myBread.readLine();
>>>>>>>>>>>                /*
>>>>>>>>>>>
>>>>>>>>>>> Modified:
>>>>>>>>>>> jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
>>>>>>>>>>> owCo
>>>>>>>>>>> lCon
>>>>>>>>>>> tainer.java
>>>>>>>>>>> URL:
>>>>>>>>>>>
>>>>> http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
>>>>>>>>>>> ===========================================================
>>>>>>>>>>> ====
>>>>>>>>>>> ====
>>>>>>>>>>> ===========
>>>>>>>>>>> ---
>>>>>>>>>>> jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
>>>>>>>>>>> owCo
>>>>>>>>>>> lCon
>>>>>>>>>>> tainer.java
>>>>>>>>>>> (original)
>>>>>>>>>>> +++
>>>>>>>>>>> jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
>>>>>>>>>>> owCo
>>>>>>>>>>> lCon
>>>>>>>>>>> tainer.java
>>>>>>>>>>> Mon Dec 24 13:13:31 2018
>>>>>>>>>>> @@ -23,9 +23,14 @@ import static org.junit.Assert.assertNot
>>>>>>>>>>>    import static org.junit.Assert.assertTrue;
>>>>>>>>>>>    import static org.junit.Assert.fail;
>>>>>>>>>>>
>>>>>>>>>>> +import java.io.File;
>>>>>>>>>>>    import java.nio.file.NoSuchFileException;
>>>>>>>>>>>
>>>>>>>>>>>    import org.apache.jmeter.junit.JMeterTestCase;
>>>>>>>>>>> +import org.apache.jmeter.services.FileServer;
>>>>>>>>>>> +import org.apache.jmeter.util.JMeterUtils;
>>>>>>>>>>> +import org.junit.After;
>>>>>>>>>>> +import org.junit.Before;
>>>>>>>>>>>    import org.junit.Test;
>>>>>>>>>>>
>>>>>>>>>>>    /**
>>>>>>>>>>> @@ -35,7 +40,20 @@ import org.junit.Test;
>>>>>>>>>>>     */
>>>>>>>>>>>    public class TestFileRowColContainer extends
>>>>>>>>>>> JMeterTestCase {
>>>>>>>>>>>
>>>>>>>>>>> -    @Test(expected=NoSuchFileException.class)
>>>>>>>>>>> +    private String defaultBase = null;
>>>>>>>>>>> +
>>>>>>>>>>> +    @Before
>>>>>>>>>>> +    public void setUp() {
>>>>>>>>>>> +        defaultBase = FileServer.getDefaultBase();
>>>>>>>>>>> +        FileServer.getFileServer().setBase(new
>>>>>>>>>>> File(JMeterUtils.getJMeterHome() + "/bin"));
>>>>>>>>>>> +    }
>>>>>>>>>>> +
>>>>>>>>>>> +    @After
>>>>>>>>>>> +    public void tearDown() {
>>>>>>>>>>> +        FileServer.getFileServer().setBase(new
>>>>>>>>>>> File(defaultBase));
>>>>>>>>>>> +    }
>>>>>>>>>>> +
>>>>>>>>>>> +    @Test(expected = NoSuchFileException.class)
>>>>>>>>>>>        public void testNull() throws Exception {
>>>>>>>>>>>            new
>>>>>>>>>>> FileRowColContainer(findTestPath("testfiles/xyzxyz"));
>>>>>>>>>>>        }
>>>>>>>>>>> @@ -46,6 +64,20 @@ public class TestFileRowColContainer ext
>>>>>>>>>>>            assertNotNull(f);
>>>>>>>>>>>            assertEquals("Expected 4 lines", 4, f.getSize());
>>>>>>>>>>>
>>>>>>>>>>> +        assertEquals(0, f.nextRow());
>>>>>>>>>>> +        assertEquals(1, f.nextRow());
>>>>>>>>>>> +        assertEquals(2, f.nextRow());
>>>>>>>>>>> +        assertEquals(3, f.nextRow());
>>>>>>>>>>> +        assertEquals(0, f.nextRow());
>>>>>>>>>>> +
>>>>>>>>>>> +    }
>>>>>>>>>>> +
>>>>>>>>>>> +    @Test
>>>>>>>>>>> +    public void testRowNumRelative() throws Exception {
>>>>>>>>>>> +        FileRowColContainer f = new
>>>>>>>>>>> FileRowColContainer("testfiles/unit/TestFileRowColContainer
>>>>>>>>>>> .csv
>>>>>>>>>>> ");
>>>>>>>>>>> +        assertNotNull(f);
>>>>>>>>>>> +        assertEquals("Expected 4 lines", 4, f.getSize());
>>>>>>>>>>> +
>>>>>>>>>>>            assertEquals(0, f.nextRow());
>>>>>>>>>>>            assertEquals(1, f.nextRow());
>>>>>>>>>>>            assertEquals(2, f.nextRow());
>>>>>>>>>>>
>>>>>>>>>>> Modified: jmeter/trunk/xdocs/changes.xml
>>>>>>>>>>> URL:
>>>>>>>>>>>
>>>>> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1849687&r1=1849686&r2=1849687&view=diff
>>>>>>>>>>> ===========================================================
>>>>>>>>>>> ====
>>>>>>>>>>> ====
>>>>>>>>>>> ===========
>>>>>>>>>>> --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
>>>>>>>>>>> +++ jmeter/trunk/xdocs/changes.xml [utf-8] Mon Dec 24
>>>>>>>>>>> 13:13:31
>>>>>>>>>>> 2018
>>>>>>>>>>> @@ -105,6 +105,7 @@ of previous time slot as a base.
>>>>>>>>>>> Startin
>>>>>>>>>>>
>>>>>>>>>>>    <h3>Functions</h3>
>>>>>>>>>>>    <ul>
>>>>>>>>>>> +  <li><bug>63037</bug>When using <code>CSVRead</code>
>>>>>>>>>>> search
>>>>>>>>>>> the
>>>>>>>>>>> script
>>>>>>>>>>> base path for files, too.</li>
>>>>>>>>>>>    </ul>
>>>>>>>>>>>
>>>>>>>>>>>    <h3>I18N</h3>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>> --
>>>> Cordialement.
>>>> Philippe Mouawad.
>>>>
>>>>
>>>>
>>>>

Re: svn commit: r1849687 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/FileRowColContainer.java test/src/org/apache/jmeter/functions/TestFileRowColContainer.java xdocs/changes.xml

Posted by sebb <se...@gmail.com>.
On Sun, 30 Dec 2018 at 16:12, Felix Schumacher
<fe...@internetallee.de> wrote:
>
>
> Am 29.12.18 um 12:15 schrieb Philippe Mouawad:
> > Hello Felix,
> > I made a commit yesterday illustrating what I was proposing.
> > Nightly builds passed but It may be too early to conclude.
> > Does it look ok to you ?
>
> I hadn't thought about that interface. It will probably lessen the
> chance that we hit the bug in our setup, but it is still present for all
> systems, that don't know about the semantic of that interface.

Huh?

I don't follow.

What bug are you referring to?

> Let us see, what the next nightlys might bring.
>
> Felix
>
> >
> > Thanks
> >
> > On Fri, Dec 28, 2018 at 8:29 PM Philippe Mouawad <ph...@gmail.com>
> > wrote:
> >
> >> Hi Felix,
> >> Isn’t it fixed if we make test that touch base non parallel?
> >>
> >> It’s an interface to add .
> >> Or did i not understand the problem ?
> >>
> >> Thanks
> >>
> >> On Friday, December 28, 2018, Felix Schumacher <
> >> felix.schumacher@internetallee.de> wrote:
> >>
> >>> Am Freitag, den 28.12.2018, 17:41 +0000 schrieb sebb:
> >>>> On Fri, 28 Dec 2018 at 12:59, Felix Schumacher
> >>>> <fe...@internetallee.de> wrote:
> >>>>> Am Freitag, den 28.12.2018, 11:32 +0000 schrieb sebb:
> >>>>>> On Fri, 28 Dec 2018 at 10:35, Felix Schumacher
> >>>>>> <fe...@internetallee.de> wrote:
> >>>>>>> Am Freitag, den 28.12.2018, 08:24 +0100 schrieb Philippe
> >>>>>>> Mouawad:
> >>>>>>>> Hello,
> >>>>>>>> It seems this commit introduces random failures on nightly
> >>>>>>>> build:
> >>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>>
> >>> https://ci.apache.org/builders/jmeter-nightly/builds/1264/steps/shell_5/logs/stdio
> >>>>>>> The test fails at
> >>>>>>>
> >>>>>>> 1)
> >>>>>>> testColumns(org.apache.jmeter.functions.TestFileRowColContainer
> >>>>>>> )
> >>>>>>>       [java] java.lang.NullPointerException
> >>>>>>>       [java]     at
> >>>>>>> org.apache.jmeter.services.FileServer$FileEntry.access$200(File
> >>>>>>> Serv
> >>>>>>> er.j
> >>>>>>> ava:534)
> >>>>>>>       [java]     at
> >>>>>>> org.apache.jmeter.services.FileServer.getResolvedFile(FileServe
> >>>>>>> r.ja
> >>>>>>> va:5
> >>>>>>> 31)
> >>>>>>>       [java]     at
> >>>>>>> org.apache.jmeter.functions.FileRowColContainer.load(FileRowCol
> >>>>>>> Cont
> >>>>>>> aine
> >>>>>>> r.java:78)
> >>>>>>>       [java]     at
> >>>>>>> org.apache.jmeter.functions.FileRowColContainer.<init>(FileRowC
> >>>>>>> olCo
> >>>>>>> ntai
> >>>>>>> ner.java:73)
> >>>>>>>       [java]     at
> >>>>>>> org.apache.jmeter.functions.TestFileRowColContainer.testColumns
> >>>>>>> (Tes
> >>>>>>> tFil
> >>>>>>> eRowColContainer.java:91)
> >>>>>>>       [java]     at
> >>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> >>>>>>> Method)
> >>>>>>>       [java]     at
> >>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccesso
> >>>>>>> rImp
> >>>>>>> l.ja
> >>>>>>> va:62)
> >>>>>>>       [java]     at
> >>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMetho
> >>>>>>> dAcc
> >>>>>>> esso
> >>>>>>> rImpl.java:43)
> >>>>>>>       [java]     at
> >>>>>>> java.lang.reflect.Method.invoke(Method.java:498)
> >>>>>>>       [java]     at
> >>>>>>> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(Fra
> >>>>>>> mewo
> >>>>>>> rkMe
> >>>>>>> thod.java:50)
> >>>>>>>       [java]     at
> >>>>>>> org.junit.internal.runners.model.ReflectiveCallable.run(Reflect
> >>>>>>> iveC
> >>>>>>> alla
> >>>>>>> ble.java:12)
> >>>>>>>       [java]     at
> >>>>>>> org.junit.runners.model.FrameworkMethod.invokeExplosively(Frame
> >>>>>>> work
> >>>>>>> Meth
> >>>>>>> od.java:47)
> >>>>>>>       [java]     at
> >>>>>>> org.junit.internal.runners.statements.InvokeMethod.evaluate(Inv
> >>>>>>> okeM
> >>>>>>> etho
> >>>>>>> d.java:17)
> >>>>>>>       [java]     at
> >>>>>>> org.junit.internal.runners.statements.RunBefores.evaluate(RunBe
> >>>>>>> fore
> >>>>>>> s.ja
> >>>>>>> va:26)
> >>>>>>>       [java]     at
> >>>>>>> org.junit.internal.runners.statements.RunAfters.evaluate(RunAft
> >>>>>>> ers.
> >>>>>>> java
> >>>>>>> :27)
> >>>>>>>       [java]     at
> >>>>>>> org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> >>>>>>>       [java]     at
> >>>>>>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4Cl
> >>>>>>> assR
> >>>>>>> unne
> >>>>>>> r.java:78)
> >>>>>>>       [java]     at
> >>>>>>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4Cl
> >>>>>>> assR
> >>>>>>> unne
> >>>>>>> r.java:57)
> >>>>>>>       [java]     at
> >>>>>>> org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> >>>>>>>       [java]     at
> >>>>>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.j
> >>>>>>> ava:
> >>>>>>> 511)
> >>>>>>>       [java]     at
> >>>>>>> java.util.concurrent.FutureTask.run(FutureTask.java:266)
> >>>>>>>       [java]     at
> >>>>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExe
> >>>>>>> cuto
> >>>>>>> r.ja
> >>>>>>> va:1149)
> >>>>>>>       [java]     at
> >>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolEx
> >>>>>>> ecut
> >>>>>>> or.j
> >>>>>>> ava:624)
> >>>>>>>       [java]     at java.lang.Thread.run(Thread.java:748)
> >>>>>>>
> >>>>>>> Especially the concurrent access makes me believe, that this is
> >>>>>>> a
> >>>>>>> problem with the test case and not the implementation.
> >>>>>>>
> >>>>>>> Originally this test had no script base set. I added a script
> >>>>>>> base
> >>>>>>> before each test and reset it to the one found before after the
> >>>>>>> test.
> >>>>>>>
> >>>>>>> Now, when those tests are run in parallel, it can happen, that
> >>>>>>> the
> >>>>>>> first test sets a script base and remembers the original one.
> >>>>>>> The
> >>>>>>> next
> >>>>>>> one starts before the first is finished and remembers the "set"
> >>>>>>> base.
> >>>>>>> When this test finishes it will "reset" the script base to the
> >>>>>>> "set"
> >>>>>>> base, which would be wrong.
> >>>>>>>
> >>>>>>> There are at least two options to get around this:
> >>>>>>>
> >>>>>>>   a) revert to state before the fix
> >>>>>>>   b) only set the script base and don't reset it after the tests
> >>>>>>>
> >>>>>>> I don't want to take option a), but option b) will change the
> >>>>>>> environment for all tests that run after these tests.
> >>>>>>>
> >>>>>>> What is your opionion on this (options plus explanation :)
> >>>>>> AIUI there is only one script base for the whole of JMeter - is
> >>>>>> that
> >>>>>> correct?
> >>>>>> If so, then it does not make sense to allow tests to run in
> >>>>>> parallel.
> >>>>> Thats my understanding as well, that all tests basically share one
> >>>>> script base.
> >>>>>
> >>>>>> Each test must be allowed to complete (and tidy up if necessary)
> >>>>>> before the next one starts.
> >>>>> That is what I tried, but I think it fails in the described manner.
> >>>> In which case there is likely some other bug that needs
> >>>> investigation.
> >>>> Either in the test case or the main JMeter code.
> >>> Well, I thought I described the mistake I made, but it seems, that I
> >>> didn't do a good enough job. So let me try with a diagram:
> >>>
> >>>    Thread A                         Thread B
> >>>    save old script base
> >>>    set new base
> >>>                                     Save old script base
> >>>    run test
> >>>                                     set new base
> >>>    reset base
> >>>                                     run test -> BOOM
> >>>
> >>>
> >>> That is a slight variation of my text version above.
> >>>
> >>> So we could get around it by setting the script base for all tests, or
> >>> make those tests synchronized in some kind of manner.
> >>>
> >>>>> I could try option b) hoping, that the assumption - that we only
> >>>>> use
> >>>>> one script base - holds.
> >>>> Whether or not there is only one script base should be clear by
> >>>> inspection of the code.
> >>> And hope, that that inspection is thorough enough.
> >>>
> >>> Regards,
> >>>   Felix
> >>>
> >>>>> Felix
> >>>>>
> >>>>>>> Regards,
> >>>>>>>   Felix
> >>>>>>>
> >>>>>>>> Regards
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> On Mon, Dec 24, 2018 at 2:13 PM <fs...@apache.org>
> >>>>>>>> wrote:
> >>>>>>>>
> >>>>>>>>> Author: fschumacher
> >>>>>>>>> Date: Mon Dec 24 13:13:31 2018
> >>>>>>>>> New Revision: 1849687
> >>>>>>>>>
> >>>>>>>>> URL: http://svn.apache.org/viewvc?rev=1849687&view=rev
> >>>>>>>>> Log:
> >>>>>>>>> When using CSVRead search the script base path for files,
> >>>>>>>>> too.
> >>>>>>>>>
> >>>>>>>>> Bugzilla Id: 63037
> >>>>>>>>>
> >>>>>>>>> Modified:
> >>>>>>>>>
> >>>>>>>>> jmeter/trunk/src/functions/org/apache/jmeter/functions/File
> >>>>>>>>> RowC
> >>>>>>>>> olCo
> >>>>>>>>> ntainer.java
> >>>>>>>>>
> >>>>>>>>> jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
> >>>>>>>>> owCo
> >>>>>>>>> lCon
> >>>>>>>>> tainer.java
> >>>>>>>>>      jmeter/trunk/xdocs/changes.xml
> >>>>>>>>>
> >>>>>>>>> Modified:
> >>>>>>>>> jmeter/trunk/src/functions/org/apache/jmeter/functions/File
> >>>>>>>>> RowC
> >>>>>>>>> olCo
> >>>>>>>>> ntainer.java
> >>>>>>>>> URL:
> >>>>>>>>>
> >>>>>>>
> >>>>>
> >>> http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
> >>>>>>>>> ===========================================================
> >>>>>>>>> ====
> >>>>>>>>> ====
> >>>>>>>>> ===========
> >>>>>>>>> ---
> >>>>>>>>> jmeter/trunk/src/functions/org/apache/jmeter/functions/File
> >>>>>>>>> RowC
> >>>>>>>>> olCo
> >>>>>>>>> ntainer.java
> >>>>>>>>> (original)
> >>>>>>>>> +++
> >>>>>>>>> jmeter/trunk/src/functions/org/apache/jmeter/functions/File
> >>>>>>>>> RowC
> >>>>>>>>> olCo
> >>>>>>>>> ntainer.java
> >>>>>>>>> Mon Dec 24 13:13:31 2018
> >>>>>>>>> @@ -19,7 +19,6 @@
> >>>>>>>>>   package org.apache.jmeter.functions;
> >>>>>>>>>
> >>>>>>>>>   import java.io.BufferedReader;
> >>>>>>>>> -import java.io.File;
> >>>>>>>>>   import java.io.FileNotFoundException;
> >>>>>>>>>   import java.io.IOException;
> >>>>>>>>>   import java.nio.charset.Charset;
> >>>>>>>>> @@ -28,6 +27,7 @@ import java.util.ArrayList;
> >>>>>>>>>   import java.util.List;
> >>>>>>>>>   import java.util.StringTokenizer;
> >>>>>>>>>
> >>>>>>>>> +import org.apache.jmeter.services.FileServer;
> >>>>>>>>>   import org.apache.jmeter.util.JMeterUtils;
> >>>>>>>>>   import org.slf4j.Logger;
> >>>>>>>>>   import org.slf4j.LoggerFactory;
> >>>>>>>>> @@ -75,7 +75,7 @@ public class FileRowColContainer {
> >>>>>>>>>
> >>>>>>>>>       private void load() throws IOException,
> >>>>>>>>> FileNotFoundException
> >>>>>>>>> {
> >>>>>>>>>           try (BufferedReader myBread =
> >>>>>>>>> -                Files.newBufferedReader(new
> >>>>>>>>> File(fileName).toPath(),
> >>>>>>>>> +
> >>>>>>>>> Files.newBufferedReader(FileServer.getFileServer().getResol
> >>>>>>>>> vedF
> >>>>>>>>> ile(
> >>>>>>>>> fileName).toPath(),
> >>>>>>>>>
> >>>>>>>>>                           Charset.defaultCharset())) {
> >>>>>>>>>               String line = myBread.readLine();
> >>>>>>>>>               /*
> >>>>>>>>>
> >>>>>>>>> Modified:
> >>>>>>>>> jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
> >>>>>>>>> owCo
> >>>>>>>>> lCon
> >>>>>>>>> tainer.java
> >>>>>>>>> URL:
> >>>>>>>>>
> >>>>>>>
> >>>>>
> >>> http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
> >>>>>>>>> ===========================================================
> >>>>>>>>> ====
> >>>>>>>>> ====
> >>>>>>>>> ===========
> >>>>>>>>> ---
> >>>>>>>>> jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
> >>>>>>>>> owCo
> >>>>>>>>> lCon
> >>>>>>>>> tainer.java
> >>>>>>>>> (original)
> >>>>>>>>> +++
> >>>>>>>>> jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
> >>>>>>>>> owCo
> >>>>>>>>> lCon
> >>>>>>>>> tainer.java
> >>>>>>>>> Mon Dec 24 13:13:31 2018
> >>>>>>>>> @@ -23,9 +23,14 @@ import static org.junit.Assert.assertNot
> >>>>>>>>>   import static org.junit.Assert.assertTrue;
> >>>>>>>>>   import static org.junit.Assert.fail;
> >>>>>>>>>
> >>>>>>>>> +import java.io.File;
> >>>>>>>>>   import java.nio.file.NoSuchFileException;
> >>>>>>>>>
> >>>>>>>>>   import org.apache.jmeter.junit.JMeterTestCase;
> >>>>>>>>> +import org.apache.jmeter.services.FileServer;
> >>>>>>>>> +import org.apache.jmeter.util.JMeterUtils;
> >>>>>>>>> +import org.junit.After;
> >>>>>>>>> +import org.junit.Before;
> >>>>>>>>>   import org.junit.Test;
> >>>>>>>>>
> >>>>>>>>>   /**
> >>>>>>>>> @@ -35,7 +40,20 @@ import org.junit.Test;
> >>>>>>>>>    */
> >>>>>>>>>   public class TestFileRowColContainer extends
> >>>>>>>>> JMeterTestCase {
> >>>>>>>>>
> >>>>>>>>> -    @Test(expected=NoSuchFileException.class)
> >>>>>>>>> +    private String defaultBase = null;
> >>>>>>>>> +
> >>>>>>>>> +    @Before
> >>>>>>>>> +    public void setUp() {
> >>>>>>>>> +        defaultBase = FileServer.getDefaultBase();
> >>>>>>>>> +        FileServer.getFileServer().setBase(new
> >>>>>>>>> File(JMeterUtils.getJMeterHome() + "/bin"));
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    @After
> >>>>>>>>> +    public void tearDown() {
> >>>>>>>>> +        FileServer.getFileServer().setBase(new
> >>>>>>>>> File(defaultBase));
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    @Test(expected = NoSuchFileException.class)
> >>>>>>>>>       public void testNull() throws Exception {
> >>>>>>>>>           new
> >>>>>>>>> FileRowColContainer(findTestPath("testfiles/xyzxyz"));
> >>>>>>>>>       }
> >>>>>>>>> @@ -46,6 +64,20 @@ public class TestFileRowColContainer ext
> >>>>>>>>>           assertNotNull(f);
> >>>>>>>>>           assertEquals("Expected 4 lines", 4, f.getSize());
> >>>>>>>>>
> >>>>>>>>> +        assertEquals(0, f.nextRow());
> >>>>>>>>> +        assertEquals(1, f.nextRow());
> >>>>>>>>> +        assertEquals(2, f.nextRow());
> >>>>>>>>> +        assertEquals(3, f.nextRow());
> >>>>>>>>> +        assertEquals(0, f.nextRow());
> >>>>>>>>> +
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    @Test
> >>>>>>>>> +    public void testRowNumRelative() throws Exception {
> >>>>>>>>> +        FileRowColContainer f = new
> >>>>>>>>> FileRowColContainer("testfiles/unit/TestFileRowColContainer
> >>>>>>>>> .csv
> >>>>>>>>> ");
> >>>>>>>>> +        assertNotNull(f);
> >>>>>>>>> +        assertEquals("Expected 4 lines", 4, f.getSize());
> >>>>>>>>> +
> >>>>>>>>>           assertEquals(0, f.nextRow());
> >>>>>>>>>           assertEquals(1, f.nextRow());
> >>>>>>>>>           assertEquals(2, f.nextRow());
> >>>>>>>>>
> >>>>>>>>> Modified: jmeter/trunk/xdocs/changes.xml
> >>>>>>>>> URL:
> >>>>>>>>>
> >>>>>>>
> >>>>>
> >>> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1849687&r1=1849686&r2=1849687&view=diff
> >>>>>>>>> ===========================================================
> >>>>>>>>> ====
> >>>>>>>>> ====
> >>>>>>>>> ===========
> >>>>>>>>> --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
> >>>>>>>>> +++ jmeter/trunk/xdocs/changes.xml [utf-8] Mon Dec 24
> >>>>>>>>> 13:13:31
> >>>>>>>>> 2018
> >>>>>>>>> @@ -105,6 +105,7 @@ of previous time slot as a base.
> >>>>>>>>> Startin
> >>>>>>>>>
> >>>>>>>>>   <h3>Functions</h3>
> >>>>>>>>>   <ul>
> >>>>>>>>> +  <li><bug>63037</bug>When using <code>CSVRead</code>
> >>>>>>>>> search
> >>>>>>>>> the
> >>>>>>>>> script
> >>>>>>>>> base path for files, too.</li>
> >>>>>>>>>   </ul>
> >>>>>>>>>
> >>>>>>>>>   <h3>I18N</h3>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>
> >>>
> >> --
> >> Cordialement.
> >> Philippe Mouawad.
> >>
> >>
> >>
> >>

Re: svn commit: r1849687 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/FileRowColContainer.java test/src/org/apache/jmeter/functions/TestFileRowColContainer.java xdocs/changes.xml

Posted by Felix Schumacher <fe...@internetallee.de>.
Am 29.12.18 um 12:15 schrieb Philippe Mouawad:
> Hello Felix,
> I made a commit yesterday illustrating what I was proposing.
> Nightly builds passed but It may be too early to conclude.
> Does it look ok to you ?

I hadn't thought about that interface. It will probably lessen the 
chance that we hit the bug in our setup, but it is still present for all 
systems, that don't know about the semantic of that interface.

Let us see, what the next nightlys might bring.

Felix

>
> Thanks
>
> On Fri, Dec 28, 2018 at 8:29 PM Philippe Mouawad <ph...@gmail.com>
> wrote:
>
>> Hi Felix,
>> Isn’t it fixed if we make test that touch base non parallel?
>>
>> It’s an interface to add .
>> Or did i not understand the problem ?
>>
>> Thanks
>>
>> On Friday, December 28, 2018, Felix Schumacher <
>> felix.schumacher@internetallee.de> wrote:
>>
>>> Am Freitag, den 28.12.2018, 17:41 +0000 schrieb sebb:
>>>> On Fri, 28 Dec 2018 at 12:59, Felix Schumacher
>>>> <fe...@internetallee.de> wrote:
>>>>> Am Freitag, den 28.12.2018, 11:32 +0000 schrieb sebb:
>>>>>> On Fri, 28 Dec 2018 at 10:35, Felix Schumacher
>>>>>> <fe...@internetallee.de> wrote:
>>>>>>> Am Freitag, den 28.12.2018, 08:24 +0100 schrieb Philippe
>>>>>>> Mouawad:
>>>>>>>> Hello,
>>>>>>>> It seems this commit introduces random failures on nightly
>>>>>>>> build:
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>
>>> https://ci.apache.org/builders/jmeter-nightly/builds/1264/steps/shell_5/logs/stdio
>>>>>>> The test fails at
>>>>>>>
>>>>>>> 1)
>>>>>>> testColumns(org.apache.jmeter.functions.TestFileRowColContainer
>>>>>>> )
>>>>>>>       [java] java.lang.NullPointerException
>>>>>>>       [java]     at
>>>>>>> org.apache.jmeter.services.FileServer$FileEntry.access$200(File
>>>>>>> Serv
>>>>>>> er.j
>>>>>>> ava:534)
>>>>>>>       [java]     at
>>>>>>> org.apache.jmeter.services.FileServer.getResolvedFile(FileServe
>>>>>>> r.ja
>>>>>>> va:5
>>>>>>> 31)
>>>>>>>       [java]     at
>>>>>>> org.apache.jmeter.functions.FileRowColContainer.load(FileRowCol
>>>>>>> Cont
>>>>>>> aine
>>>>>>> r.java:78)
>>>>>>>       [java]     at
>>>>>>> org.apache.jmeter.functions.FileRowColContainer.<init>(FileRowC
>>>>>>> olCo
>>>>>>> ntai
>>>>>>> ner.java:73)
>>>>>>>       [java]     at
>>>>>>> org.apache.jmeter.functions.TestFileRowColContainer.testColumns
>>>>>>> (Tes
>>>>>>> tFil
>>>>>>> eRowColContainer.java:91)
>>>>>>>       [java]     at
>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>>>>> Method)
>>>>>>>       [java]     at
>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccesso
>>>>>>> rImp
>>>>>>> l.ja
>>>>>>> va:62)
>>>>>>>       [java]     at
>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMetho
>>>>>>> dAcc
>>>>>>> esso
>>>>>>> rImpl.java:43)
>>>>>>>       [java]     at
>>>>>>> java.lang.reflect.Method.invoke(Method.java:498)
>>>>>>>       [java]     at
>>>>>>> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(Fra
>>>>>>> mewo
>>>>>>> rkMe
>>>>>>> thod.java:50)
>>>>>>>       [java]     at
>>>>>>> org.junit.internal.runners.model.ReflectiveCallable.run(Reflect
>>>>>>> iveC
>>>>>>> alla
>>>>>>> ble.java:12)
>>>>>>>       [java]     at
>>>>>>> org.junit.runners.model.FrameworkMethod.invokeExplosively(Frame
>>>>>>> work
>>>>>>> Meth
>>>>>>> od.java:47)
>>>>>>>       [java]     at
>>>>>>> org.junit.internal.runners.statements.InvokeMethod.evaluate(Inv
>>>>>>> okeM
>>>>>>> etho
>>>>>>> d.java:17)
>>>>>>>       [java]     at
>>>>>>> org.junit.internal.runners.statements.RunBefores.evaluate(RunBe
>>>>>>> fore
>>>>>>> s.ja
>>>>>>> va:26)
>>>>>>>       [java]     at
>>>>>>> org.junit.internal.runners.statements.RunAfters.evaluate(RunAft
>>>>>>> ers.
>>>>>>> java
>>>>>>> :27)
>>>>>>>       [java]     at
>>>>>>> org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>>>>>>>       [java]     at
>>>>>>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4Cl
>>>>>>> assR
>>>>>>> unne
>>>>>>> r.java:78)
>>>>>>>       [java]     at
>>>>>>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4Cl
>>>>>>> assR
>>>>>>> unne
>>>>>>> r.java:57)
>>>>>>>       [java]     at
>>>>>>> org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>>>>>>>       [java]     at
>>>>>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.j
>>>>>>> ava:
>>>>>>> 511)
>>>>>>>       [java]     at
>>>>>>> java.util.concurrent.FutureTask.run(FutureTask.java:266)
>>>>>>>       [java]     at
>>>>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExe
>>>>>>> cuto
>>>>>>> r.ja
>>>>>>> va:1149)
>>>>>>>       [java]     at
>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolEx
>>>>>>> ecut
>>>>>>> or.j
>>>>>>> ava:624)
>>>>>>>       [java]     at java.lang.Thread.run(Thread.java:748)
>>>>>>>
>>>>>>> Especially the concurrent access makes me believe, that this is
>>>>>>> a
>>>>>>> problem with the test case and not the implementation.
>>>>>>>
>>>>>>> Originally this test had no script base set. I added a script
>>>>>>> base
>>>>>>> before each test and reset it to the one found before after the
>>>>>>> test.
>>>>>>>
>>>>>>> Now, when those tests are run in parallel, it can happen, that
>>>>>>> the
>>>>>>> first test sets a script base and remembers the original one.
>>>>>>> The
>>>>>>> next
>>>>>>> one starts before the first is finished and remembers the "set"
>>>>>>> base.
>>>>>>> When this test finishes it will "reset" the script base to the
>>>>>>> "set"
>>>>>>> base, which would be wrong.
>>>>>>>
>>>>>>> There are at least two options to get around this:
>>>>>>>
>>>>>>>   a) revert to state before the fix
>>>>>>>   b) only set the script base and don't reset it after the tests
>>>>>>>
>>>>>>> I don't want to take option a), but option b) will change the
>>>>>>> environment for all tests that run after these tests.
>>>>>>>
>>>>>>> What is your opionion on this (options plus explanation :)
>>>>>> AIUI there is only one script base for the whole of JMeter - is
>>>>>> that
>>>>>> correct?
>>>>>> If so, then it does not make sense to allow tests to run in
>>>>>> parallel.
>>>>> Thats my understanding as well, that all tests basically share one
>>>>> script base.
>>>>>
>>>>>> Each test must be allowed to complete (and tidy up if necessary)
>>>>>> before the next one starts.
>>>>> That is what I tried, but I think it fails in the described manner.
>>>> In which case there is likely some other bug that needs
>>>> investigation.
>>>> Either in the test case or the main JMeter code.
>>> Well, I thought I described the mistake I made, but it seems, that I
>>> didn't do a good enough job. So let me try with a diagram:
>>>
>>>    Thread A                         Thread B
>>>    save old script base
>>>    set new base
>>>                                     Save old script base
>>>    run test
>>>                                     set new base
>>>    reset base
>>>                                     run test -> BOOM
>>>
>>>
>>> That is a slight variation of my text version above.
>>>
>>> So we could get around it by setting the script base for all tests, or
>>> make those tests synchronized in some kind of manner.
>>>
>>>>> I could try option b) hoping, that the assumption - that we only
>>>>> use
>>>>> one script base - holds.
>>>> Whether or not there is only one script base should be clear by
>>>> inspection of the code.
>>> And hope, that that inspection is thorough enough.
>>>
>>> Regards,
>>>   Felix
>>>
>>>>> Felix
>>>>>
>>>>>>> Regards,
>>>>>>>   Felix
>>>>>>>
>>>>>>>> Regards
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Dec 24, 2018 at 2:13 PM <fs...@apache.org>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Author: fschumacher
>>>>>>>>> Date: Mon Dec 24 13:13:31 2018
>>>>>>>>> New Revision: 1849687
>>>>>>>>>
>>>>>>>>> URL: http://svn.apache.org/viewvc?rev=1849687&view=rev
>>>>>>>>> Log:
>>>>>>>>> When using CSVRead search the script base path for files,
>>>>>>>>> too.
>>>>>>>>>
>>>>>>>>> Bugzilla Id: 63037
>>>>>>>>>
>>>>>>>>> Modified:
>>>>>>>>>
>>>>>>>>> jmeter/trunk/src/functions/org/apache/jmeter/functions/File
>>>>>>>>> RowC
>>>>>>>>> olCo
>>>>>>>>> ntainer.java
>>>>>>>>>
>>>>>>>>> jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
>>>>>>>>> owCo
>>>>>>>>> lCon
>>>>>>>>> tainer.java
>>>>>>>>>      jmeter/trunk/xdocs/changes.xml
>>>>>>>>>
>>>>>>>>> Modified:
>>>>>>>>> jmeter/trunk/src/functions/org/apache/jmeter/functions/File
>>>>>>>>> RowC
>>>>>>>>> olCo
>>>>>>>>> ntainer.java
>>>>>>>>> URL:
>>>>>>>>>
>>>>>>>
>>>>>
>>> http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
>>>>>>>>> ===========================================================
>>>>>>>>> ====
>>>>>>>>> ====
>>>>>>>>> ===========
>>>>>>>>> ---
>>>>>>>>> jmeter/trunk/src/functions/org/apache/jmeter/functions/File
>>>>>>>>> RowC
>>>>>>>>> olCo
>>>>>>>>> ntainer.java
>>>>>>>>> (original)
>>>>>>>>> +++
>>>>>>>>> jmeter/trunk/src/functions/org/apache/jmeter/functions/File
>>>>>>>>> RowC
>>>>>>>>> olCo
>>>>>>>>> ntainer.java
>>>>>>>>> Mon Dec 24 13:13:31 2018
>>>>>>>>> @@ -19,7 +19,6 @@
>>>>>>>>>   package org.apache.jmeter.functions;
>>>>>>>>>
>>>>>>>>>   import java.io.BufferedReader;
>>>>>>>>> -import java.io.File;
>>>>>>>>>   import java.io.FileNotFoundException;
>>>>>>>>>   import java.io.IOException;
>>>>>>>>>   import java.nio.charset.Charset;
>>>>>>>>> @@ -28,6 +27,7 @@ import java.util.ArrayList;
>>>>>>>>>   import java.util.List;
>>>>>>>>>   import java.util.StringTokenizer;
>>>>>>>>>
>>>>>>>>> +import org.apache.jmeter.services.FileServer;
>>>>>>>>>   import org.apache.jmeter.util.JMeterUtils;
>>>>>>>>>   import org.slf4j.Logger;
>>>>>>>>>   import org.slf4j.LoggerFactory;
>>>>>>>>> @@ -75,7 +75,7 @@ public class FileRowColContainer {
>>>>>>>>>
>>>>>>>>>       private void load() throws IOException,
>>>>>>>>> FileNotFoundException
>>>>>>>>> {
>>>>>>>>>           try (BufferedReader myBread =
>>>>>>>>> -                Files.newBufferedReader(new
>>>>>>>>> File(fileName).toPath(),
>>>>>>>>> +
>>>>>>>>> Files.newBufferedReader(FileServer.getFileServer().getResol
>>>>>>>>> vedF
>>>>>>>>> ile(
>>>>>>>>> fileName).toPath(),
>>>>>>>>>
>>>>>>>>>                           Charset.defaultCharset())) {
>>>>>>>>>               String line = myBread.readLine();
>>>>>>>>>               /*
>>>>>>>>>
>>>>>>>>> Modified:
>>>>>>>>> jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
>>>>>>>>> owCo
>>>>>>>>> lCon
>>>>>>>>> tainer.java
>>>>>>>>> URL:
>>>>>>>>>
>>>>>>>
>>>>>
>>> http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
>>>>>>>>> ===========================================================
>>>>>>>>> ====
>>>>>>>>> ====
>>>>>>>>> ===========
>>>>>>>>> ---
>>>>>>>>> jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
>>>>>>>>> owCo
>>>>>>>>> lCon
>>>>>>>>> tainer.java
>>>>>>>>> (original)
>>>>>>>>> +++
>>>>>>>>> jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
>>>>>>>>> owCo
>>>>>>>>> lCon
>>>>>>>>> tainer.java
>>>>>>>>> Mon Dec 24 13:13:31 2018
>>>>>>>>> @@ -23,9 +23,14 @@ import static org.junit.Assert.assertNot
>>>>>>>>>   import static org.junit.Assert.assertTrue;
>>>>>>>>>   import static org.junit.Assert.fail;
>>>>>>>>>
>>>>>>>>> +import java.io.File;
>>>>>>>>>   import java.nio.file.NoSuchFileException;
>>>>>>>>>
>>>>>>>>>   import org.apache.jmeter.junit.JMeterTestCase;
>>>>>>>>> +import org.apache.jmeter.services.FileServer;
>>>>>>>>> +import org.apache.jmeter.util.JMeterUtils;
>>>>>>>>> +import org.junit.After;
>>>>>>>>> +import org.junit.Before;
>>>>>>>>>   import org.junit.Test;
>>>>>>>>>
>>>>>>>>>   /**
>>>>>>>>> @@ -35,7 +40,20 @@ import org.junit.Test;
>>>>>>>>>    */
>>>>>>>>>   public class TestFileRowColContainer extends
>>>>>>>>> JMeterTestCase {
>>>>>>>>>
>>>>>>>>> -    @Test(expected=NoSuchFileException.class)
>>>>>>>>> +    private String defaultBase = null;
>>>>>>>>> +
>>>>>>>>> +    @Before
>>>>>>>>> +    public void setUp() {
>>>>>>>>> +        defaultBase = FileServer.getDefaultBase();
>>>>>>>>> +        FileServer.getFileServer().setBase(new
>>>>>>>>> File(JMeterUtils.getJMeterHome() + "/bin"));
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    @After
>>>>>>>>> +    public void tearDown() {
>>>>>>>>> +        FileServer.getFileServer().setBase(new
>>>>>>>>> File(defaultBase));
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    @Test(expected = NoSuchFileException.class)
>>>>>>>>>       public void testNull() throws Exception {
>>>>>>>>>           new
>>>>>>>>> FileRowColContainer(findTestPath("testfiles/xyzxyz"));
>>>>>>>>>       }
>>>>>>>>> @@ -46,6 +64,20 @@ public class TestFileRowColContainer ext
>>>>>>>>>           assertNotNull(f);
>>>>>>>>>           assertEquals("Expected 4 lines", 4, f.getSize());
>>>>>>>>>
>>>>>>>>> +        assertEquals(0, f.nextRow());
>>>>>>>>> +        assertEquals(1, f.nextRow());
>>>>>>>>> +        assertEquals(2, f.nextRow());
>>>>>>>>> +        assertEquals(3, f.nextRow());
>>>>>>>>> +        assertEquals(0, f.nextRow());
>>>>>>>>> +
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    @Test
>>>>>>>>> +    public void testRowNumRelative() throws Exception {
>>>>>>>>> +        FileRowColContainer f = new
>>>>>>>>> FileRowColContainer("testfiles/unit/TestFileRowColContainer
>>>>>>>>> .csv
>>>>>>>>> ");
>>>>>>>>> +        assertNotNull(f);
>>>>>>>>> +        assertEquals("Expected 4 lines", 4, f.getSize());
>>>>>>>>> +
>>>>>>>>>           assertEquals(0, f.nextRow());
>>>>>>>>>           assertEquals(1, f.nextRow());
>>>>>>>>>           assertEquals(2, f.nextRow());
>>>>>>>>>
>>>>>>>>> Modified: jmeter/trunk/xdocs/changes.xml
>>>>>>>>> URL:
>>>>>>>>>
>>>>>>>
>>>>>
>>> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1849687&r1=1849686&r2=1849687&view=diff
>>>>>>>>> ===========================================================
>>>>>>>>> ====
>>>>>>>>> ====
>>>>>>>>> ===========
>>>>>>>>> --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
>>>>>>>>> +++ jmeter/trunk/xdocs/changes.xml [utf-8] Mon Dec 24
>>>>>>>>> 13:13:31
>>>>>>>>> 2018
>>>>>>>>> @@ -105,6 +105,7 @@ of previous time slot as a base.
>>>>>>>>> Startin
>>>>>>>>>
>>>>>>>>>   <h3>Functions</h3>
>>>>>>>>>   <ul>
>>>>>>>>> +  <li><bug>63037</bug>When using <code>CSVRead</code>
>>>>>>>>> search
>>>>>>>>> the
>>>>>>>>> script
>>>>>>>>> base path for files, too.</li>
>>>>>>>>>   </ul>
>>>>>>>>>
>>>>>>>>>   <h3>I18N</h3>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>
>> --
>> Cordialement.
>> Philippe Mouawad.
>>
>>
>>
>>

Re: svn commit: r1849687 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/FileRowColContainer.java test/src/org/apache/jmeter/functions/TestFileRowColContainer.java xdocs/changes.xml

Posted by Philippe Mouawad <ph...@gmail.com>.
Hello Felix,
I made a commit yesterday illustrating what I was proposing.
Nightly builds passed but It may be too early to conclude.
Does it look ok to you ?

Thanks

On Fri, Dec 28, 2018 at 8:29 PM Philippe Mouawad <ph...@gmail.com>
wrote:

> Hi Felix,
> Isn’t it fixed if we make test that touch base non parallel?
>
> It’s an interface to add .
> Or did i not understand the problem ?
>
> Thanks
>
> On Friday, December 28, 2018, Felix Schumacher <
> felix.schumacher@internetallee.de> wrote:
>
>> Am Freitag, den 28.12.2018, 17:41 +0000 schrieb sebb:
>> > On Fri, 28 Dec 2018 at 12:59, Felix Schumacher
>> > <fe...@internetallee.de> wrote:
>> > >
>> > > Am Freitag, den 28.12.2018, 11:32 +0000 schrieb sebb:
>> > > > On Fri, 28 Dec 2018 at 10:35, Felix Schumacher
>> > > > <fe...@internetallee.de> wrote:
>> > > > >
>> > > > > Am Freitag, den 28.12.2018, 08:24 +0100 schrieb Philippe
>> > > > > Mouawad:
>> > > > > > Hello,
>> > > > > > It seems this commit introduces random failures on nightly
>> > > > > > build:
>> > > > > >
>> > > > > >
>> > > > >
>> > > > >
>> > >
>> > >
>>
>> https://ci.apache.org/builders/jmeter-nightly/builds/1264/steps/shell_5/logs/stdio
>> > > > >
>> > > > > The test fails at
>> > > > >
>> > > > > 1)
>> > > > > testColumns(org.apache.jmeter.functions.TestFileRowColContainer
>> > > > > )
>> > > > >      [java] java.lang.NullPointerException
>> > > > >      [java]     at
>> > > > > org.apache.jmeter.services.FileServer$FileEntry.access$200(File
>> > > > > Serv
>> > > > > er.j
>> > > > > ava:534)
>> > > > >      [java]     at
>> > > > > org.apache.jmeter.services.FileServer.getResolvedFile(FileServe
>> > > > > r.ja
>> > > > > va:5
>> > > > > 31)
>> > > > >      [java]     at
>> > > > > org.apache.jmeter.functions.FileRowColContainer.load(FileRowCol
>> > > > > Cont
>> > > > > aine
>> > > > > r.java:78)
>> > > > >      [java]     at
>> > > > > org.apache.jmeter.functions.FileRowColContainer.<init>(FileRowC
>> > > > > olCo
>> > > > > ntai
>> > > > > ner.java:73)
>> > > > >      [java]     at
>> > > > > org.apache.jmeter.functions.TestFileRowColContainer.testColumns
>> > > > > (Tes
>> > > > > tFil
>> > > > > eRowColContainer.java:91)
>> > > > >      [java]     at
>> > > > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> > > > > Method)
>> > > > >      [java]     at
>> > > > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccesso
>> > > > > rImp
>> > > > > l.ja
>> > > > > va:62)
>> > > > >      [java]     at
>> > > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMetho
>> > > > > dAcc
>> > > > > esso
>> > > > > rImpl.java:43)
>> > > > >      [java]     at
>> > > > > java.lang.reflect.Method.invoke(Method.java:498)
>> > > > >      [java]     at
>> > > > > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(Fra
>> > > > > mewo
>> > > > > rkMe
>> > > > > thod.java:50)
>> > > > >      [java]     at
>> > > > > org.junit.internal.runners.model.ReflectiveCallable.run(Reflect
>> > > > > iveC
>> > > > > alla
>> > > > > ble.java:12)
>> > > > >      [java]     at
>> > > > > org.junit.runners.model.FrameworkMethod.invokeExplosively(Frame
>> > > > > work
>> > > > > Meth
>> > > > > od.java:47)
>> > > > >      [java]     at
>> > > > > org.junit.internal.runners.statements.InvokeMethod.evaluate(Inv
>> > > > > okeM
>> > > > > etho
>> > > > > d.java:17)
>> > > > >      [java]     at
>> > > > > org.junit.internal.runners.statements.RunBefores.evaluate(RunBe
>> > > > > fore
>> > > > > s.ja
>> > > > > va:26)
>> > > > >      [java]     at
>> > > > > org.junit.internal.runners.statements.RunAfters.evaluate(RunAft
>> > > > > ers.
>> > > > > java
>> > > > > :27)
>> > > > >      [java]     at
>> > > > > org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>> > > > >      [java]     at
>> > > > > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4Cl
>> > > > > assR
>> > > > > unne
>> > > > > r.java:78)
>> > > > >      [java]     at
>> > > > > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4Cl
>> > > > > assR
>> > > > > unne
>> > > > > r.java:57)
>> > > > >      [java]     at
>> > > > > org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>> > > > >      [java]     at
>> > > > > java.util.concurrent.Executors$RunnableAdapter.call(Executors.j
>> > > > > ava:
>> > > > > 511)
>> > > > >      [java]     at
>> > > > > java.util.concurrent.FutureTask.run(FutureTask.java:266)
>> > > > >      [java]     at
>> > > > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExe
>> > > > > cuto
>> > > > > r.ja
>> > > > > va:1149)
>> > > > >      [java]     at
>> > > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolEx
>> > > > > ecut
>> > > > > or.j
>> > > > > ava:624)
>> > > > >      [java]     at java.lang.Thread.run(Thread.java:748)
>> > > > >
>> > > > > Especially the concurrent access makes me believe, that this is
>> > > > > a
>> > > > > problem with the test case and not the implementation.
>> > > > >
>> > > > > Originally this test had no script base set. I added a script
>> > > > > base
>> > > > > before each test and reset it to the one found before after the
>> > > > > test.
>> > > > >
>> > > > > Now, when those tests are run in parallel, it can happen, that
>> > > > > the
>> > > > > first test sets a script base and remembers the original one.
>> > > > > The
>> > > > > next
>> > > > > one starts before the first is finished and remembers the "set"
>> > > > > base.
>> > > > > When this test finishes it will "reset" the script base to the
>> > > > > "set"
>> > > > > base, which would be wrong.
>> > > > >
>> > > > > There are at least two options to get around this:
>> > > > >
>> > > > >  a) revert to state before the fix
>> > > > >  b) only set the script base and don't reset it after the tests
>> > > > >
>> > > > > I don't want to take option a), but option b) will change the
>> > > > > environment for all tests that run after these tests.
>> > > > >
>> > > > > What is your opionion on this (options plus explanation :)
>> > > >
>> > > > AIUI there is only one script base for the whole of JMeter - is
>> > > > that
>> > > > correct?
>> > > > If so, then it does not make sense to allow tests to run in
>> > > > parallel.
>> > >
>> > > Thats my understanding as well, that all tests basically share one
>> > > script base.
>> > >
>> > > >
>> > > > Each test must be allowed to complete (and tidy up if necessary)
>> > > > before the next one starts.
>> > >
>> > > That is what I tried, but I think it fails in the described manner.
>> >
>> > In which case there is likely some other bug that needs
>> > investigation.
>> > Either in the test case or the main JMeter code.
>>
>> Well, I thought I described the mistake I made, but it seems, that I
>> didn't do a good enough job. So let me try with a diagram:
>>
>>   Thread A                         Thread B
>>   save old script base
>>   set new base
>>                                    Save old script base
>>   run test
>>                                    set new base
>>   reset base
>>                                    run test -> BOOM
>>
>>
>> That is a slight variation of my text version above.
>>
>> So we could get around it by setting the script base for all tests, or
>> make those tests synchronized in some kind of manner.
>>
>> >
>> > > I could try option b) hoping, that the assumption - that we only
>> > > use
>> > > one script base - holds.
>> >
>> > Whether or not there is only one script base should be clear by
>> > inspection of the code.
>>
>> And hope, that that inspection is thorough enough.
>>
>> Regards,
>>  Felix
>>
>> >
>> > > Felix
>> > >
>> > > >
>> > > > > Regards,
>> > > > >  Felix
>> > > > >
>> > > > > >
>> > > > > > Regards
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > On Mon, Dec 24, 2018 at 2:13 PM <fs...@apache.org>
>> > > > > > wrote:
>> > > > > >
>> > > > > > > Author: fschumacher
>> > > > > > > Date: Mon Dec 24 13:13:31 2018
>> > > > > > > New Revision: 1849687
>> > > > > > >
>> > > > > > > URL: http://svn.apache.org/viewvc?rev=1849687&view=rev
>> > > > > > > Log:
>> > > > > > > When using CSVRead search the script base path for files,
>> > > > > > > too.
>> > > > > > >
>> > > > > > > Bugzilla Id: 63037
>> > > > > > >
>> > > > > > > Modified:
>> > > > > > >
>> > > > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/File
>> > > > > > > RowC
>> > > > > > > olCo
>> > > > > > > ntainer.java
>> > > > > > >
>> > > > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
>> > > > > > > owCo
>> > > > > > > lCon
>> > > > > > > tainer.java
>> > > > > > >     jmeter/trunk/xdocs/changes.xml
>> > > > > > >
>> > > > > > > Modified:
>> > > > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/File
>> > > > > > > RowC
>> > > > > > > olCo
>> > > > > > > ntainer.java
>> > > > > > > URL:
>> > > > > > >
>> > > > >
>> > > > >
>> > >
>> > >
>>
>> http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
>> > > > > > >
>> > > > > > > ===========================================================
>> > > > > > > ====
>> > > > > > > ====
>> > > > > > > ===========
>> > > > > > > ---
>> > > > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/File
>> > > > > > > RowC
>> > > > > > > olCo
>> > > > > > > ntainer.java
>> > > > > > > (original)
>> > > > > > > +++
>> > > > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/File
>> > > > > > > RowC
>> > > > > > > olCo
>> > > > > > > ntainer.java
>> > > > > > > Mon Dec 24 13:13:31 2018
>> > > > > > > @@ -19,7 +19,6 @@
>> > > > > > >  package org.apache.jmeter.functions;
>> > > > > > >
>> > > > > > >  import java.io.BufferedReader;
>> > > > > > > -import java.io.File;
>> > > > > > >  import java.io.FileNotFoundException;
>> > > > > > >  import java.io.IOException;
>> > > > > > >  import java.nio.charset.Charset;
>> > > > > > > @@ -28,6 +27,7 @@ import java.util.ArrayList;
>> > > > > > >  import java.util.List;
>> > > > > > >  import java.util.StringTokenizer;
>> > > > > > >
>> > > > > > > +import org.apache.jmeter.services.FileServer;
>> > > > > > >  import org.apache.jmeter.util.JMeterUtils;
>> > > > > > >  import org.slf4j.Logger;
>> > > > > > >  import org.slf4j.LoggerFactory;
>> > > > > > > @@ -75,7 +75,7 @@ public class FileRowColContainer {
>> > > > > > >
>> > > > > > >      private void load() throws IOException,
>> > > > > > > FileNotFoundException
>> > > > > > > {
>> > > > > > >          try (BufferedReader myBread =
>> > > > > > > -                Files.newBufferedReader(new
>> > > > > > > File(fileName).toPath(),
>> > > > > > > +
>> > > > > > > Files.newBufferedReader(FileServer.getFileServer().getResol
>> > > > > > > vedF
>> > > > > > > ile(
>> > > > > > > fileName).toPath(),
>> > > > > > >
>> > > > > > >                          Charset.defaultCharset())) {
>> > > > > > >              String line = myBread.readLine();
>> > > > > > >              /*
>> > > > > > >
>> > > > > > > Modified:
>> > > > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
>> > > > > > > owCo
>> > > > > > > lCon
>> > > > > > > tainer.java
>> > > > > > > URL:
>> > > > > > >
>> > > > >
>> > > > >
>> > >
>> > >
>>
>> http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
>> > > > > > >
>> > > > > > > ===========================================================
>> > > > > > > ====
>> > > > > > > ====
>> > > > > > > ===========
>> > > > > > > ---
>> > > > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
>> > > > > > > owCo
>> > > > > > > lCon
>> > > > > > > tainer.java
>> > > > > > > (original)
>> > > > > > > +++
>> > > > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
>> > > > > > > owCo
>> > > > > > > lCon
>> > > > > > > tainer.java
>> > > > > > > Mon Dec 24 13:13:31 2018
>> > > > > > > @@ -23,9 +23,14 @@ import static org.junit.Assert.assertNot
>> > > > > > >  import static org.junit.Assert.assertTrue;
>> > > > > > >  import static org.junit.Assert.fail;
>> > > > > > >
>> > > > > > > +import java.io.File;
>> > > > > > >  import java.nio.file.NoSuchFileException;
>> > > > > > >
>> > > > > > >  import org.apache.jmeter.junit.JMeterTestCase;
>> > > > > > > +import org.apache.jmeter.services.FileServer;
>> > > > > > > +import org.apache.jmeter.util.JMeterUtils;
>> > > > > > > +import org.junit.After;
>> > > > > > > +import org.junit.Before;
>> > > > > > >  import org.junit.Test;
>> > > > > > >
>> > > > > > >  /**
>> > > > > > > @@ -35,7 +40,20 @@ import org.junit.Test;
>> > > > > > >   */
>> > > > > > >  public class TestFileRowColContainer extends
>> > > > > > > JMeterTestCase {
>> > > > > > >
>> > > > > > > -    @Test(expected=NoSuchFileException.class)
>> > > > > > > +    private String defaultBase = null;
>> > > > > > > +
>> > > > > > > +    @Before
>> > > > > > > +    public void setUp() {
>> > > > > > > +        defaultBase = FileServer.getDefaultBase();
>> > > > > > > +        FileServer.getFileServer().setBase(new
>> > > > > > > File(JMeterUtils.getJMeterHome() + "/bin"));
>> > > > > > > +    }
>> > > > > > > +
>> > > > > > > +    @After
>> > > > > > > +    public void tearDown() {
>> > > > > > > +        FileServer.getFileServer().setBase(new
>> > > > > > > File(defaultBase));
>> > > > > > > +    }
>> > > > > > > +
>> > > > > > > +    @Test(expected = NoSuchFileException.class)
>> > > > > > >      public void testNull() throws Exception {
>> > > > > > >          new
>> > > > > > > FileRowColContainer(findTestPath("testfiles/xyzxyz"));
>> > > > > > >      }
>> > > > > > > @@ -46,6 +64,20 @@ public class TestFileRowColContainer ext
>> > > > > > >          assertNotNull(f);
>> > > > > > >          assertEquals("Expected 4 lines", 4, f.getSize());
>> > > > > > >
>> > > > > > > +        assertEquals(0, f.nextRow());
>> > > > > > > +        assertEquals(1, f.nextRow());
>> > > > > > > +        assertEquals(2, f.nextRow());
>> > > > > > > +        assertEquals(3, f.nextRow());
>> > > > > > > +        assertEquals(0, f.nextRow());
>> > > > > > > +
>> > > > > > > +    }
>> > > > > > > +
>> > > > > > > +    @Test
>> > > > > > > +    public void testRowNumRelative() throws Exception {
>> > > > > > > +        FileRowColContainer f = new
>> > > > > > > FileRowColContainer("testfiles/unit/TestFileRowColContainer
>> > > > > > > .csv
>> > > > > > > ");
>> > > > > > > +        assertNotNull(f);
>> > > > > > > +        assertEquals("Expected 4 lines", 4, f.getSize());
>> > > > > > > +
>> > > > > > >          assertEquals(0, f.nextRow());
>> > > > > > >          assertEquals(1, f.nextRow());
>> > > > > > >          assertEquals(2, f.nextRow());
>> > > > > > >
>> > > > > > > Modified: jmeter/trunk/xdocs/changes.xml
>> > > > > > > URL:
>> > > > > > >
>> > > > >
>> > > > >
>> > >
>> > >
>>
>> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1849687&r1=1849686&r2=1849687&view=diff
>> > > > > > >
>> > > > > > > ===========================================================
>> > > > > > > ====
>> > > > > > > ====
>> > > > > > > ===========
>> > > > > > > --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
>> > > > > > > +++ jmeter/trunk/xdocs/changes.xml [utf-8] Mon Dec 24
>> > > > > > > 13:13:31
>> > > > > > > 2018
>> > > > > > > @@ -105,6 +105,7 @@ of previous time slot as a base.
>> > > > > > > Startin
>> > > > > > >
>> > > > > > >  <h3>Functions</h3>
>> > > > > > >  <ul>
>> > > > > > > +  <li><bug>63037</bug>When using <code>CSVRead</code>
>> > > > > > > search
>> > > > > > > the
>> > > > > > > script
>> > > > > > > base path for files, too.</li>
>> > > > > > >  </ul>
>> > > > > > >
>> > > > > > >  <h3>I18N</h3>
>> > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > >
>> > > > > >
>>
>>
>
> --
> Cordialement.
> Philippe Mouawad.
>
>
>
>

-- 
Cordialement.
Philippe Mouawad.

Re: svn commit: r1849687 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/FileRowColContainer.java test/src/org/apache/jmeter/functions/TestFileRowColContainer.java xdocs/changes.xml

Posted by Philippe Mouawad <ph...@gmail.com>.
Hi Felix,
Isn’t it fixed if we make test that touch base non parallel?

It’s an interface to add .
Or did i not understand the problem ?

Thanks

On Friday, December 28, 2018, Felix Schumacher <
felix.schumacher@internetallee.de> wrote:

> Am Freitag, den 28.12.2018, 17:41 +0000 schrieb sebb:
> > On Fri, 28 Dec 2018 at 12:59, Felix Schumacher
> > <fe...@internetallee.de> wrote:
> > >
> > > Am Freitag, den 28.12.2018, 11:32 +0000 schrieb sebb:
> > > > On Fri, 28 Dec 2018 at 10:35, Felix Schumacher
> > > > <fe...@internetallee.de> wrote:
> > > > >
> > > > > Am Freitag, den 28.12.2018, 08:24 +0100 schrieb Philippe
> > > > > Mouawad:
> > > > > > Hello,
> > > > > > It seems this commit introduces random failures on nightly
> > > > > > build:
> > > > > >
> > > > > >
> > > > >
> > > > >
> > >
> > >
> https://ci.apache.org/builders/jmeter-nightly/builds/1264/steps/shell_5/
> logs/stdio
> > > > >
> > > > > The test fails at
> > > > >
> > > > > 1)
> > > > > testColumns(org.apache.jmeter.functions.TestFileRowColContainer
> > > > > )
> > > > >      [java] java.lang.NullPointerException
> > > > >      [java]     at
> > > > > org.apache.jmeter.services.FileServer$FileEntry.access$200(File
> > > > > Serv
> > > > > er.j
> > > > > ava:534)
> > > > >      [java]     at
> > > > > org.apache.jmeter.services.FileServer.getResolvedFile(FileServe
> > > > > r.ja
> > > > > va:5
> > > > > 31)
> > > > >      [java]     at
> > > > > org.apache.jmeter.functions.FileRowColContainer.load(FileRowCol
> > > > > Cont
> > > > > aine
> > > > > r.java:78)
> > > > >      [java]     at
> > > > > org.apache.jmeter.functions.FileRowColContainer.<init>(FileRowC
> > > > > olCo
> > > > > ntai
> > > > > ner.java:73)
> > > > >      [java]     at
> > > > > org.apache.jmeter.functions.TestFileRowColContainer.testColumns
> > > > > (Tes
> > > > > tFil
> > > > > eRowColContainer.java:91)
> > > > >      [java]     at
> > > > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > > > Method)
> > > > >      [java]     at
> > > > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccesso
> > > > > rImp
> > > > > l.ja
> > > > > va:62)
> > > > >      [java]     at
> > > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMetho
> > > > > dAcc
> > > > > esso
> > > > > rImpl.java:43)
> > > > >      [java]     at
> > > > > java.lang.reflect.Method.invoke(Method.java:498)
> > > > >      [java]     at
> > > > > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(Fra
> > > > > mewo
> > > > > rkMe
> > > > > thod.java:50)
> > > > >      [java]     at
> > > > > org.junit.internal.runners.model.ReflectiveCallable.run(Reflect
> > > > > iveC
> > > > > alla
> > > > > ble.java:12)
> > > > >      [java]     at
> > > > > org.junit.runners.model.FrameworkMethod.invokeExplosively(Frame
> > > > > work
> > > > > Meth
> > > > > od.java:47)
> > > > >      [java]     at
> > > > > org.junit.internal.runners.statements.InvokeMethod.evaluate(Inv
> > > > > okeM
> > > > > etho
> > > > > d.java:17)
> > > > >      [java]     at
> > > > > org.junit.internal.runners.statements.RunBefores.evaluate(RunBe
> > > > > fore
> > > > > s.ja
> > > > > va:26)
> > > > >      [java]     at
> > > > > org.junit.internal.runners.statements.RunAfters.evaluate(RunAft
> > > > > ers.
> > > > > java
> > > > > :27)
> > > > >      [java]     at
> > > > > org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> > > > >      [java]     at
> > > > > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4Cl
> > > > > assR
> > > > > unne
> > > > > r.java:78)
> > > > >      [java]     at
> > > > > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4Cl
> > > > > assR
> > > > > unne
> > > > > r.java:57)
> > > > >      [java]     at
> > > > > org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> > > > >      [java]     at
> > > > > java.util.concurrent.Executors$RunnableAdapter.call(Executors.j
> > > > > ava:
> > > > > 511)
> > > > >      [java]     at
> > > > > java.util.concurrent.FutureTask.run(FutureTask.java:266)
> > > > >      [java]     at
> > > > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExe
> > > > > cuto
> > > > > r.ja
> > > > > va:1149)
> > > > >      [java]     at
> > > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolEx
> > > > > ecut
> > > > > or.j
> > > > > ava:624)
> > > > >      [java]     at java.lang.Thread.run(Thread.java:748)
> > > > >
> > > > > Especially the concurrent access makes me believe, that this is
> > > > > a
> > > > > problem with the test case and not the implementation.
> > > > >
> > > > > Originally this test had no script base set. I added a script
> > > > > base
> > > > > before each test and reset it to the one found before after the
> > > > > test.
> > > > >
> > > > > Now, when those tests are run in parallel, it can happen, that
> > > > > the
> > > > > first test sets a script base and remembers the original one.
> > > > > The
> > > > > next
> > > > > one starts before the first is finished and remembers the "set"
> > > > > base.
> > > > > When this test finishes it will "reset" the script base to the
> > > > > "set"
> > > > > base, which would be wrong.
> > > > >
> > > > > There are at least two options to get around this:
> > > > >
> > > > >  a) revert to state before the fix
> > > > >  b) only set the script base and don't reset it after the tests
> > > > >
> > > > > I don't want to take option a), but option b) will change the
> > > > > environment for all tests that run after these tests.
> > > > >
> > > > > What is your opionion on this (options plus explanation :)
> > > >
> > > > AIUI there is only one script base for the whole of JMeter - is
> > > > that
> > > > correct?
> > > > If so, then it does not make sense to allow tests to run in
> > > > parallel.
> > >
> > > Thats my understanding as well, that all tests basically share one
> > > script base.
> > >
> > > >
> > > > Each test must be allowed to complete (and tidy up if necessary)
> > > > before the next one starts.
> > >
> > > That is what I tried, but I think it fails in the described manner.
> >
> > In which case there is likely some other bug that needs
> > investigation.
> > Either in the test case or the main JMeter code.
>
> Well, I thought I described the mistake I made, but it seems, that I
> didn't do a good enough job. So let me try with a diagram:
>
>   Thread A                         Thread B
>   save old script base
>   set new base
>                                    Save old script base
>   run test
>                                    set new base
>   reset base
>                                    run test -> BOOM
>
>
> That is a slight variation of my text version above.
>
> So we could get around it by setting the script base for all tests, or
> make those tests synchronized in some kind of manner.
>
> >
> > > I could try option b) hoping, that the assumption - that we only
> > > use
> > > one script base - holds.
> >
> > Whether or not there is only one script base should be clear by
> > inspection of the code.
>
> And hope, that that inspection is thorough enough.
>
> Regards,
>  Felix
>
> >
> > > Felix
> > >
> > > >
> > > > > Regards,
> > > > >  Felix
> > > > >
> > > > > >
> > > > > > Regards
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > On Mon, Dec 24, 2018 at 2:13 PM <fs...@apache.org>
> > > > > > wrote:
> > > > > >
> > > > > > > Author: fschumacher
> > > > > > > Date: Mon Dec 24 13:13:31 2018
> > > > > > > New Revision: 1849687
> > > > > > >
> > > > > > > URL: http://svn.apache.org/viewvc?rev=1849687&view=rev
> > > > > > > Log:
> > > > > > > When using CSVRead search the script base path for files,
> > > > > > > too.
> > > > > > >
> > > > > > > Bugzilla Id: 63037
> > > > > > >
> > > > > > > Modified:
> > > > > > >
> > > > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/File
> > > > > > > RowC
> > > > > > > olCo
> > > > > > > ntainer.java
> > > > > > >
> > > > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
> > > > > > > owCo
> > > > > > > lCon
> > > > > > > tainer.java
> > > > > > >     jmeter/trunk/xdocs/changes.xml
> > > > > > >
> > > > > > > Modified:
> > > > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/File
> > > > > > > RowC
> > > > > > > olCo
> > > > > > > ntainer.java
> > > > > > > URL:
> > > > > > >
> > > > >
> > > > >
> > >
> > >
> http://svn.apache.org/viewvc/jmeter/trunk/src/functions/
> org/apache/jmeter/functions/FileRowColContainer.java?rev=
> 1849687&r1=1849686&r2=1849687&view=diff
> > > > > > >
> > > > > > > ===========================================================
> > > > > > > ====
> > > > > > > ====
> > > > > > > ===========
> > > > > > > ---
> > > > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/File
> > > > > > > RowC
> > > > > > > olCo
> > > > > > > ntainer.java
> > > > > > > (original)
> > > > > > > +++
> > > > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/File
> > > > > > > RowC
> > > > > > > olCo
> > > > > > > ntainer.java
> > > > > > > Mon Dec 24 13:13:31 2018
> > > > > > > @@ -19,7 +19,6 @@
> > > > > > >  package org.apache.jmeter.functions;
> > > > > > >
> > > > > > >  import java.io.BufferedReader;
> > > > > > > -import java.io.File;
> > > > > > >  import java.io.FileNotFoundException;
> > > > > > >  import java.io.IOException;
> > > > > > >  import java.nio.charset.Charset;
> > > > > > > @@ -28,6 +27,7 @@ import java.util.ArrayList;
> > > > > > >  import java.util.List;
> > > > > > >  import java.util.StringTokenizer;
> > > > > > >
> > > > > > > +import org.apache.jmeter.services.FileServer;
> > > > > > >  import org.apache.jmeter.util.JMeterUtils;
> > > > > > >  import org.slf4j.Logger;
> > > > > > >  import org.slf4j.LoggerFactory;
> > > > > > > @@ -75,7 +75,7 @@ public class FileRowColContainer {
> > > > > > >
> > > > > > >      private void load() throws IOException,
> > > > > > > FileNotFoundException
> > > > > > > {
> > > > > > >          try (BufferedReader myBread =
> > > > > > > -                Files.newBufferedReader(new
> > > > > > > File(fileName).toPath(),
> > > > > > > +
> > > > > > > Files.newBufferedReader(FileServer.getFileServer().getResol
> > > > > > > vedF
> > > > > > > ile(
> > > > > > > fileName).toPath(),
> > > > > > >
> > > > > > >                          Charset.defaultCharset())) {
> > > > > > >              String line = myBread.readLine();
> > > > > > >              /*
> > > > > > >
> > > > > > > Modified:
> > > > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
> > > > > > > owCo
> > > > > > > lCon
> > > > > > > tainer.java
> > > > > > > URL:
> > > > > > >
> > > > >
> > > > >
> > >
> > >
> http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/
> apache/jmeter/functions/TestFileRowColContainer.java?
> rev=1849687&r1=1849686&r2=1849687&view=diff
> > > > > > >
> > > > > > > ===========================================================
> > > > > > > ====
> > > > > > > ====
> > > > > > > ===========
> > > > > > > ---
> > > > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
> > > > > > > owCo
> > > > > > > lCon
> > > > > > > tainer.java
> > > > > > > (original)
> > > > > > > +++
> > > > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
> > > > > > > owCo
> > > > > > > lCon
> > > > > > > tainer.java
> > > > > > > Mon Dec 24 13:13:31 2018
> > > > > > > @@ -23,9 +23,14 @@ import static org.junit.Assert.assertNot
> > > > > > >  import static org.junit.Assert.assertTrue;
> > > > > > >  import static org.junit.Assert.fail;
> > > > > > >
> > > > > > > +import java.io.File;
> > > > > > >  import java.nio.file.NoSuchFileException;
> > > > > > >
> > > > > > >  import org.apache.jmeter.junit.JMeterTestCase;
> > > > > > > +import org.apache.jmeter.services.FileServer;
> > > > > > > +import org.apache.jmeter.util.JMeterUtils;
> > > > > > > +import org.junit.After;
> > > > > > > +import org.junit.Before;
> > > > > > >  import org.junit.Test;
> > > > > > >
> > > > > > >  /**
> > > > > > > @@ -35,7 +40,20 @@ import org.junit.Test;
> > > > > > >   */
> > > > > > >  public class TestFileRowColContainer extends
> > > > > > > JMeterTestCase {
> > > > > > >
> > > > > > > -    @Test(expected=NoSuchFileException.class)
> > > > > > > +    private String defaultBase = null;
> > > > > > > +
> > > > > > > +    @Before
> > > > > > > +    public void setUp() {
> > > > > > > +        defaultBase = FileServer.getDefaultBase();
> > > > > > > +        FileServer.getFileServer().setBase(new
> > > > > > > File(JMeterUtils.getJMeterHome() + "/bin"));
> > > > > > > +    }
> > > > > > > +
> > > > > > > +    @After
> > > > > > > +    public void tearDown() {
> > > > > > > +        FileServer.getFileServer().setBase(new
> > > > > > > File(defaultBase));
> > > > > > > +    }
> > > > > > > +
> > > > > > > +    @Test(expected = NoSuchFileException.class)
> > > > > > >      public void testNull() throws Exception {
> > > > > > >          new
> > > > > > > FileRowColContainer(findTestPath("testfiles/xyzxyz"));
> > > > > > >      }
> > > > > > > @@ -46,6 +64,20 @@ public class TestFileRowColContainer ext
> > > > > > >          assertNotNull(f);
> > > > > > >          assertEquals("Expected 4 lines", 4, f.getSize());
> > > > > > >
> > > > > > > +        assertEquals(0, f.nextRow());
> > > > > > > +        assertEquals(1, f.nextRow());
> > > > > > > +        assertEquals(2, f.nextRow());
> > > > > > > +        assertEquals(3, f.nextRow());
> > > > > > > +        assertEquals(0, f.nextRow());
> > > > > > > +
> > > > > > > +    }
> > > > > > > +
> > > > > > > +    @Test
> > > > > > > +    public void testRowNumRelative() throws Exception {
> > > > > > > +        FileRowColContainer f = new
> > > > > > > FileRowColContainer("testfiles/unit/TestFileRowColContainer
> > > > > > > .csv
> > > > > > > ");
> > > > > > > +        assertNotNull(f);
> > > > > > > +        assertEquals("Expected 4 lines", 4, f.getSize());
> > > > > > > +
> > > > > > >          assertEquals(0, f.nextRow());
> > > > > > >          assertEquals(1, f.nextRow());
> > > > > > >          assertEquals(2, f.nextRow());
> > > > > > >
> > > > > > > Modified: jmeter/trunk/xdocs/changes.xml
> > > > > > > URL:
> > > > > > >
> > > > >
> > > > >
> > >
> > >
> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.
> xml?rev=1849687&r1=1849686&r2=1849687&view=diff
> > > > > > >
> > > > > > > ===========================================================
> > > > > > > ====
> > > > > > > ====
> > > > > > > ===========
> > > > > > > --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
> > > > > > > +++ jmeter/trunk/xdocs/changes.xml [utf-8] Mon Dec 24
> > > > > > > 13:13:31
> > > > > > > 2018
> > > > > > > @@ -105,6 +105,7 @@ of previous time slot as a base.
> > > > > > > Startin
> > > > > > >
> > > > > > >  <h3>Functions</h3>
> > > > > > >  <ul>
> > > > > > > +  <li><bug>63037</bug>When using <code>CSVRead</code>
> > > > > > > search
> > > > > > > the
> > > > > > > script
> > > > > > > base path for files, too.</li>
> > > > > > >  </ul>
> > > > > > >
> > > > > > >  <h3>I18N</h3>
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
>
>

-- 
Cordialement.
Philippe Mouawad.

Re: svn commit: r1849687 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/FileRowColContainer.java test/src/org/apache/jmeter/functions/TestFileRowColContainer.java xdocs/changes.xml

Posted by Felix Schumacher <fe...@internetallee.de>.
Am Freitag, den 28.12.2018, 17:41 +0000 schrieb sebb:
> On Fri, 28 Dec 2018 at 12:59, Felix Schumacher
> <fe...@internetallee.de> wrote:
> > 
> > Am Freitag, den 28.12.2018, 11:32 +0000 schrieb sebb:
> > > On Fri, 28 Dec 2018 at 10:35, Felix Schumacher
> > > <fe...@internetallee.de> wrote:
> > > > 
> > > > Am Freitag, den 28.12.2018, 08:24 +0100 schrieb Philippe
> > > > Mouawad:
> > > > > Hello,
> > > > > It seems this commit introduces random failures on nightly
> > > > > build:
> > > > > 
> > > > > 
> > > > 
> > > > 
> > 
> > 
https://ci.apache.org/builders/jmeter-nightly/builds/1264/steps/shell_5/logs/stdio
> > > > 
> > > > The test fails at
> > > > 
> > > > 1)
> > > > testColumns(org.apache.jmeter.functions.TestFileRowColContainer
> > > > )
> > > >      [java] java.lang.NullPointerException
> > > >      [java]     at
> > > > org.apache.jmeter.services.FileServer$FileEntry.access$200(File
> > > > Serv
> > > > er.j
> > > > ava:534)
> > > >      [java]     at
> > > > org.apache.jmeter.services.FileServer.getResolvedFile(FileServe
> > > > r.ja
> > > > va:5
> > > > 31)
> > > >      [java]     at
> > > > org.apache.jmeter.functions.FileRowColContainer.load(FileRowCol
> > > > Cont
> > > > aine
> > > > r.java:78)
> > > >      [java]     at
> > > > org.apache.jmeter.functions.FileRowColContainer.<init>(FileRowC
> > > > olCo
> > > > ntai
> > > > ner.java:73)
> > > >      [java]     at
> > > > org.apache.jmeter.functions.TestFileRowColContainer.testColumns
> > > > (Tes
> > > > tFil
> > > > eRowColContainer.java:91)
> > > >      [java]     at
> > > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > > Method)
> > > >      [java]     at
> > > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccesso
> > > > rImp
> > > > l.ja
> > > > va:62)
> > > >      [java]     at
> > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMetho
> > > > dAcc
> > > > esso
> > > > rImpl.java:43)
> > > >      [java]     at
> > > > java.lang.reflect.Method.invoke(Method.java:498)
> > > >      [java]     at
> > > > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(Fra
> > > > mewo
> > > > rkMe
> > > > thod.java:50)
> > > >      [java]     at
> > > > org.junit.internal.runners.model.ReflectiveCallable.run(Reflect
> > > > iveC
> > > > alla
> > > > ble.java:12)
> > > >      [java]     at
> > > > org.junit.runners.model.FrameworkMethod.invokeExplosively(Frame
> > > > work
> > > > Meth
> > > > od.java:47)
> > > >      [java]     at
> > > > org.junit.internal.runners.statements.InvokeMethod.evaluate(Inv
> > > > okeM
> > > > etho
> > > > d.java:17)
> > > >      [java]     at
> > > > org.junit.internal.runners.statements.RunBefores.evaluate(RunBe
> > > > fore
> > > > s.ja
> > > > va:26)
> > > >      [java]     at
> > > > org.junit.internal.runners.statements.RunAfters.evaluate(RunAft
> > > > ers.
> > > > java
> > > > :27)
> > > >      [java]     at
> > > > org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> > > >      [java]     at
> > > > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4Cl
> > > > assR
> > > > unne
> > > > r.java:78)
> > > >      [java]     at
> > > > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4Cl
> > > > assR
> > > > unne
> > > > r.java:57)
> > > >      [java]     at
> > > > org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> > > >      [java]     at
> > > > java.util.concurrent.Executors$RunnableAdapter.call(Executors.j
> > > > ava:
> > > > 511)
> > > >      [java]     at
> > > > java.util.concurrent.FutureTask.run(FutureTask.java:266)
> > > >      [java]     at
> > > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExe
> > > > cuto
> > > > r.ja
> > > > va:1149)
> > > >      [java]     at
> > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolEx
> > > > ecut
> > > > or.j
> > > > ava:624)
> > > >      [java]     at java.lang.Thread.run(Thread.java:748)
> > > > 
> > > > Especially the concurrent access makes me believe, that this is
> > > > a
> > > > problem with the test case and not the implementation.
> > > > 
> > > > Originally this test had no script base set. I added a script
> > > > base
> > > > before each test and reset it to the one found before after the
> > > > test.
> > > > 
> > > > Now, when those tests are run in parallel, it can happen, that
> > > > the
> > > > first test sets a script base and remembers the original one.
> > > > The
> > > > next
> > > > one starts before the first is finished and remembers the "set"
> > > > base.
> > > > When this test finishes it will "reset" the script base to the
> > > > "set"
> > > > base, which would be wrong.
> > > > 
> > > > There are at least two options to get around this:
> > > > 
> > > >  a) revert to state before the fix
> > > >  b) only set the script base and don't reset it after the tests
> > > > 
> > > > I don't want to take option a), but option b) will change the
> > > > environment for all tests that run after these tests.
> > > > 
> > > > What is your opionion on this (options plus explanation :)
> > > 
> > > AIUI there is only one script base for the whole of JMeter - is
> > > that
> > > correct?
> > > If so, then it does not make sense to allow tests to run in
> > > parallel.
> > 
> > Thats my understanding as well, that all tests basically share one
> > script base.
> > 
> > > 
> > > Each test must be allowed to complete (and tidy up if necessary)
> > > before the next one starts.
> > 
> > That is what I tried, but I think it fails in the described manner.
> 
> In which case there is likely some other bug that needs
> investigation.
> Either in the test case or the main JMeter code.

Well, I thought I described the mistake I made, but it seems, that I
didn't do a good enough job. So let me try with a diagram:

  Thread A                         Thread B
  save old script base
  set new base
                                   Save old script base
  run test
                                   set new base
  reset base
                                   run test -> BOOM


That is a slight variation of my text version above.

So we could get around it by setting the script base for all tests, or
make those tests synchronized in some kind of manner.
  
> 
> > I could try option b) hoping, that the assumption - that we only
> > use
> > one script base - holds.
> 
> Whether or not there is only one script base should be clear by
> inspection of the code.

And hope, that that inspection is thorough enough.

Regards,
 Felix

> 
> > Felix
> > 
> > > 
> > > > Regards,
> > > >  Felix
> > > > 
> > > > > 
> > > > > Regards
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > On Mon, Dec 24, 2018 at 2:13 PM <fs...@apache.org>
> > > > > wrote:
> > > > > 
> > > > > > Author: fschumacher
> > > > > > Date: Mon Dec 24 13:13:31 2018
> > > > > > New Revision: 1849687
> > > > > > 
> > > > > > URL: http://svn.apache.org/viewvc?rev=1849687&view=rev
> > > > > > Log:
> > > > > > When using CSVRead search the script base path for files,
> > > > > > too.
> > > > > > 
> > > > > > Bugzilla Id: 63037
> > > > > > 
> > > > > > Modified:
> > > > > > 
> > > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/File
> > > > > > RowC
> > > > > > olCo
> > > > > > ntainer.java
> > > > > > 
> > > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
> > > > > > owCo
> > > > > > lCon
> > > > > > tainer.java
> > > > > >     jmeter/trunk/xdocs/changes.xml
> > > > > > 
> > > > > > Modified:
> > > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/File
> > > > > > RowC
> > > > > > olCo
> > > > > > ntainer.java
> > > > > > URL:
> > > > > > 
> > > > 
> > > > 
> > 
> > 
http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
> > > > > > 
> > > > > > ===========================================================
> > > > > > ====
> > > > > > ====
> > > > > > ===========
> > > > > > ---
> > > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/File
> > > > > > RowC
> > > > > > olCo
> > > > > > ntainer.java
> > > > > > (original)
> > > > > > +++
> > > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/File
> > > > > > RowC
> > > > > > olCo
> > > > > > ntainer.java
> > > > > > Mon Dec 24 13:13:31 2018
> > > > > > @@ -19,7 +19,6 @@
> > > > > >  package org.apache.jmeter.functions;
> > > > > > 
> > > > > >  import java.io.BufferedReader;
> > > > > > -import java.io.File;
> > > > > >  import java.io.FileNotFoundException;
> > > > > >  import java.io.IOException;
> > > > > >  import java.nio.charset.Charset;
> > > > > > @@ -28,6 +27,7 @@ import java.util.ArrayList;
> > > > > >  import java.util.List;
> > > > > >  import java.util.StringTokenizer;
> > > > > > 
> > > > > > +import org.apache.jmeter.services.FileServer;
> > > > > >  import org.apache.jmeter.util.JMeterUtils;
> > > > > >  import org.slf4j.Logger;
> > > > > >  import org.slf4j.LoggerFactory;
> > > > > > @@ -75,7 +75,7 @@ public class FileRowColContainer {
> > > > > > 
> > > > > >      private void load() throws IOException,
> > > > > > FileNotFoundException
> > > > > > {
> > > > > >          try (BufferedReader myBread =
> > > > > > -                Files.newBufferedReader(new
> > > > > > File(fileName).toPath(),
> > > > > > +
> > > > > > Files.newBufferedReader(FileServer.getFileServer().getResol
> > > > > > vedF
> > > > > > ile(
> > > > > > fileName).toPath(),
> > > > > > 
> > > > > >                          Charset.defaultCharset())) {
> > > > > >              String line = myBread.readLine();
> > > > > >              /*
> > > > > > 
> > > > > > Modified:
> > > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
> > > > > > owCo
> > > > > > lCon
> > > > > > tainer.java
> > > > > > URL:
> > > > > > 
> > > > 
> > > > 
> > 
> > 
http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
> > > > > > 
> > > > > > ===========================================================
> > > > > > ====
> > > > > > ====
> > > > > > ===========
> > > > > > ---
> > > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
> > > > > > owCo
> > > > > > lCon
> > > > > > tainer.java
> > > > > > (original)
> > > > > > +++
> > > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileR
> > > > > > owCo
> > > > > > lCon
> > > > > > tainer.java
> > > > > > Mon Dec 24 13:13:31 2018
> > > > > > @@ -23,9 +23,14 @@ import static org.junit.Assert.assertNot
> > > > > >  import static org.junit.Assert.assertTrue;
> > > > > >  import static org.junit.Assert.fail;
> > > > > > 
> > > > > > +import java.io.File;
> > > > > >  import java.nio.file.NoSuchFileException;
> > > > > > 
> > > > > >  import org.apache.jmeter.junit.JMeterTestCase;
> > > > > > +import org.apache.jmeter.services.FileServer;
> > > > > > +import org.apache.jmeter.util.JMeterUtils;
> > > > > > +import org.junit.After;
> > > > > > +import org.junit.Before;
> > > > > >  import org.junit.Test;
> > > > > > 
> > > > > >  /**
> > > > > > @@ -35,7 +40,20 @@ import org.junit.Test;
> > > > > >   */
> > > > > >  public class TestFileRowColContainer extends
> > > > > > JMeterTestCase {
> > > > > > 
> > > > > > -    @Test(expected=NoSuchFileException.class)
> > > > > > +    private String defaultBase = null;
> > > > > > +
> > > > > > +    @Before
> > > > > > +    public void setUp() {
> > > > > > +        defaultBase = FileServer.getDefaultBase();
> > > > > > +        FileServer.getFileServer().setBase(new
> > > > > > File(JMeterUtils.getJMeterHome() + "/bin"));
> > > > > > +    }
> > > > > > +
> > > > > > +    @After
> > > > > > +    public void tearDown() {
> > > > > > +        FileServer.getFileServer().setBase(new
> > > > > > File(defaultBase));
> > > > > > +    }
> > > > > > +
> > > > > > +    @Test(expected = NoSuchFileException.class)
> > > > > >      public void testNull() throws Exception {
> > > > > >          new
> > > > > > FileRowColContainer(findTestPath("testfiles/xyzxyz"));
> > > > > >      }
> > > > > > @@ -46,6 +64,20 @@ public class TestFileRowColContainer ext
> > > > > >          assertNotNull(f);
> > > > > >          assertEquals("Expected 4 lines", 4, f.getSize());
> > > > > > 
> > > > > > +        assertEquals(0, f.nextRow());
> > > > > > +        assertEquals(1, f.nextRow());
> > > > > > +        assertEquals(2, f.nextRow());
> > > > > > +        assertEquals(3, f.nextRow());
> > > > > > +        assertEquals(0, f.nextRow());
> > > > > > +
> > > > > > +    }
> > > > > > +
> > > > > > +    @Test
> > > > > > +    public void testRowNumRelative() throws Exception {
> > > > > > +        FileRowColContainer f = new
> > > > > > FileRowColContainer("testfiles/unit/TestFileRowColContainer
> > > > > > .csv
> > > > > > ");
> > > > > > +        assertNotNull(f);
> > > > > > +        assertEquals("Expected 4 lines", 4, f.getSize());
> > > > > > +
> > > > > >          assertEquals(0, f.nextRow());
> > > > > >          assertEquals(1, f.nextRow());
> > > > > >          assertEquals(2, f.nextRow());
> > > > > > 
> > > > > > Modified: jmeter/trunk/xdocs/changes.xml
> > > > > > URL:
> > > > > > 
> > > > 
> > > > 
> > 
> > 
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1849687&r1=1849686&r2=1849687&view=diff
> > > > > > 
> > > > > > ===========================================================
> > > > > > ====
> > > > > > ====
> > > > > > ===========
> > > > > > --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
> > > > > > +++ jmeter/trunk/xdocs/changes.xml [utf-8] Mon Dec 24
> > > > > > 13:13:31
> > > > > > 2018
> > > > > > @@ -105,6 +105,7 @@ of previous time slot as a base.
> > > > > > Startin
> > > > > > 
> > > > > >  <h3>Functions</h3>
> > > > > >  <ul>
> > > > > > +  <li><bug>63037</bug>When using <code>CSVRead</code>
> > > > > > search
> > > > > > the
> > > > > > script
> > > > > > base path for files, too.</li>
> > > > > >  </ul>
> > > > > > 
> > > > > >  <h3>I18N</h3>
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > 
> > > > > 


Re: svn commit: r1849687 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/FileRowColContainer.java test/src/org/apache/jmeter/functions/TestFileRowColContainer.java xdocs/changes.xml

Posted by Philippe Mouawad <ph...@gmail.com>.
Hello,
What about making all test that are related to components used only
serially not run in parallel.

Either there’s a sync issue which I don’t think is the case here (file base
is only changed when loading a new file and it doesn’t happen in parallel),
or it’s a test issue (which IMO is the case) ,does running this test in
parallel makes sense ?

Regards

On Friday, December 28, 2018, sebb <se...@gmail.com> wrote:

> On Fri, 28 Dec 2018 at 12:59, Felix Schumacher
> <fe...@internetallee.de> wrote:
> >
> > Am Freitag, den 28.12.2018, 11:32 +0000 schrieb sebb:
> > > On Fri, 28 Dec 2018 at 10:35, Felix Schumacher
> > > <fe...@internetallee.de> wrote:
> > > >
> > > > Am Freitag, den 28.12.2018, 08:24 +0100 schrieb Philippe Mouawad:
> > > > > Hello,
> > > > > It seems this commit introduces random failures on nightly build:
> > > > >
> > > > >
> > > >
> > > >
> > https://ci.apache.org/builders/jmeter-nightly/builds/1264/steps/shell_5/
> logs/stdio
> > > >
> > > > The test fails at
> > > >
> > > > 1) testColumns(org.apache.jmeter.functions.TestFileRowColContainer)
> > > >      [java] java.lang.NullPointerException
> > > >      [java]     at
> > > > org.apache.jmeter.services.FileServer$FileEntry.access$200(FileServ
> > > > er.j
> > > > ava:534)
> > > >      [java]     at
> > > > org.apache.jmeter.services.FileServer.getResolvedFile(FileServer.ja
> > > > va:5
> > > > 31)
> > > >      [java]     at
> > > > org.apache.jmeter.functions.FileRowColContainer.load(FileRowColCont
> > > > aine
> > > > r.java:78)
> > > >      [java]     at
> > > > org.apache.jmeter.functions.FileRowColContainer.<init>(FileRowColCo
> > > > ntai
> > > > ner.java:73)
> > > >      [java]     at
> > > > org.apache.jmeter.functions.TestFileRowColContainer.testColumns(Tes
> > > > tFil
> > > > eRowColContainer.java:91)
> > > >      [java]     at
> > > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > > Method)
> > > >      [java]     at
> > > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImp
> > > > l.ja
> > > > va:62)
> > > >      [java]     at
> > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcc
> > > > esso
> > > > rImpl.java:43)
> > > >      [java]     at java.lang.reflect.Method.invoke(Method.java:498)
> > > >      [java]     at
> > > > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(Framewo
> > > > rkMe
> > > > thod.java:50)
> > > >      [java]     at
> > > > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveC
> > > > alla
> > > > ble.java:12)
> > > >      [java]     at
> > > > org.junit.runners.model.FrameworkMethod.invokeExplosively(Framework
> > > > Meth
> > > > od.java:47)
> > > >      [java]     at
> > > > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeM
> > > > etho
> > > > d.java:17)
> > > >      [java]     at
> > > > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefore
> > > > s.ja
> > > > va:26)
> > > >      [java]     at
> > > > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.
> > > > java
> > > > :27)
> > > >      [java]     at
> > > > org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> > > >      [java]     at
> > > > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassR
> > > > unne
> > > > r.java:78)
> > > >      [java]     at
> > > > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassR
> > > > unne
> > > > r.java:57)
> > > >      [java]     at
> > > > org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> > > >      [java]     at
> > > > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:
> > > > 511)
> > > >      [java]     at
> > > > java.util.concurrent.FutureTask.run(FutureTask.java:266)
> > > >      [java]     at
> > > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecuto
> > > > r.ja
> > > > va:1149)
> > > >      [java]     at
> > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecut
> > > > or.j
> > > > ava:624)
> > > >      [java]     at java.lang.Thread.run(Thread.java:748)
> > > >
> > > > Especially the concurrent access makes me believe, that this is a
> > > > problem with the test case and not the implementation.
> > > >
> > > > Originally this test had no script base set. I added a script base
> > > > before each test and reset it to the one found before after the
> > > > test.
> > > >
> > > > Now, when those tests are run in parallel, it can happen, that the
> > > > first test sets a script base and remembers the original one. The
> > > > next
> > > > one starts before the first is finished and remembers the "set"
> > > > base.
> > > > When this test finishes it will "reset" the script base to the
> > > > "set"
> > > > base, which would be wrong.
> > > >
> > > > There are at least two options to get around this:
> > > >
> > > >  a) revert to state before the fix
> > > >  b) only set the script base and don't reset it after the tests
> > > >
> > > > I don't want to take option a), but option b) will change the
> > > > environment for all tests that run after these tests.
> > > >
> > > > What is your opionion on this (options plus explanation :)
> > >
> > > AIUI there is only one script base for the whole of JMeter - is that
> > > correct?
> > > If so, then it does not make sense to allow tests to run in parallel.
> >
> > Thats my understanding as well, that all tests basically share one
> > script base.
> >
> > >
> > > Each test must be allowed to complete (and tidy up if necessary)
> > > before the next one starts.
> >
> > That is what I tried, but I think it fails in the described manner.
>
> In which case there is likely some other bug that needs investigation.
> Either in the test case or the main JMeter code.
>
> > I could try option b) hoping, that the assumption - that we only use
> > one script base - holds.
>
> Whether or not there is only one script base should be clear by
> inspection of the code.
>
> > Felix
> >
> > >
> > > > Regards,
> > > >  Felix
> > > >
> > > > >
> > > > > Regards
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Mon, Dec 24, 2018 at 2:13 PM <fs...@apache.org> wrote:
> > > > >
> > > > > > Author: fschumacher
> > > > > > Date: Mon Dec 24 13:13:31 2018
> > > > > > New Revision: 1849687
> > > > > >
> > > > > > URL: http://svn.apache.org/viewvc?rev=1849687&view=rev
> > > > > > Log:
> > > > > > When using CSVRead search the script base path for files, too.
> > > > > >
> > > > > > Bugzilla Id: 63037
> > > > > >
> > > > > > Modified:
> > > > > >
> > > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowC
> > > > > > olCo
> > > > > > ntainer.java
> > > > > >
> > > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowCo
> > > > > > lCon
> > > > > > tainer.java
> > > > > >     jmeter/trunk/xdocs/changes.xml
> > > > > >
> > > > > > Modified:
> > > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowC
> > > > > > olCo
> > > > > > ntainer.java
> > > > > > URL:
> > > > > >
> > > >
> > > >
> > http://svn.apache.org/viewvc/jmeter/trunk/src/functions/
> org/apache/jmeter/functions/FileRowColContainer.java?rev=
> 1849687&r1=1849686&r2=1849687&view=diff
> > > > > >
> > > > > > ===============================================================
> > > > > > ====
> > > > > > ===========
> > > > > > ---
> > > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowC
> > > > > > olCo
> > > > > > ntainer.java
> > > > > > (original)
> > > > > > +++
> > > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowC
> > > > > > olCo
> > > > > > ntainer.java
> > > > > > Mon Dec 24 13:13:31 2018
> > > > > > @@ -19,7 +19,6 @@
> > > > > >  package org.apache.jmeter.functions;
> > > > > >
> > > > > >  import java.io.BufferedReader;
> > > > > > -import java.io.File;
> > > > > >  import java.io.FileNotFoundException;
> > > > > >  import java.io.IOException;
> > > > > >  import java.nio.charset.Charset;
> > > > > > @@ -28,6 +27,7 @@ import java.util.ArrayList;
> > > > > >  import java.util.List;
> > > > > >  import java.util.StringTokenizer;
> > > > > >
> > > > > > +import org.apache.jmeter.services.FileServer;
> > > > > >  import org.apache.jmeter.util.JMeterUtils;
> > > > > >  import org.slf4j.Logger;
> > > > > >  import org.slf4j.LoggerFactory;
> > > > > > @@ -75,7 +75,7 @@ public class FileRowColContainer {
> > > > > >
> > > > > >      private void load() throws IOException,
> > > > > > FileNotFoundException
> > > > > > {
> > > > > >          try (BufferedReader myBread =
> > > > > > -                Files.newBufferedReader(new
> > > > > > File(fileName).toPath(),
> > > > > > +
> > > > > > Files.newBufferedReader(FileServer.getFileServer().getResolvedF
> > > > > > ile(
> > > > > > fileName).toPath(),
> > > > > >
> > > > > >                          Charset.defaultCharset())) {
> > > > > >              String line = myBread.readLine();
> > > > > >              /*
> > > > > >
> > > > > > Modified:
> > > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowCo
> > > > > > lCon
> > > > > > tainer.java
> > > > > > URL:
> > > > > >
> > > >
> > > >
> > http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/
> apache/jmeter/functions/TestFileRowColContainer.java?
> rev=1849687&r1=1849686&r2=1849687&view=diff
> > > > > >
> > > > > > ===============================================================
> > > > > > ====
> > > > > > ===========
> > > > > > ---
> > > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowCo
> > > > > > lCon
> > > > > > tainer.java
> > > > > > (original)
> > > > > > +++
> > > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowCo
> > > > > > lCon
> > > > > > tainer.java
> > > > > > Mon Dec 24 13:13:31 2018
> > > > > > @@ -23,9 +23,14 @@ import static org.junit.Assert.assertNot
> > > > > >  import static org.junit.Assert.assertTrue;
> > > > > >  import static org.junit.Assert.fail;
> > > > > >
> > > > > > +import java.io.File;
> > > > > >  import java.nio.file.NoSuchFileException;
> > > > > >
> > > > > >  import org.apache.jmeter.junit.JMeterTestCase;
> > > > > > +import org.apache.jmeter.services.FileServer;
> > > > > > +import org.apache.jmeter.util.JMeterUtils;
> > > > > > +import org.junit.After;
> > > > > > +import org.junit.Before;
> > > > > >  import org.junit.Test;
> > > > > >
> > > > > >  /**
> > > > > > @@ -35,7 +40,20 @@ import org.junit.Test;
> > > > > >   */
> > > > > >  public class TestFileRowColContainer extends JMeterTestCase {
> > > > > >
> > > > > > -    @Test(expected=NoSuchFileException.class)
> > > > > > +    private String defaultBase = null;
> > > > > > +
> > > > > > +    @Before
> > > > > > +    public void setUp() {
> > > > > > +        defaultBase = FileServer.getDefaultBase();
> > > > > > +        FileServer.getFileServer().setBase(new
> > > > > > File(JMeterUtils.getJMeterHome() + "/bin"));
> > > > > > +    }
> > > > > > +
> > > > > > +    @After
> > > > > > +    public void tearDown() {
> > > > > > +        FileServer.getFileServer().setBase(new
> > > > > > File(defaultBase));
> > > > > > +    }
> > > > > > +
> > > > > > +    @Test(expected = NoSuchFileException.class)
> > > > > >      public void testNull() throws Exception {
> > > > > >          new
> > > > > > FileRowColContainer(findTestPath("testfiles/xyzxyz"));
> > > > > >      }
> > > > > > @@ -46,6 +64,20 @@ public class TestFileRowColContainer ext
> > > > > >          assertNotNull(f);
> > > > > >          assertEquals("Expected 4 lines", 4, f.getSize());
> > > > > >
> > > > > > +        assertEquals(0, f.nextRow());
> > > > > > +        assertEquals(1, f.nextRow());
> > > > > > +        assertEquals(2, f.nextRow());
> > > > > > +        assertEquals(3, f.nextRow());
> > > > > > +        assertEquals(0, f.nextRow());
> > > > > > +
> > > > > > +    }
> > > > > > +
> > > > > > +    @Test
> > > > > > +    public void testRowNumRelative() throws Exception {
> > > > > > +        FileRowColContainer f = new
> > > > > > FileRowColContainer("testfiles/unit/TestFileRowColContainer.csv
> > > > > > ");
> > > > > > +        assertNotNull(f);
> > > > > > +        assertEquals("Expected 4 lines", 4, f.getSize());
> > > > > > +
> > > > > >          assertEquals(0, f.nextRow());
> > > > > >          assertEquals(1, f.nextRow());
> > > > > >          assertEquals(2, f.nextRow());
> > > > > >
> > > > > > Modified: jmeter/trunk/xdocs/changes.xml
> > > > > > URL:
> > > > > >
> > > >
> > > >
> > http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.
> xml?rev=1849687&r1=1849686&r2=1849687&view=diff
> > > > > >
> > > > > > ===============================================================
> > > > > > ====
> > > > > > ===========
> > > > > > --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
> > > > > > +++ jmeter/trunk/xdocs/changes.xml [utf-8] Mon Dec 24 13:13:31
> > > > > > 2018
> > > > > > @@ -105,6 +105,7 @@ of previous time slot as a base. Startin
> > > > > >
> > > > > >  <h3>Functions</h3>
> > > > > >  <ul>
> > > > > > +  <li><bug>63037</bug>When using <code>CSVRead</code> search
> > > > > > the
> > > > > > script
> > > > > > base path for files, too.</li>
> > > > > >  </ul>
> > > > > >
> > > > > >  <h3>I18N</h3>
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> >
>


-- 
Cordialement.
Philippe Mouawad.

Re: svn commit: r1849687 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/FileRowColContainer.java test/src/org/apache/jmeter/functions/TestFileRowColContainer.java xdocs/changes.xml

Posted by sebb <se...@gmail.com>.
On Fri, 28 Dec 2018 at 12:59, Felix Schumacher
<fe...@internetallee.de> wrote:
>
> Am Freitag, den 28.12.2018, 11:32 +0000 schrieb sebb:
> > On Fri, 28 Dec 2018 at 10:35, Felix Schumacher
> > <fe...@internetallee.de> wrote:
> > >
> > > Am Freitag, den 28.12.2018, 08:24 +0100 schrieb Philippe Mouawad:
> > > > Hello,
> > > > It seems this commit introduces random failures on nightly build:
> > > >
> > > >
> > >
> > >
> https://ci.apache.org/builders/jmeter-nightly/builds/1264/steps/shell_5/logs/stdio
> > >
> > > The test fails at
> > >
> > > 1) testColumns(org.apache.jmeter.functions.TestFileRowColContainer)
> > >      [java] java.lang.NullPointerException
> > >      [java]     at
> > > org.apache.jmeter.services.FileServer$FileEntry.access$200(FileServ
> > > er.j
> > > ava:534)
> > >      [java]     at
> > > org.apache.jmeter.services.FileServer.getResolvedFile(FileServer.ja
> > > va:5
> > > 31)
> > >      [java]     at
> > > org.apache.jmeter.functions.FileRowColContainer.load(FileRowColCont
> > > aine
> > > r.java:78)
> > >      [java]     at
> > > org.apache.jmeter.functions.FileRowColContainer.<init>(FileRowColCo
> > > ntai
> > > ner.java:73)
> > >      [java]     at
> > > org.apache.jmeter.functions.TestFileRowColContainer.testColumns(Tes
> > > tFil
> > > eRowColContainer.java:91)
> > >      [java]     at
> > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > Method)
> > >      [java]     at
> > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImp
> > > l.ja
> > > va:62)
> > >      [java]     at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcc
> > > esso
> > > rImpl.java:43)
> > >      [java]     at java.lang.reflect.Method.invoke(Method.java:498)
> > >      [java]     at
> > > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(Framewo
> > > rkMe
> > > thod.java:50)
> > >      [java]     at
> > > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveC
> > > alla
> > > ble.java:12)
> > >      [java]     at
> > > org.junit.runners.model.FrameworkMethod.invokeExplosively(Framework
> > > Meth
> > > od.java:47)
> > >      [java]     at
> > > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeM
> > > etho
> > > d.java:17)
> > >      [java]     at
> > > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefore
> > > s.ja
> > > va:26)
> > >      [java]     at
> > > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.
> > > java
> > > :27)
> > >      [java]     at
> > > org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> > >      [java]     at
> > > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassR
> > > unne
> > > r.java:78)
> > >      [java]     at
> > > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassR
> > > unne
> > > r.java:57)
> > >      [java]     at
> > > org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> > >      [java]     at
> > > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:
> > > 511)
> > >      [java]     at
> > > java.util.concurrent.FutureTask.run(FutureTask.java:266)
> > >      [java]     at
> > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecuto
> > > r.ja
> > > va:1149)
> > >      [java]     at
> > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecut
> > > or.j
> > > ava:624)
> > >      [java]     at java.lang.Thread.run(Thread.java:748)
> > >
> > > Especially the concurrent access makes me believe, that this is a
> > > problem with the test case and not the implementation.
> > >
> > > Originally this test had no script base set. I added a script base
> > > before each test and reset it to the one found before after the
> > > test.
> > >
> > > Now, when those tests are run in parallel, it can happen, that the
> > > first test sets a script base and remembers the original one. The
> > > next
> > > one starts before the first is finished and remembers the "set"
> > > base.
> > > When this test finishes it will "reset" the script base to the
> > > "set"
> > > base, which would be wrong.
> > >
> > > There are at least two options to get around this:
> > >
> > >  a) revert to state before the fix
> > >  b) only set the script base and don't reset it after the tests
> > >
> > > I don't want to take option a), but option b) will change the
> > > environment for all tests that run after these tests.
> > >
> > > What is your opionion on this (options plus explanation :)
> >
> > AIUI there is only one script base for the whole of JMeter - is that
> > correct?
> > If so, then it does not make sense to allow tests to run in parallel.
>
> Thats my understanding as well, that all tests basically share one
> script base.
>
> >
> > Each test must be allowed to complete (and tidy up if necessary)
> > before the next one starts.
>
> That is what I tried, but I think it fails in the described manner.

In which case there is likely some other bug that needs investigation.
Either in the test case or the main JMeter code.

> I could try option b) hoping, that the assumption - that we only use
> one script base - holds.

Whether or not there is only one script base should be clear by
inspection of the code.

> Felix
>
> >
> > > Regards,
> > >  Felix
> > >
> > > >
> > > > Regards
> > > >
> > > >
> > > >
> > > >
> > > > On Mon, Dec 24, 2018 at 2:13 PM <fs...@apache.org> wrote:
> > > >
> > > > > Author: fschumacher
> > > > > Date: Mon Dec 24 13:13:31 2018
> > > > > New Revision: 1849687
> > > > >
> > > > > URL: http://svn.apache.org/viewvc?rev=1849687&view=rev
> > > > > Log:
> > > > > When using CSVRead search the script base path for files, too.
> > > > >
> > > > > Bugzilla Id: 63037
> > > > >
> > > > > Modified:
> > > > >
> > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowC
> > > > > olCo
> > > > > ntainer.java
> > > > >
> > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowCo
> > > > > lCon
> > > > > tainer.java
> > > > >     jmeter/trunk/xdocs/changes.xml
> > > > >
> > > > > Modified:
> > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowC
> > > > > olCo
> > > > > ntainer.java
> > > > > URL:
> > > > >
> > >
> > >
> http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
> > > > >
> > > > > ===============================================================
> > > > > ====
> > > > > ===========
> > > > > ---
> > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowC
> > > > > olCo
> > > > > ntainer.java
> > > > > (original)
> > > > > +++
> > > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowC
> > > > > olCo
> > > > > ntainer.java
> > > > > Mon Dec 24 13:13:31 2018
> > > > > @@ -19,7 +19,6 @@
> > > > >  package org.apache.jmeter.functions;
> > > > >
> > > > >  import java.io.BufferedReader;
> > > > > -import java.io.File;
> > > > >  import java.io.FileNotFoundException;
> > > > >  import java.io.IOException;
> > > > >  import java.nio.charset.Charset;
> > > > > @@ -28,6 +27,7 @@ import java.util.ArrayList;
> > > > >  import java.util.List;
> > > > >  import java.util.StringTokenizer;
> > > > >
> > > > > +import org.apache.jmeter.services.FileServer;
> > > > >  import org.apache.jmeter.util.JMeterUtils;
> > > > >  import org.slf4j.Logger;
> > > > >  import org.slf4j.LoggerFactory;
> > > > > @@ -75,7 +75,7 @@ public class FileRowColContainer {
> > > > >
> > > > >      private void load() throws IOException,
> > > > > FileNotFoundException
> > > > > {
> > > > >          try (BufferedReader myBread =
> > > > > -                Files.newBufferedReader(new
> > > > > File(fileName).toPath(),
> > > > > +
> > > > > Files.newBufferedReader(FileServer.getFileServer().getResolvedF
> > > > > ile(
> > > > > fileName).toPath(),
> > > > >
> > > > >                          Charset.defaultCharset())) {
> > > > >              String line = myBread.readLine();
> > > > >              /*
> > > > >
> > > > > Modified:
> > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowCo
> > > > > lCon
> > > > > tainer.java
> > > > > URL:
> > > > >
> > >
> > >
> http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
> > > > >
> > > > > ===============================================================
> > > > > ====
> > > > > ===========
> > > > > ---
> > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowCo
> > > > > lCon
> > > > > tainer.java
> > > > > (original)
> > > > > +++
> > > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowCo
> > > > > lCon
> > > > > tainer.java
> > > > > Mon Dec 24 13:13:31 2018
> > > > > @@ -23,9 +23,14 @@ import static org.junit.Assert.assertNot
> > > > >  import static org.junit.Assert.assertTrue;
> > > > >  import static org.junit.Assert.fail;
> > > > >
> > > > > +import java.io.File;
> > > > >  import java.nio.file.NoSuchFileException;
> > > > >
> > > > >  import org.apache.jmeter.junit.JMeterTestCase;
> > > > > +import org.apache.jmeter.services.FileServer;
> > > > > +import org.apache.jmeter.util.JMeterUtils;
> > > > > +import org.junit.After;
> > > > > +import org.junit.Before;
> > > > >  import org.junit.Test;
> > > > >
> > > > >  /**
> > > > > @@ -35,7 +40,20 @@ import org.junit.Test;
> > > > >   */
> > > > >  public class TestFileRowColContainer extends JMeterTestCase {
> > > > >
> > > > > -    @Test(expected=NoSuchFileException.class)
> > > > > +    private String defaultBase = null;
> > > > > +
> > > > > +    @Before
> > > > > +    public void setUp() {
> > > > > +        defaultBase = FileServer.getDefaultBase();
> > > > > +        FileServer.getFileServer().setBase(new
> > > > > File(JMeterUtils.getJMeterHome() + "/bin"));
> > > > > +    }
> > > > > +
> > > > > +    @After
> > > > > +    public void tearDown() {
> > > > > +        FileServer.getFileServer().setBase(new
> > > > > File(defaultBase));
> > > > > +    }
> > > > > +
> > > > > +    @Test(expected = NoSuchFileException.class)
> > > > >      public void testNull() throws Exception {
> > > > >          new
> > > > > FileRowColContainer(findTestPath("testfiles/xyzxyz"));
> > > > >      }
> > > > > @@ -46,6 +64,20 @@ public class TestFileRowColContainer ext
> > > > >          assertNotNull(f);
> > > > >          assertEquals("Expected 4 lines", 4, f.getSize());
> > > > >
> > > > > +        assertEquals(0, f.nextRow());
> > > > > +        assertEquals(1, f.nextRow());
> > > > > +        assertEquals(2, f.nextRow());
> > > > > +        assertEquals(3, f.nextRow());
> > > > > +        assertEquals(0, f.nextRow());
> > > > > +
> > > > > +    }
> > > > > +
> > > > > +    @Test
> > > > > +    public void testRowNumRelative() throws Exception {
> > > > > +        FileRowColContainer f = new
> > > > > FileRowColContainer("testfiles/unit/TestFileRowColContainer.csv
> > > > > ");
> > > > > +        assertNotNull(f);
> > > > > +        assertEquals("Expected 4 lines", 4, f.getSize());
> > > > > +
> > > > >          assertEquals(0, f.nextRow());
> > > > >          assertEquals(1, f.nextRow());
> > > > >          assertEquals(2, f.nextRow());
> > > > >
> > > > > Modified: jmeter/trunk/xdocs/changes.xml
> > > > > URL:
> > > > >
> > >
> > >
> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1849687&r1=1849686&r2=1849687&view=diff
> > > > >
> > > > > ===============================================================
> > > > > ====
> > > > > ===========
> > > > > --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
> > > > > +++ jmeter/trunk/xdocs/changes.xml [utf-8] Mon Dec 24 13:13:31
> > > > > 2018
> > > > > @@ -105,6 +105,7 @@ of previous time slot as a base. Startin
> > > > >
> > > > >  <h3>Functions</h3>
> > > > >  <ul>
> > > > > +  <li><bug>63037</bug>When using <code>CSVRead</code> search
> > > > > the
> > > > > script
> > > > > base path for files, too.</li>
> > > > >  </ul>
> > > > >
> > > > >  <h3>I18N</h3>
> > > > >
> > > > >
> > > > >
> > > >
> > > >
>

Re: svn commit: r1849687 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/FileRowColContainer.java test/src/org/apache/jmeter/functions/TestFileRowColContainer.java xdocs/changes.xml

Posted by Felix Schumacher <fe...@internetallee.de>.
Am Freitag, den 28.12.2018, 11:32 +0000 schrieb sebb:
> On Fri, 28 Dec 2018 at 10:35, Felix Schumacher
> <fe...@internetallee.de> wrote:
> > 
> > Am Freitag, den 28.12.2018, 08:24 +0100 schrieb Philippe Mouawad:
> > > Hello,
> > > It seems this commit introduces random failures on nightly build:
> > > 
> > > 
> > 
> > 
https://ci.apache.org/builders/jmeter-nightly/builds/1264/steps/shell_5/logs/stdio
> > 
> > The test fails at
> > 
> > 1) testColumns(org.apache.jmeter.functions.TestFileRowColContainer)
> >      [java] java.lang.NullPointerException
> >      [java]     at
> > org.apache.jmeter.services.FileServer$FileEntry.access$200(FileServ
> > er.j
> > ava:534)
> >      [java]     at
> > org.apache.jmeter.services.FileServer.getResolvedFile(FileServer.ja
> > va:5
> > 31)
> >      [java]     at
> > org.apache.jmeter.functions.FileRowColContainer.load(FileRowColCont
> > aine
> > r.java:78)
> >      [java]     at
> > org.apache.jmeter.functions.FileRowColContainer.<init>(FileRowColCo
> > ntai
> > ner.java:73)
> >      [java]     at
> > org.apache.jmeter.functions.TestFileRowColContainer.testColumns(Tes
> > tFil
> > eRowColContainer.java:91)
> >      [java]     at
> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> >      [java]     at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImp
> > l.ja
> > va:62)
> >      [java]     at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcc
> > esso
> > rImpl.java:43)
> >      [java]     at java.lang.reflect.Method.invoke(Method.java:498)
> >      [java]     at
> > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(Framewo
> > rkMe
> > thod.java:50)
> >      [java]     at
> > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveC
> > alla
> > ble.java:12)
> >      [java]     at
> > org.junit.runners.model.FrameworkMethod.invokeExplosively(Framework
> > Meth
> > od.java:47)
> >      [java]     at
> > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeM
> > etho
> > d.java:17)
> >      [java]     at
> > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefore
> > s.ja
> > va:26)
> >      [java]     at
> > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.
> > java
> > :27)
> >      [java]     at
> > org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> >      [java]     at
> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassR
> > unne
> > r.java:78)
> >      [java]     at
> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassR
> > unne
> > r.java:57)
> >      [java]     at
> > org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> >      [java]     at
> > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:
> > 511)
> >      [java]     at
> > java.util.concurrent.FutureTask.run(FutureTask.java:266)
> >      [java]     at
> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecuto
> > r.ja
> > va:1149)
> >      [java]     at
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecut
> > or.j
> > ava:624)
> >      [java]     at java.lang.Thread.run(Thread.java:748)
> > 
> > Especially the concurrent access makes me believe, that this is a
> > problem with the test case and not the implementation.
> > 
> > Originally this test had no script base set. I added a script base
> > before each test and reset it to the one found before after the
> > test.
> > 
> > Now, when those tests are run in parallel, it can happen, that the
> > first test sets a script base and remembers the original one. The
> > next
> > one starts before the first is finished and remembers the "set"
> > base.
> > When this test finishes it will "reset" the script base to the
> > "set"
> > base, which would be wrong.
> > 
> > There are at least two options to get around this:
> > 
> >  a) revert to state before the fix
> >  b) only set the script base and don't reset it after the tests
> > 
> > I don't want to take option a), but option b) will change the
> > environment for all tests that run after these tests.
> > 
> > What is your opionion on this (options plus explanation :)
> 
> AIUI there is only one script base for the whole of JMeter - is that
> correct?
> If so, then it does not make sense to allow tests to run in parallel.

Thats my understanding as well, that all tests basically share one
script base.

> 
> Each test must be allowed to complete (and tidy up if necessary)
> before the next one starts.

That is what I tried, but I think it fails in the described manner.

I could try option b) hoping, that the assumption - that we only use
one script base - holds.

Felix

> 
> > Regards,
> >  Felix
> > 
> > > 
> > > Regards
> > > 
> > > 
> > > 
> > > 
> > > On Mon, Dec 24, 2018 at 2:13 PM <fs...@apache.org> wrote:
> > > 
> > > > Author: fschumacher
> > > > Date: Mon Dec 24 13:13:31 2018
> > > > New Revision: 1849687
> > > > 
> > > > URL: http://svn.apache.org/viewvc?rev=1849687&view=rev
> > > > Log:
> > > > When using CSVRead search the script base path for files, too.
> > > > 
> > > > Bugzilla Id: 63037
> > > > 
> > > > Modified:
> > > > 
> > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowC
> > > > olCo
> > > > ntainer.java
> > > > 
> > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowCo
> > > > lCon
> > > > tainer.java
> > > >     jmeter/trunk/xdocs/changes.xml
> > > > 
> > > > Modified:
> > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowC
> > > > olCo
> > > > ntainer.java
> > > > URL:
> > > > 
> > 
> > 
http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
> > > > 
> > > > ===============================================================
> > > > ====
> > > > ===========
> > > > ---
> > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowC
> > > > olCo
> > > > ntainer.java
> > > > (original)
> > > > +++
> > > > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowC
> > > > olCo
> > > > ntainer.java
> > > > Mon Dec 24 13:13:31 2018
> > > > @@ -19,7 +19,6 @@
> > > >  package org.apache.jmeter.functions;
> > > > 
> > > >  import java.io.BufferedReader;
> > > > -import java.io.File;
> > > >  import java.io.FileNotFoundException;
> > > >  import java.io.IOException;
> > > >  import java.nio.charset.Charset;
> > > > @@ -28,6 +27,7 @@ import java.util.ArrayList;
> > > >  import java.util.List;
> > > >  import java.util.StringTokenizer;
> > > > 
> > > > +import org.apache.jmeter.services.FileServer;
> > > >  import org.apache.jmeter.util.JMeterUtils;
> > > >  import org.slf4j.Logger;
> > > >  import org.slf4j.LoggerFactory;
> > > > @@ -75,7 +75,7 @@ public class FileRowColContainer {
> > > > 
> > > >      private void load() throws IOException,
> > > > FileNotFoundException
> > > > {
> > > >          try (BufferedReader myBread =
> > > > -                Files.newBufferedReader(new
> > > > File(fileName).toPath(),
> > > > +
> > > > Files.newBufferedReader(FileServer.getFileServer().getResolvedF
> > > > ile(
> > > > fileName).toPath(),
> > > > 
> > > >                          Charset.defaultCharset())) {
> > > >              String line = myBread.readLine();
> > > >              /*
> > > > 
> > > > Modified:
> > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowCo
> > > > lCon
> > > > tainer.java
> > > > URL:
> > > > 
> > 
> > 
http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
> > > > 
> > > > ===============================================================
> > > > ====
> > > > ===========
> > > > ---
> > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowCo
> > > > lCon
> > > > tainer.java
> > > > (original)
> > > > +++
> > > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowCo
> > > > lCon
> > > > tainer.java
> > > > Mon Dec 24 13:13:31 2018
> > > > @@ -23,9 +23,14 @@ import static org.junit.Assert.assertNot
> > > >  import static org.junit.Assert.assertTrue;
> > > >  import static org.junit.Assert.fail;
> > > > 
> > > > +import java.io.File;
> > > >  import java.nio.file.NoSuchFileException;
> > > > 
> > > >  import org.apache.jmeter.junit.JMeterTestCase;
> > > > +import org.apache.jmeter.services.FileServer;
> > > > +import org.apache.jmeter.util.JMeterUtils;
> > > > +import org.junit.After;
> > > > +import org.junit.Before;
> > > >  import org.junit.Test;
> > > > 
> > > >  /**
> > > > @@ -35,7 +40,20 @@ import org.junit.Test;
> > > >   */
> > > >  public class TestFileRowColContainer extends JMeterTestCase {
> > > > 
> > > > -    @Test(expected=NoSuchFileException.class)
> > > > +    private String defaultBase = null;
> > > > +
> > > > +    @Before
> > > > +    public void setUp() {
> > > > +        defaultBase = FileServer.getDefaultBase();
> > > > +        FileServer.getFileServer().setBase(new
> > > > File(JMeterUtils.getJMeterHome() + "/bin"));
> > > > +    }
> > > > +
> > > > +    @After
> > > > +    public void tearDown() {
> > > > +        FileServer.getFileServer().setBase(new
> > > > File(defaultBase));
> > > > +    }
> > > > +
> > > > +    @Test(expected = NoSuchFileException.class)
> > > >      public void testNull() throws Exception {
> > > >          new
> > > > FileRowColContainer(findTestPath("testfiles/xyzxyz"));
> > > >      }
> > > > @@ -46,6 +64,20 @@ public class TestFileRowColContainer ext
> > > >          assertNotNull(f);
> > > >          assertEquals("Expected 4 lines", 4, f.getSize());
> > > > 
> > > > +        assertEquals(0, f.nextRow());
> > > > +        assertEquals(1, f.nextRow());
> > > > +        assertEquals(2, f.nextRow());
> > > > +        assertEquals(3, f.nextRow());
> > > > +        assertEquals(0, f.nextRow());
> > > > +
> > > > +    }
> > > > +
> > > > +    @Test
> > > > +    public void testRowNumRelative() throws Exception {
> > > > +        FileRowColContainer f = new
> > > > FileRowColContainer("testfiles/unit/TestFileRowColContainer.csv
> > > > ");
> > > > +        assertNotNull(f);
> > > > +        assertEquals("Expected 4 lines", 4, f.getSize());
> > > > +
> > > >          assertEquals(0, f.nextRow());
> > > >          assertEquals(1, f.nextRow());
> > > >          assertEquals(2, f.nextRow());
> > > > 
> > > > Modified: jmeter/trunk/xdocs/changes.xml
> > > > URL:
> > > > 
> > 
> > 
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1849687&r1=1849686&r2=1849687&view=diff
> > > > 
> > > > ===============================================================
> > > > ====
> > > > ===========
> > > > --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
> > > > +++ jmeter/trunk/xdocs/changes.xml [utf-8] Mon Dec 24 13:13:31
> > > > 2018
> > > > @@ -105,6 +105,7 @@ of previous time slot as a base. Startin
> > > > 
> > > >  <h3>Functions</h3>
> > > >  <ul>
> > > > +  <li><bug>63037</bug>When using <code>CSVRead</code> search
> > > > the
> > > > script
> > > > base path for files, too.</li>
> > > >  </ul>
> > > > 
> > > >  <h3>I18N</h3>
> > > > 
> > > > 
> > > > 
> > > 
> > > 


Re: svn commit: r1849687 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/FileRowColContainer.java test/src/org/apache/jmeter/functions/TestFileRowColContainer.java xdocs/changes.xml

Posted by sebb <se...@gmail.com>.
On Fri, 28 Dec 2018 at 10:35, Felix Schumacher
<fe...@internetallee.de> wrote:
>
> Am Freitag, den 28.12.2018, 08:24 +0100 schrieb Philippe Mouawad:
> > Hello,
> > It seems this commit introduces random failures on nightly build:
> >
> >
> https://ci.apache.org/builders/jmeter-nightly/builds/1264/steps/shell_5/logs/stdio
>
> The test fails at
>
> 1) testColumns(org.apache.jmeter.functions.TestFileRowColContainer)
>      [java] java.lang.NullPointerException
>      [java]     at
> org.apache.jmeter.services.FileServer$FileEntry.access$200(FileServer.j
> ava:534)
>      [java]     at
> org.apache.jmeter.services.FileServer.getResolvedFile(FileServer.java:5
> 31)
>      [java]     at
> org.apache.jmeter.functions.FileRowColContainer.load(FileRowColContaine
> r.java:78)
>      [java]     at
> org.apache.jmeter.functions.FileRowColContainer.<init>(FileRowColContai
> ner.java:73)
>      [java]     at
> org.apache.jmeter.functions.TestFileRowColContainer.testColumns(TestFil
> eRowColContainer.java:91)
>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>      [java]     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
> va:62)
>      [java]     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
> rImpl.java:43)
>      [java]     at java.lang.reflect.Method.invoke(Method.java:498)
>      [java]     at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMe
> thod.java:50)
>      [java]     at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCalla
> ble.java:12)
>      [java]     at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMeth
> od.java:47)
>      [java]     at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMetho
> d.java:17)
>      [java]     at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.ja
> va:26)
>      [java]     at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java
> :27)
>      [java]     at
> org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>      [java]     at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunne
> r.java:78)
>      [java]     at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunne
> r.java:57)
>      [java]     at
> org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>      [java]     at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>      [java]     at
> java.util.concurrent.FutureTask.run(FutureTask.java:266)
>      [java]     at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.ja
> va:1149)
>      [java]     at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.j
> ava:624)
>      [java]     at java.lang.Thread.run(Thread.java:748)
>
> Especially the concurrent access makes me believe, that this is a
> problem with the test case and not the implementation.
>
> Originally this test had no script base set. I added a script base
> before each test and reset it to the one found before after the test.
>
> Now, when those tests are run in parallel, it can happen, that the
> first test sets a script base and remembers the original one. The next
> one starts before the first is finished and remembers the "set" base.
> When this test finishes it will "reset" the script base to the "set"
> base, which would be wrong.
>
> There are at least two options to get around this:
>
>  a) revert to state before the fix
>  b) only set the script base and don't reset it after the tests
>
> I don't want to take option a), but option b) will change the
> environment for all tests that run after these tests.
>
> What is your opionion on this (options plus explanation :)

AIUI there is only one script base for the whole of JMeter - is that correct?
If so, then it does not make sense to allow tests to run in parallel.

Each test must be allowed to complete (and tidy up if necessary)
before the next one starts.

> Regards,
>  Felix
>
> >
> > Regards
> >
> >
> >
> >
> > On Mon, Dec 24, 2018 at 2:13 PM <fs...@apache.org> wrote:
> >
> > > Author: fschumacher
> > > Date: Mon Dec 24 13:13:31 2018
> > > New Revision: 1849687
> > >
> > > URL: http://svn.apache.org/viewvc?rev=1849687&view=rev
> > > Log:
> > > When using CSVRead search the script base path for files, too.
> > >
> > > Bugzilla Id: 63037
> > >
> > > Modified:
> > >
> > > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColCo
> > > ntainer.java
> > >
> > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColCon
> > > tainer.java
> > >     jmeter/trunk/xdocs/changes.xml
> > >
> > > Modified:
> > > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColCo
> > > ntainer.java
> > > URL:
> > >
> http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
> > >
> > > ===================================================================
> > > ===========
> > > ---
> > > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColCo
> > > ntainer.java
> > > (original)
> > > +++
> > > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColCo
> > > ntainer.java
> > > Mon Dec 24 13:13:31 2018
> > > @@ -19,7 +19,6 @@
> > >  package org.apache.jmeter.functions;
> > >
> > >  import java.io.BufferedReader;
> > > -import java.io.File;
> > >  import java.io.FileNotFoundException;
> > >  import java.io.IOException;
> > >  import java.nio.charset.Charset;
> > > @@ -28,6 +27,7 @@ import java.util.ArrayList;
> > >  import java.util.List;
> > >  import java.util.StringTokenizer;
> > >
> > > +import org.apache.jmeter.services.FileServer;
> > >  import org.apache.jmeter.util.JMeterUtils;
> > >  import org.slf4j.Logger;
> > >  import org.slf4j.LoggerFactory;
> > > @@ -75,7 +75,7 @@ public class FileRowColContainer {
> > >
> > >      private void load() throws IOException, FileNotFoundException
> > > {
> > >          try (BufferedReader myBread =
> > > -                Files.newBufferedReader(new
> > > File(fileName).toPath(),
> > > +
> > > Files.newBufferedReader(FileServer.getFileServer().getResolvedFile(
> > > fileName).toPath(),
> > >
> > >                          Charset.defaultCharset())) {
> > >              String line = myBread.readLine();
> > >              /*
> > >
> > > Modified:
> > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColCon
> > > tainer.java
> > > URL:
> > >
> http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
> > >
> > > ===================================================================
> > > ===========
> > > ---
> > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColCon
> > > tainer.java
> > > (original)
> > > +++
> > > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColCon
> > > tainer.java
> > > Mon Dec 24 13:13:31 2018
> > > @@ -23,9 +23,14 @@ import static org.junit.Assert.assertNot
> > >  import static org.junit.Assert.assertTrue;
> > >  import static org.junit.Assert.fail;
> > >
> > > +import java.io.File;
> > >  import java.nio.file.NoSuchFileException;
> > >
> > >  import org.apache.jmeter.junit.JMeterTestCase;
> > > +import org.apache.jmeter.services.FileServer;
> > > +import org.apache.jmeter.util.JMeterUtils;
> > > +import org.junit.After;
> > > +import org.junit.Before;
> > >  import org.junit.Test;
> > >
> > >  /**
> > > @@ -35,7 +40,20 @@ import org.junit.Test;
> > >   */
> > >  public class TestFileRowColContainer extends JMeterTestCase {
> > >
> > > -    @Test(expected=NoSuchFileException.class)
> > > +    private String defaultBase = null;
> > > +
> > > +    @Before
> > > +    public void setUp() {
> > > +        defaultBase = FileServer.getDefaultBase();
> > > +        FileServer.getFileServer().setBase(new
> > > File(JMeterUtils.getJMeterHome() + "/bin"));
> > > +    }
> > > +
> > > +    @After
> > > +    public void tearDown() {
> > > +        FileServer.getFileServer().setBase(new File(defaultBase));
> > > +    }
> > > +
> > > +    @Test(expected = NoSuchFileException.class)
> > >      public void testNull() throws Exception {
> > >          new FileRowColContainer(findTestPath("testfiles/xyzxyz"));
> > >      }
> > > @@ -46,6 +64,20 @@ public class TestFileRowColContainer ext
> > >          assertNotNull(f);
> > >          assertEquals("Expected 4 lines", 4, f.getSize());
> > >
> > > +        assertEquals(0, f.nextRow());
> > > +        assertEquals(1, f.nextRow());
> > > +        assertEquals(2, f.nextRow());
> > > +        assertEquals(3, f.nextRow());
> > > +        assertEquals(0, f.nextRow());
> > > +
> > > +    }
> > > +
> > > +    @Test
> > > +    public void testRowNumRelative() throws Exception {
> > > +        FileRowColContainer f = new
> > > FileRowColContainer("testfiles/unit/TestFileRowColContainer.csv");
> > > +        assertNotNull(f);
> > > +        assertEquals("Expected 4 lines", 4, f.getSize());
> > > +
> > >          assertEquals(0, f.nextRow());
> > >          assertEquals(1, f.nextRow());
> > >          assertEquals(2, f.nextRow());
> > >
> > > Modified: jmeter/trunk/xdocs/changes.xml
> > > URL:
> > >
> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1849687&r1=1849686&r2=1849687&view=diff
> > >
> > > ===================================================================
> > > ===========
> > > --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
> > > +++ jmeter/trunk/xdocs/changes.xml [utf-8] Mon Dec 24 13:13:31 2018
> > > @@ -105,6 +105,7 @@ of previous time slot as a base. Startin
> > >
> > >  <h3>Functions</h3>
> > >  <ul>
> > > +  <li><bug>63037</bug>When using <code>CSVRead</code> search the
> > > script
> > > base path for files, too.</li>
> > >  </ul>
> > >
> > >  <h3>I18N</h3>
> > >
> > >
> > >
> >
> >
>

Re: svn commit: r1849687 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/FileRowColContainer.java test/src/org/apache/jmeter/functions/TestFileRowColContainer.java xdocs/changes.xml

Posted by Felix Schumacher <fe...@internetallee.de>.
Am Freitag, den 28.12.2018, 08:24 +0100 schrieb Philippe Mouawad:
> Hello,
> It seems this commit introduces random failures on nightly build:
> 
> 
https://ci.apache.org/builders/jmeter-nightly/builds/1264/steps/shell_5/logs/stdio

The test fails at

1) testColumns(org.apache.jmeter.functions.TestFileRowColContainer)
     [java] java.lang.NullPointerException
     [java] 	at
org.apache.jmeter.services.FileServer$FileEntry.access$200(FileServer.j
ava:534)
     [java] 	at
org.apache.jmeter.services.FileServer.getResolvedFile(FileServer.java:5
31)
     [java] 	at
org.apache.jmeter.functions.FileRowColContainer.load(FileRowColContaine
r.java:78)
     [java] 	at
org.apache.jmeter.functions.FileRowColContainer.<init>(FileRowColContai
ner.java:73)
     [java] 	at
org.apache.jmeter.functions.TestFileRowColContainer.testColumns(TestFil
eRowColContainer.java:91)
     [java] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
     [java] 	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
va:62)
     [java] 	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
rImpl.java:43)
     [java] 	at java.lang.reflect.Method.invoke(Method.java:498)
     [java] 	at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMe
thod.java:50)
     [java] 	at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCalla
ble.java:12)
     [java] 	at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMeth
od.java:47)
     [java] 	at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMetho
d.java:17)
     [java] 	at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.ja
va:26)
     [java] 	at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java
:27)
     [java] 	at
org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
     [java] 	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunne
r.java:78)
     [java] 	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunne
r.java:57)
     [java] 	at
org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
     [java] 	at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
     [java] 	at
java.util.concurrent.FutureTask.run(FutureTask.java:266)
     [java] 	at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.ja
va:1149)
     [java] 	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.j
ava:624)
     [java] 	at java.lang.Thread.run(Thread.java:748)

Especially the concurrent access makes me believe, that this is a
problem with the test case and not the implementation.

Originally this test had no script base set. I added a script base
before each test and reset it to the one found before after the test.

Now, when those tests are run in parallel, it can happen, that the
first test sets a script base and remembers the original one. The next
one starts before the first is finished and remembers the "set" base.
When this test finishes it will "reset" the script base to the "set"
base, which would be wrong.

There are at least two options to get around this:

 a) revert to state before the fix
 b) only set the script base and don't reset it after the tests

I don't want to take option a), but option b) will change the
environment for all tests that run after these tests.

What is your opionion on this (options plus explanation :)

Regards,
 Felix

> 
> Regards
> 
> 
> 
> 
> On Mon, Dec 24, 2018 at 2:13 PM <fs...@apache.org> wrote:
> 
> > Author: fschumacher
> > Date: Mon Dec 24 13:13:31 2018
> > New Revision: 1849687
> > 
> > URL: http://svn.apache.org/viewvc?rev=1849687&view=rev
> > Log:
> > When using CSVRead search the script base path for files, too.
> > 
> > Bugzilla Id: 63037
> > 
> > Modified:
> > 
> > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColCo
> > ntainer.java
> > 
> > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColCon
> > tainer.java
> >     jmeter/trunk/xdocs/changes.xml
> > 
> > Modified:
> > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColCo
> > ntainer.java
> > URL:
> > 
http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
> > 
> > ===================================================================
> > ===========
> > ---
> > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColCo
> > ntainer.java
> > (original)
> > +++
> > jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColCo
> > ntainer.java
> > Mon Dec 24 13:13:31 2018
> > @@ -19,7 +19,6 @@
> >  package org.apache.jmeter.functions;
> > 
> >  import java.io.BufferedReader;
> > -import java.io.File;
> >  import java.io.FileNotFoundException;
> >  import java.io.IOException;
> >  import java.nio.charset.Charset;
> > @@ -28,6 +27,7 @@ import java.util.ArrayList;
> >  import java.util.List;
> >  import java.util.StringTokenizer;
> > 
> > +import org.apache.jmeter.services.FileServer;
> >  import org.apache.jmeter.util.JMeterUtils;
> >  import org.slf4j.Logger;
> >  import org.slf4j.LoggerFactory;
> > @@ -75,7 +75,7 @@ public class FileRowColContainer {
> > 
> >      private void load() throws IOException, FileNotFoundException
> > {
> >          try (BufferedReader myBread =
> > -                Files.newBufferedReader(new
> > File(fileName).toPath(),
> > +
> > Files.newBufferedReader(FileServer.getFileServer().getResolvedFile(
> > fileName).toPath(),
> > 
> >                          Charset.defaultCharset())) {
> >              String line = myBread.readLine();
> >              /*
> > 
> > Modified:
> > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColCon
> > tainer.java
> > URL:
> > 
http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java?rev=1849687&r1=1849686&r2=1849687&view=diff
> > 
> > ===================================================================
> > ===========
> > ---
> > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColCon
> > tainer.java
> > (original)
> > +++
> > jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColCon
> > tainer.java
> > Mon Dec 24 13:13:31 2018
> > @@ -23,9 +23,14 @@ import static org.junit.Assert.assertNot
> >  import static org.junit.Assert.assertTrue;
> >  import static org.junit.Assert.fail;
> > 
> > +import java.io.File;
> >  import java.nio.file.NoSuchFileException;
> > 
> >  import org.apache.jmeter.junit.JMeterTestCase;
> > +import org.apache.jmeter.services.FileServer;
> > +import org.apache.jmeter.util.JMeterUtils;
> > +import org.junit.After;
> > +import org.junit.Before;
> >  import org.junit.Test;
> > 
> >  /**
> > @@ -35,7 +40,20 @@ import org.junit.Test;
> >   */
> >  public class TestFileRowColContainer extends JMeterTestCase {
> > 
> > -    @Test(expected=NoSuchFileException.class)
> > +    private String defaultBase = null;
> > +
> > +    @Before
> > +    public void setUp() {
> > +        defaultBase = FileServer.getDefaultBase();
> > +        FileServer.getFileServer().setBase(new
> > File(JMeterUtils.getJMeterHome() + "/bin"));
> > +    }
> > +
> > +    @After
> > +    public void tearDown() {
> > +        FileServer.getFileServer().setBase(new File(defaultBase));
> > +    }
> > +
> > +    @Test(expected = NoSuchFileException.class)
> >      public void testNull() throws Exception {
> >          new FileRowColContainer(findTestPath("testfiles/xyzxyz"));
> >      }
> > @@ -46,6 +64,20 @@ public class TestFileRowColContainer ext
> >          assertNotNull(f);
> >          assertEquals("Expected 4 lines", 4, f.getSize());
> > 
> > +        assertEquals(0, f.nextRow());
> > +        assertEquals(1, f.nextRow());
> > +        assertEquals(2, f.nextRow());
> > +        assertEquals(3, f.nextRow());
> > +        assertEquals(0, f.nextRow());
> > +
> > +    }
> > +
> > +    @Test
> > +    public void testRowNumRelative() throws Exception {
> > +        FileRowColContainer f = new
> > FileRowColContainer("testfiles/unit/TestFileRowColContainer.csv");
> > +        assertNotNull(f);
> > +        assertEquals("Expected 4 lines", 4, f.getSize());
> > +
> >          assertEquals(0, f.nextRow());
> >          assertEquals(1, f.nextRow());
> >          assertEquals(2, f.nextRow());
> > 
> > Modified: jmeter/trunk/xdocs/changes.xml
> > URL:
> > 
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1849687&r1=1849686&r2=1849687&view=diff
> > 
> > ===================================================================
> > ===========
> > --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
> > +++ jmeter/trunk/xdocs/changes.xml [utf-8] Mon Dec 24 13:13:31 2018
> > @@ -105,6 +105,7 @@ of previous time slot as a base. Startin
> > 
> >  <h3>Functions</h3>
> >  <ul>
> > +  <li><bug>63037</bug>When using <code>CSVRead</code> search the
> > script
> > base path for files, too.</li>
> >  </ul>
> > 
> >  <h3>I18N</h3>
> > 
> > 
> > 
> 
>