You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by Ian Downes <ia...@gmail.com> on 2014/04/23 23:14:22 UTC

Review Request 20632: Fix and simplify the ProcTests for threads.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/20632/
-----------------------------------------------------------

Review request for mesos, Ben Mahler and Vinod Kone.


Bugs: MESOS-1152
    https://issues.apache.org/jira/browse/MESOS-1152


Repository: mesos-git


Description
-------

Using clone() directly for creating threads is not advised because glibc expects thread local storage to be set up in a particular way. If a glibc function (e.g., sleep) is called there's a race where the incorrectly set up TLS is sometimes discovered which crashes the thread and child, ultimately failing the test.

The MultipleThreads test has been greatly simplified to not use a forked child and to just use pthread_create in the test. The test now only checks the number of threads counted is correct, not their thread ids.


Diffs
-----

  3rdparty/libprocess/3rdparty/stout/tests/proc_tests.cpp 8ca6d80dbbd29ba0ead6bbb8a84e794eea0e1173 

Diff: https://reviews.apache.org/r/20632/diff/


Testing
-------

# gcc version 4.8.1 20130715 (Red Hat 4.8.1-4) (GCC)
./3rdparty/libprocess/3rdparty/stout-tests --gtest_repeat=1000 --gtest_filter="ProcTest*" --gtest_break_on_failure

# gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
./3rdparty/libprocess/3rdparty/stout-tests --gtest_repeat=1000 --gtest_filter="ProcTest*" --gtest_break_on_failure


Thanks,

Ian Downes


Re: Review Request 20632: Fix and simplify the ProcTests for threads.

Posted by Dominic Hamon <dh...@twopensource.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/20632/#review41215
-----------------------------------------------------------



3rdparty/libprocess/3rdparty/stout/tests/proc_tests.cpp
<https://reviews.apache.org/r/20632/#comment74650>

    size_t?



3rdparty/libprocess/3rdparty/stout/tests/proc_tests.cpp
<https://reviews.apache.org/r/20632/#comment74651>

    unsigned vs signed compare .. use size_t ?


- Dominic Hamon


On April 23, 2014, 2:14 p.m., Ian Downes wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/20632/
> -----------------------------------------------------------
> 
> (Updated April 23, 2014, 2:14 p.m.)
> 
> 
> Review request for mesos, Ben Mahler and Vinod Kone.
> 
> 
> Bugs: MESOS-1152
>     https://issues.apache.org/jira/browse/MESOS-1152
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Using clone() directly for creating threads is not advised because glibc expects thread local storage to be set up in a particular way. If a glibc function (e.g., sleep) is called there's a race where the incorrectly set up TLS is sometimes discovered which crashes the thread and child, ultimately failing the test.
> 
> The MultipleThreads test has been greatly simplified to not use a forked child and to just use pthread_create in the test. The test now only checks the number of threads counted is correct, not their thread ids.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/tests/proc_tests.cpp 8ca6d80dbbd29ba0ead6bbb8a84e794eea0e1173 
> 
> Diff: https://reviews.apache.org/r/20632/diff/
> 
> 
> Testing
> -------
> 
> # gcc version 4.8.1 20130715 (Red Hat 4.8.1-4) (GCC)
> ./3rdparty/libprocess/3rdparty/stout-tests --gtest_repeat=1000 --gtest_filter="ProcTest*" --gtest_break_on_failure
> 
> # gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
> ./3rdparty/libprocess/3rdparty/stout-tests --gtest_repeat=1000 --gtest_filter="ProcTest*" --gtest_break_on_failure
> 
> 
> Thanks,
> 
> Ian Downes
> 
>


Re: Review Request 20632: Fix and simplify the ProcTests for threads.

Posted by Ian Downes <ia...@gmail.com>.

> On April 23, 2014, 10:10 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/3rdparty/stout/tests/proc_tests.cpp, line 176
> > <https://reviews.apache.org/r/20632/diff/1/?file=566111#file566111line176>
> >
> >     Would it be better to pthread_kill or should we make the pthreads explicitly cancellable?

I'd rather use pthread_cancel than pthread_kill. Newly created threads have PTHREAD_CANCEL_ENABLE according to posix but I added a comment to document this.


- Ian


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/20632/#review41229
-----------------------------------------------------------


