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

ASF subversion and git services commented on KUDU-3044:
-------------------------------------------------------

Commit ee86f568cb405f8636ae56f3b69f8009f8f481da in kudu's branch 
refs/heads/master from Alexey Serbin
[ https://gitbox.apache.org/repos/asf?p=kudu.git;h=ee86f56 ]

[util] GetBindIpForDaemon() consumes PID wider than 18 bit

This patch updates the logic of GetBindIpForDaemon() to accept process
identifiers wider than 18 bits.  Prior to this patch, maximum allowable
PID was 262143, and feeding in a higher PID lead to a crash.  The
limitation was due to the mapping scheme of (PID, index) --> loopback
IP address: it mapped 18-bit PID and 6-bit index into the 24-bit space
of 127.0.0.0/8 loopback addresses.

With this patch, GetBindIpForDaemon() stops imposing the limit on the
maximum PID.  Now the uniqueness of the generated IP address is not
guaranteed in general if OS generates PIDs wider than 18 bits, but it
still holds across all Kudu test processes if both of the following
conditions are true:

  * PIDs are monotonically increasing with a delta D which is much
    smaller than 262143 for newly spawned processes (usually D is 1)

  * no more than 262144/D processes are spawned between the earliest
    still running process and the latest running one while executing
    Kudu tests involving external mini-cluster

The former item is not true for hardened Linux distros where PID
assignment is randomized, but it's unlikely that anybody is interested
running Kudu tests on such systems.

Essentially, the new scheme uses PID % 262144 as input for the PID part,
keeping it in the 18-bit space even if the original PID address space is
wider (it might be up to 22 bits wide for 64-bit Linux distros).

This patch helps running Kudu tests on Docker containers where the host
OS is configured to have PIDs higher than 262143 and updating maximum
PID is not an option since /proc/sys/kernel/pid_max is mounted
read-only.

This patch relates to the following JIRA issues:
  KUDU-1334
  KUDU-3044

Change-Id: Idf2162a2a976a0ce997f02a321f230e7f5878328
Reviewed-on: http://gerrit.cloudera.org:8080/15519
Reviewed-by: Adar Dembo <[email protected]>
Tested-by: Kudu Jenkins


> Failed to start the mini_cluster while the pid is greater than 262144
> ---------------------------------------------------------------------
>
>                 Key: KUDU-3044
>                 URL: https://issues.apache.org/jira/browse/KUDU-3044
>             Project: Kudu
>          Issue Type: Bug
>            Reporter: LiFu He
>            Priority: Minor
>             Fix For: n/a
>
>
> I met this issue while doing some tests and below is the output:
> {code:java}
> // code placeholder
> WARNING: Logging before InitGoogleLogging() is written to STDERR
> F0120 15:16:07.215484 573686 net_util.cc:485] Check failed: pid < 1 << 
> kPidBits (573686 vs. 262144) PID 573686 is more than 18 bits wide
> *** Check failure stack trace: ***
> *** Aborted at 1579504567 (unix time) try "date -d @1579504567" if you are 
> using GNU date ***
> PC: @     0x7f44b85b2067 gsignal
> *** SIGABRT (@0x7d60008c0f6) received by PID 573686 (TID 0x7f44badae880) from 
> PID 573686; stack trace: ***
>     @     0x7f44ba0e2890 (unknown)
>     @     0x7f44b85b2067 gsignal
>     @     0x7f44b85b3448 abort
>     @           0xc2bdf9 google::logging_fail()
>     @           0xc2d6ed google::LogMessage::Fail()
>     @           0xc2f5bd google::LogMessage::SendToLog()
>     @           0xc2d229 google::LogMessage::Flush()
>     @           0xc3005f google::LogMessageFatal::~LogMessageFatal()
>     @          0x2b1477b kudu::GetBindIpForDaemon()
>     @           0xcbc26d kudu::cluster::MiniCluster::ReserveDaemonSocket()
>     @           0xcb94f6 kudu::cluster::InternalMiniCluster::StartMasters()
>     @           0xcbace0 kudu::cluster::InternalMiniCluster::Start()
>     @           0xc20d01 kudu::tserver::TsTabletManagerITest::StartCluster()
>     @           0xc15462 
> kudu::tserver::TsTabletManagerITest_TestTableStats_Test::TestBody()
>     @          0x2a6b9c8 
> testing::internal::HandleExceptionsInMethodIfSupported<>()
>     @          0x2a59e92 testing::Test::Run()
>     @          0x2a59fd8 testing::TestInfo::Run()
>     @          0x2a5a0b5 testing::TestCase::Run()
>     @          0x2a609c8 testing::internal::UnitTestImpl::RunAllTests()
>     @          0x2a6bed8 
> testing::internal::HandleExceptionsInMethodIfSupported<>()
>     @          0x2a5a18d testing::UnitTest::Run()
>     @           0xbad3ba main
>     @     0x7f44b859eb45 __libc_start_main
>     @           0xc0eb38 (unknown)
> Aborted (core dumped)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to