| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
unsigned integer overflow.
PiperOrigin-RevId: 648730502
Change-Id: I662c365c59be9e51f565fd215d284a96b7bd8743
|
|
|
|
|
| |
PiperOrigin-RevId: 645054874
Change-Id: Ic4a820b47edfa71bd3e1f149d54f00ac3c1d16a6
|
|
|
|
|
|
|
| |
continued flakiness.
PiperOrigin-RevId: 643372086
Change-Id: I8fb2acc0e5ad35113e865bf008a531f3442a9295
|
|
|
|
|
|
|
|
| |
the open source release. This was only used in tests that never ran
as part in the open source release.
PiperOrigin-RevId: 636167506
Change-Id: Iafc33bd768307fe9ee77b181369635012abf2245
|
|
|
|
|
| |
PiperOrigin-RevId: 616951235
Change-Id: I2d6e95a432285c3f79ef8484848e88e06973f51f
|
|
|
|
|
| |
PiperOrigin-RevId: 613326708
Change-Id: I6e5ca195f208b8da0d21d70b5a035bfdc64f866d
|
|
|
|
|
| |
PiperOrigin-RevId: 612509928
Change-Id: I90de2e6bd229bf5cf71a27e9c491bc2794e9265f
|
|
|
|
|
|
|
|
|
|
|
| |
and use StdcppWaiter instead.
There are various flavors of MinGW, some of which support pthread,
and some of which support Win32. Instead of figuring out which
platform is being used, just use the generic implementation.
PiperOrigin-RevId: 580565507
Change-Id: Ia85fd7496f1e6ebdeadb95202f0039e844826118
|
|
|
|
|
|
|
| |
it runs on non-dedicated Kokoro
PiperOrigin-RevId: 558874605
Change-Id: Iba35f558ab8c967f98a3176af056e76341fb67c3
|
|
|
|
|
|
|
|
|
| |
Since ABSL_INTERNAL_HAVE_STDCPP_WAITER is defined on all systems
it is effectively a fallback. I left the condition there in case
we have to disable it on some platform in the future.
PiperOrigin-RevId: 555629066
Change-Id: I76ca78c7f36d1d02dc4950a44c66903a2aaf2a52
|
|
|
|
|
| |
PiperOrigin-RevId: 548709037
Change-Id: I6eb03553299265660aa0abc180ae0f197a416ba4
|
|
|
|
|
|
|
|
|
|
|
| |
Reformat Mutex-related files so that incremental formatting changes
don't distract during review of logical changes.
These files are subtle and any unnecessary diffs make reviews harder.
No changes besides running clang-format.
PiperOrigin-RevId: 541981737
Change-Id: I41cccb7a97158c78d17adaff6fe553c2c9c2b9ed
|
|
|
|
|
|
|
|
|
|
|
| |
The non-RAW_ versions provide better output but weren't available when most of these tests were written.
There are just a couple spots where RAW_ is actually needed, e.g. signal handlers and malloc hooks.
Also fix a couple warnings in layout_test.cc newly surfaced because the optimizer understands CHECK_XX differently than INTERNAL_CHECK.
PiperOrigin-RevId: 534584435
Change-Id: I8d36fa809ffdaae5a3813064bd602cb8611c1613
|
|
|
|
|
| |
PiperOrigin-RevId: 530238518
Change-Id: I2bfca582c0734f7e6943c5359730a2857809e2d2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
time_t
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1433
Some 32-bit configurations may use 64-bit time_t, which leads to different layout of userspace timespec and the one expected by SYS_futex implementation in kernel. In particular the issue occurs when using musl libc which has switched to unconditional 64-bit time_t definition.
This patch introduces custom struct timespec with two longs when old SYS_futex is used to match the kernel timespec definition.
Merge 2eaca415da825b3f31a90f58a35bdef2b6d2a6c5 into f8bf909108b3604a00590a074f2986c0895514d2
Merging this change closes #1433
COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1433 from olegartys:futex_time64_bug 2eaca415da825b3f31a90f58a35bdef2b6d2a6c5
PiperOrigin-RevId: 528796119
Change-Id: Idaa952f64bd97c6dc9703a8b44deac43e29ff9ae
|
|\
| |
| |
| |
| | |
PiperOrigin-RevId: 526675031
Change-Id: Ib84423ccea2d0183166194a0916a97a7ed32915c
|
| |
| |
| |
| | |
This lets us avoid having to do the addition manually.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
for __ANDROID_API__ >= 30
https://android.googlesource.com/platform/bionic/+/69010802d037dbc10377416bd9cc696fa34b9384%5E%21/libc/include/pthread.h
PiperOrigin-RevId: 525815479
Change-Id: I88cd1a06a4f7bb5380ff7c1e6a8f45e2b04b7df8
|
|/
|
|
|
| |
PiperOrigin-RevId: 525808747
Change-Id: I01aeef6b8558673bf1fc38a948dcecf00300b641
|
|
|
|
|
|
|
| |
tests under sanitizers. The overrides break the sanitizers.
PiperOrigin-RevId: 524037272
Change-Id: I85b87d3870c488cb316505e94b394c6f98e9f60f
|
|
|
|
|
|
|
| |
for relative timeouts
PiperOrigin-RevId: 523789416
Change-Id: Ide4cfdcae9ea7bffca3355c80ea9c8833a9536e6
|
|
|
|
|
|
|
|
|
|
|
| |
proposed standard pthread_cond_clockwait() and sem_clockwait().
These are currently implemented in glibc >= 2.30.
These methods take a clock and use an absolute time with reference
to that clock, so KernelTimeout now can produce these values.
PiperOrigin-RevId: 522824226
Change-Id: Ife98713f6f95d800b1f8e52d5364a3dbebc4f8a6
|
|
|
|
|
|
|
| |
using the non-portable pthread_cond_timedwait_relative_np()
PiperOrigin-RevId: 522340555
Change-Id: I08682f74d8d94965330f12274c7a92632b1a29f1
|
|
|
|
|
| |
PiperOrigin-RevId: 519939158
Change-Id: I9b049fa55167ed4064f3909887eec7bc52601677
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This implementation may at some point become the default on some
platforms. Currently not all platforms have widespread support for
both real absolute timeouts or real relative timeouts (here "real"
means without converting to the other timeout type which is the only
one supported by the underlying APIs). In this case we can defer to
their standard library to implement correct support.
This is not currently the default on any platform
Note: The size of WaiterState had to increase to fit the new implementation
PiperOrigin-RevId: 518266646
Change-Id: I7f246646a960d6e1b155f9de0bf2f681c5d3d245
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of being only able to test the platform Waiter implementation,
this allows us to be able to test all Waiter implementations that
build on a specific platform.
A unittest is added that tests all implementations that work for the
platform, and allows us to check that the expected one is being used
by printing the name of the selected implementation.
PiperOrigin-RevId: 518072415
Change-Id: Ie9e6fcd9d8283b4038e6f4e68a304d2adcc04b19
|
|
|
|
|
|
|
| |
Windows tests often run in Emulation, and even with KVM we can still timeout.
PiperOrigin-RevId: 517192968
Change-Id: I3b4e435f8ac8ad1e7eab6f043c051fa75efed64b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
monotonic clocks on Linux when the implementation uses futexes
After this change, when synchronization methods that wait are passed
an absl::Duration to limit the wait time, these methods will wait for
that interval, even if the system clock is changed (subject to any
limitations with how CLOCK_MONOTONIC keeps track of time). In other
words, an observer measuring the time with a stop watch will now see
the correct interval, even if the system clock is changed. Previously,
the duration was added to the current time, and methods would wait
until that time was reached on the possibly changed realtime system
clock.
The behavior of the synchronization methods that take an absl::Time is
unchanged. These methods always wait until the absolute point in time
is reached and respect changes to the system clock. In other words, an
observer will always see the timeout occur when a wall clock reaches
that time, even if the clock is manipulated externally.
Note: ABSL_PREDICT_FALSE was removed from the error case in Futex as
timeouts are handled by this case, and timeouts are part of normal
operation.
PiperOrigin-RevId: 516534869
Change-Id: Ib70b83e4be3f9e3f1727646975a21a1d30acb242
|
|
|
|
|
|
|
|
|
|
| |
timeouts, but when a relative timeout is provided, the timeout is an
absolute timeout against a steady clock (when possible). This allows
methods that return relative timeouts to automatically recompute the
remaining duration, for instance, on suprious wakeups.
PiperOrigin-RevId: 516304139
Change-Id: I7d739cb50dd749eba5dba7ac6c34d18dc53703ed
|
|
|
|
|
| |
PiperOrigin-RevId: 515427893
Change-Id: I89e8756fcf400459b0226d14785c6511ad3e380b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
monotonic clocks on Linux when the implementation uses futexes
After this change, when synchronization methods that wait are passed
an absl::Duration to limit the wait time, these methods will wait for
that interval, even if the system clock is changed (subject to any
limitations with how CLOCK_MONOTONIC keeps track of time). In other
words, an observer measuring the time with a stop watch will now see
the correct interval, even if the system clock is changed. Previously,
the duration was added to the current time, and methods would wait
until that time was reached on the possibly changed realtime system
clock.
The behavior of the synchronization methods that take an absl::Time is
unchanged. These methods always wait until the absolute point in time
is reached and respect changes to the system clock. In other words, an
observer will always see the timeout occur when a wall clock reaches
that time, even if the clock is manipulated externally.
Note: ABSL_PREDICT_FALSE was removed from the error case in Futex as
timeouts are handled by this case, and timeouts are part of normal
operation.
PiperOrigin-RevId: 515043788
Change-Id: I151127b588065bd1316273f36d7c946545c2c892
|
|
|
|
|
| |
PiperOrigin-RevId: 512979517
Change-Id: I7fe38ed246e42e6f8eb322e15c3b299215163168
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
monotonic clocks on Linux when the implementation uses futexes
After this change, when synchronization methods that wait are passed
an absl::Duration to limit the wait time, these methods will wait for
that interval, even if the system clock is changed (subject to any
limitations with how CLOCK_MONOTONIC keeps track of time). In other
words, an observer measuring the time with a stop watch will now see
the correct interval, even if the system clock is changed. Previously,
the duration was added to the current time, and methods would wait
until that time was reached on the possibly changed realtime system
clock.
The behavior of the synchronization methods that take an absl::Time is
unchanged. These methods always wait until the absolute point in time
is reached and respect changes to the system clock. In other words, an
observer will always see the timeout occur when a wall clock reaches
that time, even if the clock is manipulated externally.
Note: ABSL_PREDICT_FALSE was removed from the error case in Futex as
timeouts are handled by this case, and timeouts are part of normal
operation.
PiperOrigin-RevId: 510405347
Change-Id: I0b3ea390de97014cfa353079ae2e0c1c637aca69
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
std::chrono methods used by std::condition_variable.
A followup change will add an implemention of
synchronization_internal::Waiter that can use
std:mutex/std::condition_variable to implement the per-thread
semaphore that absl::Mutex waits on. This implementation may at some
point become the default on platforms such as Windows where there
doesn't seem to be an easy way of supporting real absolute timeouts. In
this case we can defer to their standard library to implement correct
support.
PiperOrigin-RevId: 510204786
Change-Id: Icf4d695013fd060abbd53dae23e71ea36f731565
|
|
|
|
|
|
|
| |
instead of absl::ToUnixNanos(absl::Now());
PiperOrigin-RevId: 509829866
Change-Id: Ib34362762304ad6eb7980a1227d717069b84f656
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
APIs that take KernelTimeout as a parameter can now query if an
absolute or relative timeout was requested. If the underlying API can
only use one type of timeout, the code will do a reasonable
conversion.
The goal is to eventually enable the possibility of using wait times
that are based on monotonic clocks that are safe against system clock
steps.
PiperOrigin-RevId: 508541507
Change-Id: Id08bf13515f3e1bfd78d88393cde98a6fd3ef72c
|
|
|
|
|
| |
PiperOrigin-RevId: 508124592
Change-Id: Ib183e6e241c81b2760e7f849f8af8e7e2c30ea42
|
|
|
|
|
| |
PiperOrigin-RevId: 506323250
Change-Id: I0f7d4532c19088b011740ceff87ecec55cc34edb
|
|
|
|
|
| |
PiperOrigin-RevId: 496974198
Change-Id: I73b4013a2ad9fd37650d788cbd1e758b327b59d2
|
|
|
|
|
|
|
|
|
| |
Rather than add new friends every time
a new (internal) use arises, just expose
the timestamp.
PiperOrigin-RevId: 495722262
Change-Id: I25d2ce64769dc58cbe634259f07c600ce6c1e714
|
|
|
|
|
| |
PiperOrigin-RevId: 488676817
Change-Id: I13f15bb93ab6dda4c56caf969be3c14f84ada6a0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Addresses failures with the following, in some files:
-Wshorten-64-to-32
-Wimplicit-int-conversion
-Wsign-compare
-Wsign-conversion
-Wtautological-unsigned-zero-compare
(This specific CL focuses on .cc files in */internal/.)
Bug: chromium:1292951
PiperOrigin-RevId: 473868797
Change-Id: Ibe0b76e33f9e001d59862beaac54fb47bacd39b2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Addresses failures with the following, in some files:
-Wshorten-64-to-32
-Wimplicit-int-conversion
-Wsign-compare
-Wsign-conversion
-Wtautological-unsigned-zero-compare
(This specific CL focuses on .cc files in */internal/.)
Bug: chromium:1292951
PiperOrigin-RevId: 471561809
Change-Id: I7abd6d83706f5ca135f1ce3458192a498a6280b9
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Addresses failures with the following, in some files:
-Wshorten-64-to-32
-Wimplicit-int-conversion
-Wsign-compare
-Wsign-conversion
-Wtautological-unsigned-zero-compare
(This specific CL focuses on .cc files in */internal/.)
Bug: chromium:1292951
PiperOrigin-RevId: 471549854
Change-Id: Id685d0e4666212926f4e001b8ef4930b6a33a4cc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Addresses failures with the following, in some files:
-Wshorten-64-to-32
-Wimplicit-int-conversion
-Wsign-compare
-Wsign-conversion
-Wtautological-unsigned-zero-compare
(This specific CL focuses on .cc files in dirs n-t, except string.)
Bug: chromium:1292951
PiperOrigin-RevId: 465287204
Change-Id: I0fe98ff78bf3c08d86992019eb626755f8b6803e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Addresses failures with the following, in some files:
-Wshorten-64-to-32
-Wimplicit-int-conversion
-Wsign-compare
-Wsign-conversion
-Wtautological-unsigned-zero-compare
(This specific CL focuses on .h and win32 .inc files.)
Bug: chromium:1292951
PiperOrigin-RevId: 463835431
Change-Id: If8e5f7f651d5cd96035e23e4623bdb08a7fedabe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Both Mutex and CondVar signal PerThreadSem/Waiter after satisfying the wait condition,
as the result the waiting thread may return w/o waiting on the
PerThreadSem/Waiter at all. If the waiting thread then exits, it currently
destroys Waiter object. As the result Waiter::Post can be called on
already destroyed object.
PerThreadSem/Waiter must be type-stable after creation and must not be destroyed.
The futex-based implementation is the only one that is not affected by the bug
since there is effectively nothing to destroy (maybe only UBSan/ASan
could complain about calling methods on a destroyed object).
Here is the problematic sequence of events:
1: void Mutex::Block(PerThreadSynch *s) {
2: while (s->state.load(std::memory_order_acquire) == PerThreadSynch::kQueued) {
3: if (!DecrementSynchSem(this, s, s->waitp->timeout)) {
4: PerThreadSynch *Mutex::Wakeup(PerThreadSynch *w) {
5: ...
6: w->state.store(PerThreadSynch::kAvailable, std::memory_order_release);
7: IncrementSynchSem(this, w);
8: ...
9: }
Consider line 6 is executed, then line 2 observes kAvailable and
line 3 is not called. The thread executing Mutex::Block returns from
the method, acquires the mutex, releases the mutex, exits and destroys
PerThreadSem/Waiter.
Now Mutex::Wakeup resumes and executes line 7 on the destroyed object. Boom!
CondVar uses a similar pattern.
Moreover the semaphore-based Waiter implementation is not even destruction-safe
(the Waiter cannot be used to signal own destruction). So even if Mutex/CondVar
would always pair Waiter::Post with Waiter::Wait before destroying PerThreadSem/Waiter,
it would still be subject to use-after-free bug on the semaphore.
PiperOrigin-RevId: 449159939
Change-Id: I497134fa8b6ce1294a422827c5f0de0e897cea31
|
|
|
|
|
| |
PiperOrigin-RevId: 449067700
Change-Id: I972b1736c28d76ed500e9ad6fd15c7a469a5825f
|
|
|
|
|
| |
PiperOrigin-RevId: 448159349
Change-Id: I6b25a90d8a3b6d3a888274d156aa696d77fb042d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--
5d6734366ec54997df5234ac3b7e21015d7d5fde by Martijn Vels <mvels@google.com>:
Increase slop for unit test to reduce flakiness of test
PiperOrigin-RevId: 371935786
--
6e97ff23e7f732ebf969bbc69102e5e677aae8cd by Martijn Vels <mvels@google.com>:
Add node and memory usage stats analysis to GetCordzStatistics.
PiperOrigin-RevId: 371893353
--
17f7443e6f988f25efa25c2291c1cde191af2bf2 by Martijn Vels <mvels@google.com>:
Add check on n == 0 in CordReader::ReadCord, which breaks invariants in the ring buffer code.
PiperOrigin-RevId: 371738207
GitOrigin-RevId: 5d6734366ec54997df5234ac3b7e21015d7d5fde
Change-Id: I0fc883f4f49f2380ab9afddbdfe6eb5ccc15dfc3
|