Skip to content

Commit 929c59c

Browse files
authored
Merge branch 'master' into patch-1
2 parents 9bda6bd + 0b3056d commit 929c59c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+4272
-2189
lines changed

configs/test/k8s/schedule-fuzz.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ metadata:
1818
name: schedule-fuzz
1919
spec:
2020
schedule: "*/10 * * * *"
21-
concurrencyPolicy: Forbid
21+
concurrencyPolicy: Allow
2222
jobTemplate:
2323
spec:
24-
activeDeadlineSeconds: 900 # 15 minutes.
24+
activeDeadlineSeconds: 1800 # 30 minutes.
2525
template:
2626
spec:
2727
containers:

configs/test/project.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ firebase:
5757
- google.com
5858
# - github.com
5959

60-
uworker_tasks:
61-
- analyze
62-
60+
full_utask_model:
61+
enabled: false
6362

6463
stacktrace:
6564
# Stack frames to ignore when determining the crash signature.

infra/terraform/main.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,25 @@ resource "google_compute_router_nat" "nat_config" {
132132
filter = "ALL"
133133
}
134134
}
135+
136+
resource "google_pubsub_topic" "crash_replication" {
137+
name = "crash-replication"
138+
project = var.project_id
139+
}
140+
141+
resource "google_pubsub_subscription" "crash_replication_push_to_appengine" {
142+
ack_deadline_seconds = 120
143+
144+
name = "crash-replication-push-to-appengine"
145+
project = var.project_id
146+
147+
push_config {
148+
oidc_token {
149+
service_account_email = var.appengine_service_account
150+
}
151+
152+
push_endpoint = var.testcase_replication_push_endpoint
153+
}
154+
155+
topic = google_pubsub_topic.crash_replication.name
156+
}

infra/terraform/monitoring.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1626,4 +1626,4 @@ resource "google_monitoring_dashboard" "clusterfuzz_sli_dashboard" {
16261626
"labels": {}
16271627
}
16281628
JSON
1629-
}
1629+
}

infra/terraform/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,13 @@ variable "network_description" {
5454
default = ""
5555
description = "The network description"
5656
}
57+
58+
variable "appengine_service_account" {
59+
default = ""
60+
description = "AppEngine service account for the clusterfuzz deployment"
61+
}
62+
63+
variable "testcase_replication_push_endpoint" {
64+
default = ""
65+
description = "Endpoint to push testcase replication messages to"
66+
}

src/appengine/handlers/testcase_detail/create_issue.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from flask import request
1717

1818
from clusterfuzz._internal.issue_management import issue_filer
19+
from clusterfuzz._internal.metrics import events
1920
from handlers import base_handler
2021
from handlers.testcase_detail import show
2122
from libs import handler
@@ -46,6 +47,13 @@ def create_issue(testcase, severity, cc_me):
4647
user_email=user_email,
4748
additional_ccs=additional_ccs)
4849

50+
events.emit(
51+
events.IssueFilingEvent(
52+
testcase=testcase,
53+
issue_tracker_project=issue_tracker.project,
54+
issue_id=str(issue_id) if issue_id else None,
55+
issue_created=bool(issue_id)))
56+
4957
if not issue_id:
5058
raise helpers.EarlyExitError('Unable to create new issue.', 500)
5159

src/appengine/handlers/upload_testcase.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
from clusterfuzz._internal.google_cloud_utils import blobs
3636
from clusterfuzz._internal.google_cloud_utils import storage
3737
from clusterfuzz._internal.issue_management import issue_tracker_utils
38+
from clusterfuzz._internal.metrics import events
39+
from clusterfuzz._internal.metrics import monitor
40+
from clusterfuzz._internal.metrics import monitoring_metrics
3841
from clusterfuzz._internal.system import archive
3942
from clusterfuzz._internal.system import environment
4043
from handlers import base_handler
@@ -303,6 +306,8 @@ def get_upload(self):
303306

304307
def do_post(self):
305308
"""Upload a testcase."""
309+
# Set artifical task id env to be used by tracing.
310+
environment.set_task_id_vars(task_name='upload_testcase')
306311
email = helpers.get_user_email()
307312
testcase_id = request.get('testcaseId')
308313
uploaded_file = self.get_upload()
@@ -393,8 +398,8 @@ def do_post(self):
393398
'trustedAgreement') == TRUSTED_AGREEMENT_TEXT.strip()
394399

