> On Nov. 15, 2016, 6:42 a.m., Sivaram Kannan wrote:
> > src/slave/containerizer/mesos/containerizer.cpp, line 1388
> > <https://reviews.apache.org/r/53473/diff/6/?file=1563497#file1563497line1388>
> >
> >     Passing None() has the agent crashing when we have switch_user=false.
> 
> Sivaram Kannan wrote:
>     That is the reason I thought I would have the current user of the agent 
> set to logger.
> 
> Joseph Wu wrote:
>     The reason the agent/test would fail is because of this line in your 
> fourth diff:
>     https://reviews.apache.org/r/53473/diff/4#7
>     
>     `container->config.user()` has a return type of `string`.  When the value 
> is not set, calling `container->config.user()` returns the empty string.  You 
> need to manually convert it to an `Option<string>`.
>     
>     `container->config` is a protobuf defined here: 
>     
> https://github.com/apache/mesos/blob/1.1.x/include/mesos/slave/containerizer.proto#L112
> 
> Sivaram Kannan wrote:
>     https://reviews.apache.org/r/53473/diff/6/ has an explicit conversion to 
> Option<string>. When container->config.user() is empty, I tried to set 
>     
>     Option<string> user = None()
>     
>     But the call logger->prepare(..., user), still crashes the agent. Doesn't 
> the below code more logical than setting the value to None()?
>     
>     Result<std::string> result = os::user();
>     user = result.get();
> 
> Joseph Wu wrote:
>     What's the stack trace for the crash?  (And what are the steps taken to 
> repro?)
> 
> Sivaram Kannan wrote:
>     Sorry - should have added when I created the RBR. 
>     
>     Steps to reproduce: 
>     1. In the containerizer.cpp, change the below code in the rbr 
>     2.   Option<string> user = None();
>       if (container->config.has_user()) {
>         user = container->config.user();
>       } else {
>         Result<std::string> result = os::user();
>         //user = result.get(); <============= Current code
>         user = None(); <=========== Change it to this
>       }
>      3. make and make check. 
>      4. Run the below test
>      5. sudo bin/mesos-tests.sh --verbose 
> --gtest_filter="UserContainerLoggerTest.ROOT_LOGROTATE_RotateAsSwitchUserFalse"
>      6. The above test would end up in a crash like below.
>      7. Stack Trace:
>      8. I1116 15:58:16.660096 15282 slave.cpp:2031] Queued task 
> 'bffed9be-9830-4840-a313-e2ff3741b2fc' for executor 
> 'bffed9be-9830-4840-a313-e2ff3741b2fc' of framework 
> 16b6e12e-3344-4aad-adf1-a3460b3ad2a1-0000
>     lt-mesos-tests: ../../3rdparty/stout/include/stout/option.hpp:111: const 
> T& Option<T>::get() const & [with T = std::basic_string<char>]: Assertion 
> `isSome()' failed.
>     *** Aborted at 1479311896 (unix time) try "date -d @1479311896" if you 
> are using GNU date ***
>     PC: @     0x7f89e65b0c37 (unknown)
>     *** SIGABRT (@0x3ba2) received by PID 15266 (TID 0x7f89dd0db700) from PID 
> 15266; stack trace: ***
>         @     0x7f89e694f330 (unknown)
>         @     0x7f89e65b0c37 (unknown)
>         @     0x7f89e65b4028 (unknown)
>         @     0x7f89e65a9bf6 (unknown)
>         @     0x7f89e65a9ca2 (unknown)
>         @           0xa8542f _ZNKR6OptionISsE3getEv
>         @     0x7f89dfba6a9b 
> mesos::internal::logger::LogrotateContainerLoggerProcess::prepare()
>         @     0x7f89dfbbcb5e 
> _ZZN7process8dispatchIN5mesos5slave15ContainerLogger14SubprocessInfoENS1_8internal6logger31LogrotateContainerLoggerProcessERKNS1_12ExecutorInfoERKSsRK6OptionISsES8_SsSE_EENS_6FutureIT_EERKNS_3PIDIT0_EEMSL_FSJ_T1_T2_T3_ET4_T5_T6_ENKUlPNS_11ProcessBaseEE_clESY_
>         @     0x7f89dfbcb54d 
> _ZNSt17_Function_handlerIFvPN7process11ProcessBaseEEZNS0_8dispatchIN5mesos5slave15ContainerLogger14SubprocessInfoENS5_8internal6logger31LogrotateContainerLoggerProcessERKNS5_12ExecutorInfoERKSsRK6OptionISsESC_SsSI_EENS0_6FutureIT_EERKNS0_3PIDIT0_EEMSP_FSN_T1_T2_T3_ET4_T5_T6_EUlS2_E_E9_M_invokeERKSt9_Any_dataS2_
>         @     0x7f89eca9168d std::function<>::operator()()
>         @     0x7f89eca73e0d process::ProcessBase::visit()
>         @     0x7f89eca7c2ec process::DispatchEvent::visit()
>         @           0xa674b2 process::ProcessBase::serve()
>         @     0x7f89eca700fa process::ProcessManager::resume()
>         @     0x7f89eca6cc39 
> _ZZN7process14ProcessManager12init_threadsEvENKUt_clEv
>         @     0x7f89eca7ba94 
> _ZNSt12_Bind_simpleIFZN7process14ProcessManager12init_threadsEvEUt_vEE9_M_invokeIIEEEvSt12_Index_tupleIIXspT_EEE
>         @     0x7f89eca7b9eb 
> _ZNSt12_Bind_simpleIFZN7process14ProcessManager12init_threadsEvEUt_vEEclEv
>         @     0x7f89eca7b984 
> _ZNSt6thread5_ImplISt12_Bind_simpleIFZN7process14ProcessManager12init_threadsEvEUt_vEEE6_M_runEv
>         @     0x7f89e712aa60 (unknown)
>         @     0x7f89e6947184 start_thread
>         @     0x7f89e667437d (unknown)

With your latest review diff, this stack trace shouldn't be possible, as there 
is no code in the `LogrotateContainerLoggerProcess` that calls `user.get()`.  
Can you double check?  If you've added a debug print statement or something 
else excluded the from the diff, that may be causing it.


- Joseph


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


On Nov. 14, 2016, 1:52 p.m., Sivaram Kannan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53473/
> -----------------------------------------------------------
> 
> (Updated Nov. 14, 2016, 1:52 p.m.)
> 
> 
> Review request for mesos and Joseph Wu.
> 
> 
> Bugs: MESOS-5856
>     https://issues.apache.org/jira/browse/MESOS-5856
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Add new param user to logrotate's prepare function.
> 
> 
> Diffs
> -----
> 
>   include/mesos/slave/container_logger.hpp 
> 939974736f9eb744c83036e074718d2a1eba8b0a 
>   src/slave/container_loggers/lib_logrotate.hpp 
> 28fdf3bdcc66d473521b377f66ab0b48f6900f58 
>   src/slave/container_loggers/lib_logrotate.cpp 
> 53698d339f0f4d2dc916b53239ca0c36bbebcd42 
>   src/slave/container_loggers/logrotate.hpp 
> d1db69236f5a9b1dbb3113ad02218a512afdb46b 
>   src/slave/container_loggers/sandbox.hpp 
> e0aeb32a9ec83af049af8a10010b819c1d8b25d8 
>   src/slave/container_loggers/sandbox.cpp 
> cc263ebef7e0c3e778fabafa49faa6dd315adc45 
>   src/slave/containerizer/docker.cpp c2ed5240aab9ea9d1a386c44c94e5ae7e98d313c 
>   src/slave/containerizer/mesos/containerizer.cpp 
> ec4ae32485a7ab6c9f73c512004d1220482a188e 
>   src/tests/container_logger_tests.cpp 
> 1bb94a8461e481983f25a44737e4011ed5fc4b1f 
> 
> Diff: https://reviews.apache.org/r/53473/diff/
> 
> 
> Testing
> -------
> 
> Run the mesos-logrotate-logger with un-priviledged user and verify whether 
> the logs are getting rotated.
> Run the mesos-logrotate-logger as root user and verify whether the logs are 
> getting rotated.
> 
> 
> Thanks,
> 
> Sivaram Kannan
> 
>

Reply via email to