[jira] [Commented] (MESOS-4142) HttpAuthenticationTest.Unauthorized is flaky

2015-12-13 Thread Alexander Rojas (JIRA)

[ 
https://issues.apache.org/jira/browse/MESOS-4142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15055027#comment-15055027
 ] 

Alexander Rojas commented on MESOS-4142:


So the root of the problem is the asynchronicity of {{spawn}} and 
{{ProcessBase::initialize()}}. The bug occurs because in 
[{{http_tests.cpp}}|https://github.com/apache/mesos/blob/6bd9b65b9d93f154ff9187fb5e5136262ede043c/3rdparty/libprocess/src/tests/http_tests.cpp#L71]
 the class {{HttpProcess}} execute calls to {{ProcessBase::route()}} commands 
in the overload of {{ProcessBase::initialize()}}, this causes the endpoint to 
be registered for authentication after the request was made. Below I post a 
timeline of the bug (Which somewhat is more likely to happen under gcc than 
under clang):

* {{Http http}} is created.
* {{Http::Http()}} calls {{HttpProcess::HttpProcess}}.
* {{Http::Http()}} calls {{spawn(process) // where process is an instance of 
HttpProcess}}.
* {{spawn(process)}} calls {{enqueue(process)}} which will call 
{{HttpProcess::initialize()}} later.
* {{Http::Http()}} returns and can be used already.
* The test calls {{http::get(http.process->self(), "authenticated")}}.
* The request arrives to {{ProcessManager::handle()}} it dispatches for 
authentication.
* At this point {{HttpProcess::initialize()}} begins to be executed.
* Request arrives to {{AuthenticationRouterProcess::authenticate()}}, it 
doesn't find the path of the request into the registered endpoints.
* {{AuthenticationRouterProcess::authenticate()}} returns with a non 
authentication needed response.
* {{HttpProcess::initialize()}} calls {{route("/authenticated", "realm", 
None(), &HttpProcess::authenticated);}} At this point it is too late to set 
authentication.
* {{ProcessManager::handle()}} dispatches the request to the instance of 
{{Http}} but it is too late to set handler. Test fails.

As I see it, this race existed before and I find it rather surprising that it 
didn't affected other tests before, while it is true that {{route}} takes 
longer if it requires authentication. I have an easy workaround which is 
calling {{route}} from {{HttpProcess}} constructor, however, I think we should 
evaluate how wise is to allow the use of processes if initialize hasn't run, or 
at least being able to wait until the process is initialized.

> HttpAuthenticationTest.Unauthorized is flaky
> 
>
> Key: MESOS-4142
> URL: https://issues.apache.org/jira/browse/MESOS-4142
> Project: Mesos
>  Issue Type: Bug
>  Components: libprocess
>Reporter: Joris Van Remoortere
>  Labels: authentication, libprocess, mesosphere
>
> {code}
> [ RUN  ] HttpAuthenticationTest.Unauthorized
> libprocess: (35605)@127.0.1.1:40875 terminating due to Uninteresting mock 
> function call - returning default value.
> Function call: authenticated(@0x7f412c016540 224-byte object <38-68 01-2C 
> 41-7F 00-00 01-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 01-00 00-00 00-00 
> 00-00 00-00 00-00 00-00 00-00 01-00 00-00 00-00 00-00 00-00 00-00 01-00 00-00 
> 00-00 00-00 00-00 00-00 ... E0-75 01-2C 41-7F 00-00 03-00 00-00 00-00 00-00 
> 00-00 80-3F 00-00 00-00 0B-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 78-A6 
> F9-3A 41-7F 00-00 00-00 00-00 02-00 00-00 7F-00 00-01 13-EB 00-00>, 
> @0x7f411c614cd8 16-byte object <01-00 00-00 00-00 00-00 E8-66 91-01 00-00 
> 00-00>)
> The mock function has no default action set, and its return type has no 
> default value set.
> ../../../3rdparty/libprocess/src/tests/http_tests.cpp:1271: Failure
> Value of: (response).get().status
>   Actual: "500 Internal Server Error"
> Expected: http::Unauthorized(vector()).status
> Which is: "401 Unauthorized"
> terminate called after throwing an instance of 
> 'testing::internal::GoogleTestFailureException'
>   what():  ../../../3rdparty/libprocess/src/tests/http_tests.cpp:1271: Failure
> Value of: (response).get().status
>   Actual: "500 Internal Server Error"
> Expected: http::Unauthorized(vector()).status
> Which is: "401 Unauthorized"
> *** Aborted at 1449970589 (unix time) try "date -d @1449970589" if you are 
> using GNU date ***
> PC: @ 0x7f413a6e1267 (unknown)
> *** SIGABRT (@0x3e8641e) received by PID 25630 (TID 0x7f413c81f7c0) from 
> PID 25630; stack trace: ***
> @ 0x7f413c206d10 (unknown)
> @ 0x7f413a6e1267 (unknown)
> @ 0x7f413a6e2eca (unknown)
> @ 0x7f413aced06d (unknown)
> @ 0x7f413aceaee6 (unknown)
> @ 0x7f413aceaf31 (unknown)
> @ 0x7f413aceb199 (unknown)
> @   0x73369d 
> testing::internal::HandleExceptionsInMethodIfSupported<>()
> @   0x71a605 testing::UnitTest::Run()
> @   0x53e201 RUN_ALL_TESTS()
> @   0x53dfa2 main
> @ 0x7f413a6cca40 (unknown)
> @   0x419599 _

[jira] [Commented] (MESOS-4142) HttpAuthenticationTest.Unauthorized is flaky

2015-12-12 Thread Joris Van Remoortere (JIRA)

[ 
https://issues.apache.org/jira/browse/MESOS-4142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15054753#comment-15054753
 ] 

Joris Van Remoortere commented on MESOS-4142:
-

[~bmahler] [~arojas]
It looks like we're hitting this:
https://github.com/apache/mesos/blob/6bd9b65b9d93f154ff9187fb5e5136262ede043c/3rdparty/libprocess/include/process/event.hpp#L130-L131
due the following possibly not running to completion before we return:
https://github.com/apache/mesos/blob/6bd9b65b9d93f154ff9187fb5e5136262ede043c/3rdparty/libprocess/src/process.cpp#L1099_L1108
since we only dispatch, but never join the future:
https://github.com/apache/mesos/blob/6bd9b65b9d93f154ff9187fb5e5136262ede043c/3rdparty/libprocess/src/process.cpp#L2416

I'm not sure what the intended behaviour here is, but it looks like we're 
telling the Http handler that we're done serving the request too early because 
we're not joining on the result of an operation.

> HttpAuthenticationTest.Unauthorized is flaky
> 
>
> Key: MESOS-4142
> URL: https://issues.apache.org/jira/browse/MESOS-4142
> Project: Mesos
>  Issue Type: Bug
>  Components: libprocess
>Reporter: Joris Van Remoortere
>  Labels: authentication, libprocess, mesosphere
>
> {code}
> [ RUN  ] HttpAuthenticationTest.Unauthorized
> libprocess: (35605)@127.0.1.1:40875 terminating due to Uninteresting mock 
> function call - returning default value.
> Function call: authenticated(@0x7f412c016540 224-byte object <38-68 01-2C 
> 41-7F 00-00 01-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 01-00 00-00 00-00 
> 00-00 00-00 00-00 00-00 00-00 01-00 00-00 00-00 00-00 00-00 00-00 01-00 00-00 
> 00-00 00-00 00-00 00-00 ... E0-75 01-2C 41-7F 00-00 03-00 00-00 00-00 00-00 
> 00-00 80-3F 00-00 00-00 0B-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 78-A6 
> F9-3A 41-7F 00-00 00-00 00-00 02-00 00-00 7F-00 00-01 13-EB 00-00>, 
> @0x7f411c614cd8 16-byte object <01-00 00-00 00-00 00-00 E8-66 91-01 00-00 
> 00-00>)
> The mock function has no default action set, and its return type has no 
> default value set.
> ../../../3rdparty/libprocess/src/tests/http_tests.cpp:1271: Failure
> Value of: (response).get().status
>   Actual: "500 Internal Server Error"
> Expected: http::Unauthorized(vector()).status
> Which is: "401 Unauthorized"
> terminate called after throwing an instance of 
> 'testing::internal::GoogleTestFailureException'
>   what():  ../../../3rdparty/libprocess/src/tests/http_tests.cpp:1271: Failure
> Value of: (response).get().status
>   Actual: "500 Internal Server Error"
> Expected: http::Unauthorized(vector()).status
> Which is: "401 Unauthorized"
> *** Aborted at 1449970589 (unix time) try "date -d @1449970589" if you are 
> using GNU date ***
> PC: @ 0x7f413a6e1267 (unknown)
> *** SIGABRT (@0x3e8641e) received by PID 25630 (TID 0x7f413c81f7c0) from 
> PID 25630; stack trace: ***
> @ 0x7f413c206d10 (unknown)
> @ 0x7f413a6e1267 (unknown)
> @ 0x7f413a6e2eca (unknown)
> @ 0x7f413aced06d (unknown)
> @ 0x7f413aceaee6 (unknown)
> @ 0x7f413aceaf31 (unknown)
> @ 0x7f413aceb199 (unknown)
> @   0x73369d 
> testing::internal::HandleExceptionsInMethodIfSupported<>()
> @   0x71a605 testing::UnitTest::Run()
> @   0x53e201 RUN_ALL_TESTS()
> @   0x53dfa2 main
> @ 0x7f413a6cca40 (unknown)
> @   0x419599 _start
> Aborted (core dumped)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)