opensafely-core / job-runner

A client for running jobs in an OpenSAFELY secure environment, requested via job-server (q.v.)
Other
4 stars 5 forks source link

Test failure #756

Open madwort opened 1 month ago

madwort commented 1 month ago

may be intermittent, but putting here in case I get time to poke it one day

=================================== FAILURES ===================================
________________________ test_finalize_failed_oomkilled ________________________

docker_cleanup = None
job_definition = JobDefinition(id='test_finalize_failed_oomkilled', job_request_id='job-request-test_finalize_failed_oomkilled', study=...x_filesize=16777216, database_name=None, cpu_count=None, memory_limit='6M', level4_file_types=['.csv'], cancelled=None)
tmp_work_dir = PosixPath('/tmp/pytest-of-runner/pytest-0/test_finalize_failed_oomkilled0')

    @pytest.mark.needs_docker
    def test_finalize_failed_oomkilled(docker_cleanup, job_definition, tmp_work_dir):
        # Consume memory by writing to the tmpfs at /dev/shm
        # We write a lot more that our limit, to ensure the OOM killer kicks in
        # regardless of our tests host's vm.overcommit_memory settings.
        job_definition.args = ["sh", "-c", "head -c 1000m /dev/urandom >/dev/shm/foo"]
        job_definition.memory_limit = "6M"  # lowest allowable limit

        api = local.LocalDockerAPI()

        status = api.prepare(job_definition)
        status = api.execute(job_definition)

        wait_for_state(api, job_definition, ExecutorState.EXECUTED)

        status = api.finalize(job_definition)
        assert status.state == ExecutorState.FINALIZED

        # we don't need to wait
        assert api.get_status(job_definition).state == ExecutorState.FINALIZED
        assert job_definition.id in local.RESULTS
>       assert local.RESULTS[job_definition.id].exit_code == 137
E       AssertionError: assert 128 == 137
E        +  where 128 = JobResults(outputs={'.opensafely-timestamp': 'medium', '__init__.py': 'medium', 'analysis/__init__.py': 'medium', 'analysis/count_by_year.py': 'medium', 'analysis/count_lines.py': 'medium', 'analysis/dataset_definition.py': 'medium', 'analysis/dummy_action.py': 'medium', 'analysis/filter_by_sex.py': 'medium', 'analysis/study_definition.py': 'medium', 'codelists/.gitkeep': 'medium', 'output/.gitkeep': 'medium', 'project.yaml': 'medium', 'test-data/README': 'medium', 'test-data/databuilder-dummy-data.csv': 'medium', 'test-data/dummy-data.csv': 'medium'}, unmatched_patterns=[], unmatched_outputs=[], exit_code=128, image_id='sha256:bc01a3326866eedd68525a4d2d91d2cf86f9893db054601d6be524d5c9d03981', message=None, timestamp_ns=1728570324411008361, level4_excluded_files={}, action_version='unknown', action_revision='unknown', action_created='unknown', base_revision='unknown', base_created='unknown').exit_code

tests/test_local_executor.py:518: AssertionError
=========================== short test summary info ============================
FAILED tests/test_local_executor.py::test_finalize_failed_oomkilled - Asserti...
============= 1 failed, 328 passed, 3 xfailed in 218.59s (0:03:38) =============
error: Recipe `test` failed on line 104 with exit code 1

https://github.com/opensafely-core/job-runner/actions/runs/11276033950/job/31358867481