On April 23, 2014, 9:14 p.m., Ian Downes wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/20632/
> -----------------------------------------------------------
> 
> (Updated April 23, 2014, 9:14 p.m.)
> 
> 
> Review request for mesos, Ben Mahler and Vinod Kone.
> 
> 
> Bugs: MESOS-1152
>     https://issues.apache.org/jira/browse/MESOS-1152
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Using clone() directly for creating threads is not advised because glibc expects thread local storage to be set up in a particular way. If a glibc function (e.g., sleep) is called there's a race where the incorrectly set up TLS is sometimes discovered which crashes the thread and child, ultimately failing the test.
> 
> The MultipleThreads test has been greatly simplified to not use a forked child and to just use pthread_create in the test. The test now only checks the number of threads counted is correct, not their thread ids.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/tests/proc_tests.cpp 8ca6d80dbbd29ba0ead6bbb8a84e794eea0e1173 
> 
> Diff: https://reviews.apache.org/r/20632/diff/
> 
> 
> Testing
> -------
> 
> # gcc version 4.8.1 20130715 (Red Hat 4.8.1-4) (GCC)
> ./3rdparty/libprocess/3rdparty/stout-tests --gtest_repeat=1000 --gtest_filter="ProcTest*" --gtest_break_on_failure
> 
> # gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
> ./3rdparty/libprocess/3rdparty/stout-tests --gtest_repeat=1000 --gtest_filter="ProcTest*" --gtest_break_on_failure
> 
> 
> Thanks,
> 
> Ian Downes
> 
>


Re: Review Request 20632: Fix and simplify the ProcTests for threads.

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/20632/#review41229
-----------------------------------------------------------



3rdparty/libprocess/3rdparty/stout/tests/proc_tests.cpp
<https://reviews.apache.org/r/20632/#comment74667>

    I think you need a <pthread.h> include now?



3rdparty/libprocess/3rdparty/stout/tests/proc_tests.cpp
<https://reviews.apache.org/r/20632/#comment74666>

    Would it be better to pthread_kill or should we make the pthreads explicitly cancellable?


- Ben Mahler


On April 23, 2014, 9:14 p.m., Ian Downes wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/20632/
> -----------------------------------------------------------
> 
> (Updated April 23, 2014, 9:14 p.m.)
> 
> 
> Review request for mesos, Ben Mahler and Vinod Kone.
> 
> 
> Bugs: MESOS-1152
>     https://issues.apache.org/jira/browse/MESOS-1152
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Using clone() directly for creating threads is not advised because glibc expects thread local storage to be set up in a particular way. If a glibc function (e.g., sleep) is called there's a race where the incorrectly set up TLS is sometimes discovered which crashes the thread and child, ultimately failing the test.
> 
> The MultipleThreads test has been greatly simplified to not use a forked child and to just use pthread_create in the test. The test now only checks the number of threads counted is correct, not their thread ids.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/tests/proc_tests.cpp 8ca6d80dbbd29ba0ead6bbb8a84e794eea0e1173 
> 
> Diff: https://reviews.apache.org/r/20632/diff/
> 
> 
> Testing
> -------
> 
> # gcc version 4.8.1 20130715 (Red Hat 4.8.1-4) (GCC)
> ./3rdparty/libprocess/3rdparty/stout-tests --gtest_repeat=1000 --gtest_filter="ProcTest*" --gtest_break_on_failure
> 
> # gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
> ./3rdparty/libprocess/3rdparty/stout-tests --gtest_repeat=1000 --gtest_filter="ProcTest*" --gtest_break_on_failure
> 
> 
> Thanks,
> 
> Ian Downes
> 
>


Re: Review Request 20632: Fix and simplify the ProcTests for threads.

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/20632/#review41223
-----------------------------------------------------------

Ship it!


Ship It!

- Jie Yu


