Skip to content

Commit 6c40bd5

Browse files
authored
Activate asan on ubuntu (#12165)
1 parent 4713181 commit 6c40bd5

File tree

2 files changed

+48
-5
lines changed

2 files changed

+48
-5
lines changed

.github/workflows/firestore.yml

+47-3
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ jobs:
9797
- name: Run check
9898
run: scripts/check.sh --test-only
9999

100-
101100
cmake:
102101
needs: check
103102
# Either a scheduled run from public repo, or a pull request with firestore changes.
@@ -231,7 +230,7 @@ jobs:
231230
scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ runner.os }} cmake
232231
233232
234-
sanitizers:
233+
sanitizers-mac:
235234
# Either a scheduled run from public repo, or a pull request with firestore changes.
236235
if: |
237236
(github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') ||
@@ -240,7 +239,6 @@ jobs:
240239

241240
strategy:
242241
matrix:
243-
# TODO(b/260248007): Re-enable this once tsan passes on Linux
244242
os: [macos-12]
245243
sanitizer: [asan, tsan]
246244

@@ -274,6 +272,52 @@ jobs:
274272
scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ runner.os }} cmake
275273
276274
275+
sanitizers-ubuntu:
276+
# Either a scheduled run from public repo, or a pull request with firestore changes.
277+
if: |
278+
(github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') ||
279+
(github.event_name == 'pull_request' && needs.changes.outputs.changed == 'true')
280+
needs: check
281+
282+
strategy:
283+
matrix:
284+
os: [ubuntu-latest]
285+
# Excluding TSAN on ubuntu because of the warnings it generates around schedule.cc.
286+
# This could be due to Apple Clang provide additional support for synchronization
287+
# on Apple platforms, which is what we primarily care about.
288+
sanitizer: [asan]
289+
290+
runs-on: ${{ matrix.os }}
291+
292+
env:
293+
SANITIZERS: ${{ matrix.sanitizer }}
294+
ASAN_OPTIONS: detect_leaks=0
295+
296+
steps:
297+
- uses: actions/checkout@v3
298+
299+
- name: Prepare ccache
300+
uses: actions/cache@v3
301+
with:
302+
path: ${{ runner.temp }}/ccache
303+
key: ${{ matrix.sanitizer }}-firestore-ccache-${{ runner.os }}-${{ github.sha }}
304+
restore-keys: |
305+
${{ matrix.sanitizer }}-firestore-ccache-${{ runner.os }}-
306+
307+
- uses: actions/setup-python@v4
308+
with:
309+
python-version: '3.7'
310+
311+
- name: Setup build
312+
run: scripts/install_prereqs.sh Firestore ${{ runner.os }} cmake
313+
314+
- name: Build and test
315+
run: |
316+
export EXPERIMENTAL_MODE=true
317+
export CCACHE_DIR=${{ runner.temp }}/ccache
318+
scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ runner.os }} cmake
319+
320+
277321
xcodebuild:
278322
# Either a scheduled run from public repo, or a pull request with firestore changes.
279323
if: |

Firestore/core/src/util/schedule.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#include "Firestore/core/src/util/hard_assert.h"
2020
#include "Firestore/core/src/util/task.h"
21-
#include "absl/memory/memory.h"
2221

2322
namespace firebase {
2423
namespace firestore {
@@ -29,7 +28,7 @@ Schedule::~Schedule() {
2928
}
3029

3130
void Schedule::Clear() {
32-
std::unique_lock<std::mutex> lock{mutex_};
31+
std::lock_guard<std::mutex> lock{mutex_};
3332

3433
for (Task* task : scheduled_) {
3534
task->Release();

0 commit comments

Comments
 (0)