-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CHECK(leader_state_cache_.is_lock_free()) fails in gcc 7 #1189
Comments
Output of yb-master.raju-ubuntu1804.raju.log.INFO.20190402-234308.21926 Log file created at: 2019/04/02 23:43:08 |
cc - @bmatican |
@spolitov does https://en.cppreference.com/w/cpp/atomic/atomic/is_lock_free
|
Moving comments from #1246 here: From @d-uspenskiy : It looks like g++-7 generates non-lock-free code for 128 bits atomic structures https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80878 as a result https://github.com/YugaByte/yugabyte-db/blob/master/src/yb/consensus/replica_state.cc#L111 Some description about changes in g++-7 |
Two more potentially relevant links: http://gcc.1065356.n8.nabble.com/GCC-in-line-assembly-and-the-removal-of-mcx16-td1378660.html |
Could we just use |
From an offline discussion with @spolitov:
|
The check should be added for 16 bytes atomics, so to revisit we could use the following command: It will give all suspicious usages of std::atomic, that should be checked. |
BTW here is the patch that @rajukumaryb has been using locally: https://gist.githubusercontent.com/mbautin/bbb02cbf60df635b8a92a548789d54ed/raw |
@d-uspenskiy: we should be able to upgrade to gcc 7.x (the default version on Ubuntu 18.04) when we fix the lock-free/atomic-related issues mentioned above. |
Slightly updated regex: |
Summary: For std::atomic `gcc-7` generates non lock-free code for 16 bytes structures even in case `-mcx16` flags is used for compilation. Solution is to substitute `std::atomic` with `boost::atomic` for all 16 bytes structures used in YB code Also false positive `array-bounds` error (due to agressive `-O3` optimization in `release` build) is fixed in `slice_transform_test.cc` ``` In file included from src/yb/rocksdb/slice_transform.h:34:0, from src/yb/rocksdb/util/slice_transform_test.cc:24: src/yb/util/slice.h: In member function ‘virtual void rocksdb::SliceTransformTest_CapPrefixTransform_Test::TestBody()’: src/yb/util/slice.h:64:57: error: array subscript is below array bounds [-Werror=array-bounds] Slice(const uint8_t* d, size_t n) : begin_(d), end_(d + n) {} ``` Using `Slice()` explicitly instead of implicit `Slice(const char* s)` constructor for `""` (empty string) solves the issue. Problem is very specific for this particular place. There is no issue with creation of `Slice` from `""` all the time. Test Plan: build and run YB cluster in `debug` and `release` mode with using gcc-7 (`ubuntu` 16+ have gcc-7 as a default compiler) Reviewers: raju, mikhail, sergei Reviewed By: sergei Subscribers: ybase, bogdan Differential Revision: https://phabricator.dev.yugabyte.com/D6800
Summary: D6777 and D6800 was made in parallel, so one 16 bytes std::atomic left in LockFreeStack. Changed it to boost::atomic. Test Plan: Jenkins Reviewers: dmitry, bogdan Reviewed By: bogdan Subscribers: ybase Differential Revision: https://phabricator.dev.yugabyte.com/D6811
…cture) Summary: Due to gcc 7 issue with lock free structures described in #1189 the following check fails https://github.com/yugabyte/yugabyte-db/blob/master/src/yb/tablet/operations/operation_driver.cc#L93 Solution: boost::atomic should be used instead of std::atomic Test Plan: Manual. Reinit db on centos build ``` ./yb_build.sh reinitdb ``` Reviewers: sergei Reviewed By: sergei Subscribers: ybase Differential Revision: https://phabricator.dev.yugabyte.com/D7362
Original description of the issue as filed by @rajukumaryb :
Master process does not start on Ubuntu 18.04 following a "destroy + create" sequence
The text was updated successfully, but these errors were encountered: