Skip to content

Commit

Permalink
[thirdparty] Force Boost to use /dev/random for uuid
Browse files Browse the repository at this point in the history
This patch adjusts the Boost thirdparty build to force it to use
/dev/random instead of getrandom(2) which is used by deafult
when compiled on Linux 3.17 or later.

In the latest Kudu 1.14.0 binary jar we saw crashes in Hive
pre-commit tests because that jar was compiled on CentOS 7
and therefore used a getrandom(2) call which was not available
in the Hive precommit container.

Below is an example failure log:
INFO [cluster stderr printer] cluster.MiniKuduCluster: terminate called after throwing an instance of 'boost::wrapexcept<boost::uuids::entropy_error>'
INFO [cluster stderr printer] cluster.MiniKuduCluster:   what():  getrandom
INFO [cluster stderr printer] cluster.MiniKuduCluster: *** Aborted at 1616564512 (unix time) try "date -d @1616564512" if you are using GNU date ***
INFO [cluster stderr printer] cluster.MiniKuduCluster: PC: @     0x7f67d1f963d7 __GI_raise
INFO [cluster stderr printer] cluster.MiniKuduCluster: *** SIGABRT (@0x9c4000051e8) received by PID 20968 (TID 0x7f67d0c23a00) from PID 20968; stack trace: ***
INFO [cluster stderr printer] cluster.MiniKuduCluster:     @     0x7f67d442f201 (unknown)
INFO [cluster stderr printer] cluster.MiniKuduCluster:     @     0x7f67d65e1630 (unknown)
INFO [cluster stderr printer] cluster.MiniKuduCluster:     @     0x7f67d1f963d7 __GI_raise
INFO [cluster stderr printer] cluster.MiniKuduCluster:     @     0x7f67d1f97ac8 __GI_abort
INFO [cluster stderr printer] cluster.MiniKuduCluster:     @     0x7f67d28a79d5 __gnu_cxx::__verbose_terminate_handler()
INFO [cluster stderr printer] cluster.MiniKuduCluster:     @     0x7f67d28a5946 (unknown)
INFO [cluster stderr printer] cluster.MiniKuduCluster:     @     0x7f67d28a5973 std::terminate()
INFO [cluster stderr printer] cluster.MiniKuduCluster:     @     0x7f67d28a5b93 __cxa_throw
INFO [cluster stderr printer] cluster.MiniKuduCluster:     @     0x7f67d478c138 boost::throw_exception<>()
INFO [cluster stderr printer] cluster.MiniKuduCluster:     @     0x7f67d47c2d9d kudu::ObjectIdGenerator::Next()
INFO [cluster stderr printer] cluster.MiniKuduCluster:     @     0x7f67d8d9906c kudu::FsManager::CreateInstanceMetadata()
INFO [cluster stderr printer] cluster.MiniKuduCluster:     @     0x7f67d8d9f4df kudu::FsManager::CreateInitialFileSystemLayout()
INFO [cluster stderr printer] cluster.MiniKuduCluster:     @     0x7f67d8e6dc46 kudu::server::ServerBase::Init()
INFO [cluster stderr printer] cluster.MiniKuduCluster:     @     0x7f67d9f9e8ba kudu::kserver::KuduServer::Init()
INFO [cluster stderr printer] cluster.MiniKuduCluster:     @     0x7f67d9ed36af kudu::master::Master::Init()
INFO [cluster stderr printer] cluster.MiniKuduCluster:     @     0x7f67d9eecaa6 kudu::master::RunMasterServer()
...

Change-Id: I229f691ed851617e2aa183465726b8cc5e10039c
Reviewed-on: http://gerrit.cloudera.org:8080/17354
Tested-by: Grant Henke <[email protected]>
Reviewed-by: Alexey Serbin <[email protected]>
  • Loading branch information
granthenke committed May 9, 2021
1 parent a701817 commit 2741814
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions thirdparty/build-definitions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,14 @@ build_boost() {
# Compile with PIC and set nanosecond resolution for impala compatibility.
BOOST_CFLAGS="$EXTRA_CFLAGS -fPIC -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG"
BOOST_CXXFLAGS="$EXTRA_CXXFLAGS -fPIC -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG"

# Force Boost UUID to use /dev/random instead of getrandom(2) when compiled on
# Linux 3.17 or later. Using getrandom(2) has caused crashes, especially in the
# binary jar, when getrandom(2) is not available.
# https://www.boost.org/doc/libs/1_68_0/libs/uuid/doc/uuid.html#Random%20Generator
BOOST_CFLAGS="$BOOST_CFLAGS -DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX"
BOOST_CXXFLAGS="$BOOST_CFLAGS -DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX"

BOOST_LDFLAGS="$EXTRA_LDFLAGS"

case $BUILD_TYPE in
Expand Down

0 comments on commit 2741814

Please sign in to comment.