On April 23, 2014, 9:14 p.m., Ian Downes wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/20632/
> -----------------------------------------------------------
> 
> (Updated April 23, 2014, 9:14 p.m.)
> 
> 
> Review request for mesos, Ben Mahler and Vinod Kone.
> 
> 
> Bugs: MESOS-1152
>     https://issues.apache.org/jira/browse/MESOS-1152
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Using clone() directly for creating threads is not advised because glibc expects thread local storage to be set up in a particular way. If a glibc function (e.g., sleep) is called there's a race where the incorrectly set up TLS is sometimes discovered which crashes the thread and child, ultimately failing the test.
> 
> The MultipleThreads test has been greatly simplified to not use a forked child and to just use pthread_create in the test. The test now only checks the number of threads counted is correct, not their thread ids.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/tests/proc_tests.cpp 8ca6d80dbbd29ba0ead6bbb8a84e794eea0e1173 
> 
> Diff: https://reviews.apache.org/r/20632/diff/
> 
> 
> Testing
> -------
> 
> # gcc version 4.8.1 20130715 (Red Hat 4.8.1-4) (GCC)
> ./3rdparty/libprocess/3rdparty/stout-tests --gtest_repeat=1000 --gtest_filter="ProcTest*" --gtest_break_on_failure
> 
> # gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
> ./3rdparty/libprocess/3rdparty/stout-tests --gtest_repeat=1000 --gtest_filter="ProcTest*" --gtest_break_on_failure
> 
> 
> Thanks,
> 
> Ian Downes
> 
>


Re: Review Request 20632: Fix and simplify the ProcTests for threads.

Posted by Ian Downes <ia...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/20632/
-----------------------------------------------------------

(Updated April 25, 2014, 5:32 p.m.)


Review request for mesos, Ben Mahler and Vinod Kone.


Changes
-------

Addressed comments: switched to using size_t.


Bugs: MESOS-1152
    https://issues.apache.org/jira/browse/MESOS-1152


Repository: mesos-git


Description
-------

Using clone() directly for creating threads is not advised because glibc expects thread local storage to be set up in a particular way. If a glibc function (e.g., sleep) is called there's a race where the incorrectly set up TLS is sometimes discovered which crashes the thread and child, ultimately failing the test.

The MultipleThreads test has been greatly simplified to not use a forked child and to just use pthread_create in the test. The test now only checks the number of threads counted is correct, not their thread ids.


Diffs (updated)
-----

  3rdparty/libprocess/3rdparty/stout/tests/proc_tests.cpp 8ca6d80dbbd29ba0ead6bbb8a84e794eea0e1173 

Diff: https://reviews.apache.org/r/20632/diff/


Testing
-------

# gcc version 4.8.1 20130715 (Red Hat 4.8.1-4) (GCC)
./3rdparty/libprocess/3rdparty/stout-tests --gtest_repeat=1000 --gtest_filter="ProcTest*" --gtest_break_on_failure

# gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
./3rdparty/libprocess/3rdparty/stout-tests --gtest_repeat=1000 --gtest_filter="ProcTest*" --gtest_break_on_failure


Thanks,

Ian Downes


Re: Review Request 20632: Fix and simplify the ProcTests for threads.

Posted by Vinod Kone <vi...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/20632/#review41221
-----------------------------------------------------------

Ship it!


Ship It!

- Vinod Kone


On April 23, 2014, 9:14 p.m., Ian Downes wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/20632/
> -----------------------------------------------------------
> 
> (Updated April 23, 2014, 9:14 p.m.)
> 
> 
> Review request for mesos, Ben Mahler and Vinod Kone.
> 
> 
> Bugs: MESOS-1152
>     https://issues.apache.org/jira/browse/MESOS-1152
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Using clone() directly for creating threads is not advised because glibc expects thread local storage to be set up in a particular way. If a glibc function (e.g., sleep) is called there's a race where the incorrectly set up TLS is sometimes discovered which crashes the thread and child, ultimately failing the test.
> 
> The MultipleThreads test has been greatly simplified to not use a forked child and to just use pthread_create in the test. The test now only checks the number of threads counted is correct, not their thread ids.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/tests/proc_tests.cpp 8ca6d80dbbd29ba0ead6bbb8a84e794eea0e1173 
> 
> Diff: https://reviews.apache.org/r/20632/diff/
> 
> 
> Testing
> -------
> 
> # gcc version 4.8.1 20130715 (Red Hat 4.8.1-4) (GCC)
> ./3rdparty/libprocess/3rdparty/stout-tests --gtest_repeat=1000 --gtest_filter="ProcTest*" --gtest_break_on_failure
> 
> # gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
> ./3rdparty/libprocess/3rdparty/stout-tests --gtest_repeat=1000 --gtest_filter="ProcTest*" --gtest_break_on_failure
> 
> 
> Thanks,
> 
> Ian Downes
> 
>