395400
# Chrome is the only ClusterFuzz deployment where there are trusted bots
396-
# running utasks.
397-
# This check also fails on oss-fuzz because of the way it abuses platform.
401+
# running utasks. This check also fails on oss-fuzz because of the way it
402+
# abuses platform.
398403
if (not trusted_agreement_signed and utils.is_chromium() and
399404
task_utils.is_remotely_executing_utasks() and
400405
((platform_id and platform_id != 'Linux') or
@@ -606,8 +611,14 @@ def do_post(self):
606611
additional_metadata=testcase_metadata,
607612
crash_data=crash_data)
608613

614+
testcase = data_handler.get_testcase_by_id(testcase_id)
615+
events.emit(
616+
events.TestcaseCreationEvent(
617+
testcase=testcase,
618+
creation_origin=events.TestcaseOrigin.MANUAL_UPLOAD,
619+
uploader=email))
620+
609621
if not quiet_flag:
610-
testcase = data_handler.get_testcase_by_id(testcase_id)
611622
issue = issue_tracker_utils.get_issue_for_testcase(testcase)
612623
if issue:
613624
report_url = data_handler.TESTCASE_REPORT_URL.format(
@@ -668,3 +679,14 @@ def get_upload(self):
668679
@handler.oauth
669680
def post(self, *args):
670681
return self.do_post()
682+
683+
684+
class CrashReplicationUploadHandler(base_handler.Handler):
685+
"""Handler that picks up the pubsub notification."""
686+
687+
@handler.pubsub_push
688+
def post(self, message):
689+
helpers.log(message.data.decode(), helpers.VIEW_OPERATION)
690+
with monitor.wrap_with_monitoring():
691+
monitoring_metrics.UPLOAD_TESTCASE_COUNT.increment()
692+
return 'ok'

src/appengine/server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ def register_routes(flask_app, routes):
194194
('/upload-testcase/get-url-oauth', upload_testcase.UploadUrlHandlerOAuth),
195195
('/upload-testcase/prepare', upload_testcase.PrepareUploadHandler),
196196
('/upload-testcase/load', upload_testcase.JsonHandler),
197+
('/upload-testcase/crash-replication',
198+
upload_testcase.CrashReplicationUploadHandler),
197199
('/upload-testcase/upload', upload_testcase.UploadHandler),
198200
('/upload-testcase/upload-oauth', upload_testcase.UploadHandlerOAuth),
199201
('/update-job', jobs.UpdateJob),

src/clusterfuzz/_internal/base/concurrency.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,16 @@
2121
POOL_SIZE = multiprocessing.cpu_count()
2222

2323

24-
class SingleThreadPool:
25-
"""Single thread pool for when it's not worth using Python's thread
26-
implementation."""
27-
28-
def __init__(self, size):
29-
del size
30-
31-
def map(self, f, l):
32-
return list(map(f, l))
33-
34-
3524
@contextlib.contextmanager
36-
def make_pool(pool_size=POOL_SIZE, cpu_bound=False, max_pool_size=None):
25+
def make_pool(pool_size=POOL_SIZE, max_pool_size=None):
3726
"""Returns a pool that can (usually) execute tasks concurrently."""
3827
if max_pool_size is not None:
3928
pool_size = min(pool_size, max_pool_size)
4029

4130
# Don't use processes on Windows and unittests to avoid hangs.
4231
if (environment.get_value('PY_UNITTESTS') or
4332
environment.platform() == 'WINDOWS'):
44-
if cpu_bound:
45-
yield SingleThreadPool(pool_size)
46-
else:
47-
yield futures.ThreadPoolExecutor(pool_size)
33+
yield futures.ThreadPoolExecutor(pool_size)
4834
else:
4935
yield futures.ProcessPoolExecutor(pool_size)
5036

src/clusterfuzz/_internal/base/errors.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
'interrupted function call',
2828
'out of memory',
2929
'systemexit:',
30+
'Expired token, failed to download uworker_input',
3031
]
3132

3233

0 commit comments

Comments
 (0)