[GitHub] ant-antlibs-antunit pull request #1: Avoid potential thread safety issues in...

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] ant-antlibs-antunit pull request #1: Avoid potential thread safety issues in...

bodewig
GitHub user jaikiran opened a pull request:

    https://github.com/apache/ant-antlibs-antunit/pull/1

    Avoid potential thread safety issues in LogCapturer

    This commit is prompted by the exception I saw in one of the Ant Jenkins jobs which failed with:
   
    ```
    /home/jenkins/jenkins-slave/workspace/Ant-Build-Matrix-master-Linux/OS/xenial/jdk/JDK 1.8 (latest)/src/tests/antunit/taskdefs/exec/exec-test.xml:528: java.lang.NullPointerException
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:109)
    at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:155)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
    at org.apache.tools.ant.Task.perform(Task.java:350)
    at java.util.Vector.forEach(Vector.java:1275)
    at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:67)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
    at org.apache.tools.ant.Task.perform(Task.java:350)
    at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:393)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
    at org.apache.tools.ant.Task.perform(Task.java:350)
    at org.apache.tools.ant.Target.execute(Target.java:449)
    at org.apache.tools.ant.Target.performTasks(Target.java:470)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1392)
    at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1253)
    at org.apache.ant.antunit.AntUnitScriptRunner.runTarget(AntUnitScriptRunner.java:224)
    at org.apache.ant.antunit.AntUnitScriptRunner.runSuite(AntUnitScriptRunner.java:303)
    at org.apache.ant.antunit.AntUnit.doFile(AntUnit.java:268)
    at org.apache.ant.antunit.AntUnit.doResourceCollection(AntUnit.java:247)
    at org.apache.ant.antunit.AntUnit.execute(AntUnit.java:218)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
    at org.apache.tools.ant.Task.perform(Task.java:350)
    at org.apache.tools.ant.Target.execute(Target.java:449)
    at org.apache.tools.ant.Target.performTasks(Target.java:470)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1392)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1363)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1253)
    at org.apache.tools.ant.Main.runBuild(Main.java:845)
    at org.apache.tools.ant.Main.startAnt(Main.java:228)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
    Caused by: java.lang.NullPointerException
    at java.util.LinkedList$ListItr.next(LinkedList.java:893)
    at org.apache.ant.antunit.LogCapturer.getLog(LogCapturer.java:178)
    at org.apache.ant.antunit.LogCapturer.getInfoLog(LogCapturer.java:114)
    at org.apache.ant.antunit.LogContains.eval(LogContains.java:81)
    at org.apache.ant.antunit.AssertTask.execute(AssertTask.java:71)
    at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
    ... 48 more
    ```
    That specific race condition itself is somewhat handled by a previous commit in this project here https://github.com/apache/ant-antlibs-antunit/commit/7d62d95ab3a3df61937d2f66ad07fa75ed61aa75. But the `events` List is still susceptible to race conditions, hence this new commit.
   


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jaikiran/ant-antlibs-antunit master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/ant-antlibs-antunit/pull/1.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1
   
----
commit 2014f42d7e9c9b352ee381a67e89ec0d35b98acb
Author: Jaikiran Pai <jaikiran.pai@...>
Date:   2018-05-14T05:43:26Z

    Avoid potential thread safety issues in LogCapturer

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[GitHub] ant-antlibs-antunit issue #1: Avoid potential thread safety issues in LogCap...

bodewig
Github user bodewig commented on the issue:

    https://github.com/apache/ant-antlibs-antunit/pull/1
 
    looks good to me


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[GitHub] ant-antlibs-antunit pull request #1: Avoid potential thread safety issues in...

bodewig
In reply to this post by bodewig
Github user asfgit closed the pull request at:

    https://github.com/apache/ant-antlibs-antunit/pull/1


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[GitHub] ant-antlibs-antunit issue #1: Avoid potential thread safety issues in LogCap...

bodewig
In reply to this post by bodewig
Github user jaikiran commented on the issue:

    https://github.com/apache/ant-antlibs-antunit/pull/1
 
    Thank you. Merged.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]