Repository navigation
Conversation
5dc32f5 to
0043de2
Compare
0043de2 to
0a18091
Compare
ViniciustCosta
left a comment
There was a problem hiding this comment.
Can we split this into separate PR since the CI and the utask_main scheduling enhancements are unrelated?
| if instance_spec is None: | ||
| if skip_unmapped: | ||
| logs.warning(f'No batch mapping for {config_name} ' | ||
| f'({task.command}, {task.job_type}).') | ||
| continue | ||
| raise ValueError(f'No mapping for {config_name}') |
There was a problem hiding this comment.
This changes behavior for unmapped platforms. Before, a missing mapping entry raised ValueError, remote_task_gate caught it and returned the tasks as uncreated, so they were retried. Now they're left out of the uncreated list, so schedule_utask_mains acks them and they're lost.
That's right for a deleted Job (permanent), but a missing mapping is a config problem (new platform, typo, bad config rollout) and would silently discard every utask_main for that platform with only a warning. Could we skip only tasks whose Job entity is gone, and keep returning unmapped specs as uncreated (or at least log them at error level)? Same for k8s/service.py L117-120.
| spec = specs.get((remote_task.command, remote_task.job_type)) | ||
| if spec is None: | ||
| logs.warning('Skipping utask_main with missing batch spec: ' | ||
| f'{remote_task.command}, {remote_task.job_type}.') | ||
| continue |
There was a problem hiding this comment.
The old code already skipped jobs missing from config_map with logs.error('Error on mapping the job'); the KeyError was only here. This PR lowers that to a warning (L364-368) and adds this per-task warning on top. seen_keys only dedups inside the specs builder, so N stale messages for one deleted job still log N warnings here, plus the error from _get_config_names. Suggest keeping a single error-level log per (command, job_type) and dropping this per-task warning (same in k8s/service.py L331-335).
| RUN groupadd nopwsudo && \ | ||
| echo "%nopwsudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers.d/mysudoers | ||
| echo "%nopwsudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers.d/mysudoers && \ | ||
| printf '* soft nofile 65535\nroot soft nofile 65535\n' > /etc/security/limits.d/99-clusterfuzz-nofile.conf |
There was a problem hiding this comment.
Which path still needs the PAM limits file? Master already raises the soft limit after sudo: start_clusterfuzz.sh runs ulimit -Sn inside the sudo -u $USER bash -c (#5624), and ensure_open_file_limit in run.py/run_bot.py raises it again. Which process still reaches PAM with a 1024 soft limit? The verify script's third check even deletes this file to show start_clusterfuzz.sh works without it.
If there's a real path (e.g. sudo from the AFL launcher), please name it in a comment; otherwise I'd drop the file. 65535 is now hard-coded in ~6 places.
| COPY ${CLUSTERFUZZ_SOURCE_DIR}/docker/base/start_clusterfuzz.sh /data/start_clusterfuzz.sh | ||
| RUN printf '* soft nofile 65535\nroot soft nofile 65535\n' > /etc/security/limits.d/99-clusterfuzz-nofile.conf |
There was a problem hiding this comment.
These images are FROM base:ubuntu-24-04 / chromium/base:ubuntu-24-04, so they already get /data/start_clusterfuzz.sh and the limits file. Copying them again means four Dockerfiles to keep in sync. Unless immutable builds can run on a stale base (worth a comment if so), can these lines go? Same for the chromium dev/internal immutable Dockerfiles.
| self.mock.ensure_open_file_limit.assert_called_once_with() | ||
|
|
||
| @unittest.skipUnless(sys.platform.startswith('linux'), 'Linux-only script') | ||
| def test_start_clusterfuzz_script_raises_soft_nofile_after_sudo(self): |
There was a problem hiding this comment.
This tests a Docker shell script the PR doesn't change, from inside run.py's test file. It runs real sudo with preexec_fn, depends on hard-limit math and hard-codes REPO_ROOT_PARENT_DEPTH = 7. It skips on dev machines but runs as root in CI. verify_ubuntu24_nofile.sh already covers this inside the real image. Suggest removing it, along with the new imports and constants.
Summary
Follow-up hardening for Ubuntu 24.04 task scheduling and image build checks (Related: b/526881754):
create_utask_main_jobs(batch/service.pyandk8s/service.py):_get_config_namesomits tasks whoseJobentity has been removed from Datastore or whose platform is unmapped, so indexingspecs[(command, job_type)]directly raisedKeyError(and K8s crashed onNoneinstance_spec), aborting scheduling for all valid tasks in the same batch while leaving the stale message unacknowledged. Passingskip_unmapped=Trueforcreate_utask_main_jobsand guarding missing/unmapped specs logs a deduplicated warning and skips only the invalid job so valid tasks proceed and stale messages drain cleanly.nofilesoft limit in Ubuntu 24.04 PAM config and verify in CI: Adds* soft nofile 65535androot soft nofile 65535under/etc/security/limits.d/99-clusterfuzz-nofile.confin the Ubuntu 24.04 base and immutable Dockerfiles, extractsdocker/verify_ubuntu24_nofile.shto assertulimit -Sn >= 65535acrosssudo -u clusterfuzz,sudo -u root, andstart_clusterfuzz.shindependently during Ubuntu 24.04 image builds (docker/build.sh,docker/build-immutable.sh), and adds a Linux startup unit test (run_test.py).Testing
butler.py formatandbutler.py lintbutler.py py_unittest -t core -p batch_service_test.py(22/22passed)butler.py py_unittest -t core -p k8s_service_test.py(9/9passed)butler.py py_unittest -t core -p run_test.py(5/5passed)docker/verify_ubuntu24_nofile.sh(sudo -E -H -u clusterfuzz,sudo -E -H -u root, andstart_clusterfuzz.shwithout PAM override) in Docker onbase:ubuntu-24-04