Project

General

Profile

Actions

action #131471

open

Leftover worker temporary directories in /tmp on OSD and O3 size:M

Added by kraih over 1 year ago. Updated over 1 year ago.

Status:
Workable
Priority:
Normal
Assignee:
-
Category:
Regressions/Crashes
Target version:
Start date:
2023-06-27
Due date:
% Done:

0%

Estimated time:

Description

Motivation

While investigating #131447 we noticed that there are quite a few leftover temporary directories in /tmp. These appear to have been created by the scheduler or webui, and under certain circumstances are not cleaned up even if they are no longer needed.

...
drwx------ 2 geekotest nogroup  40 Jun 24 14:42 Y7FKl4lvbt
drwx------ 2 geekotest nogroup  40 Jun 22 08:39 yblAcg26X3
drwx------ 2 geekotest nogroup  40 Jun 25 09:09 YeBlK48awn
drwx------ 2 geekotest nogroup  40 Jun 23 19:55 yENrB8ToeU
drwx------ 2 geekotest nogroup  40 Jun 27 12:04 Y_F6OzG5_3
drwx------ 2 geekotest nogroup  40 Jun 23 17:46 yfGT2ppHyr
drwx------ 2 geekotest nogroup  40 Jun 25 09:09 yfneSFCwls
drwx------ 2 geekotest nogroup  40 Jun 22 16:54 yHqfyU6xnC
drwx------ 2 geekotest nogroup  40 Jun 26 02:26 YHrukyCIn5
drwx------ 2 geekotest nogroup  40 Jun 27 11:22 yIlfzjoPpj
drwx------ 2 geekotest nogroup  40 Jun 23 21:16 Yixisovjrn
drwx------ 2 geekotest nogroup  40 Jun 23 17:48 Yj1yuoh_7D
drwx------ 2 geekotest nogroup  40 Jun 22 11:50 YlIRb1a69M
drwx------ 2 geekotest nogroup  40 Jun 27 12:19 YLqGsMNpZ9
...

What triggers the directories not to be cleaned up?
From the openqa_scheduler_log:

[2023-06-27T19:25:43.422205Z] [warn] [pid:5909] Failed sending job(s) '3387016' to worker '425': Unable to assign job to worker 425: the worker is not connected anymore

In those cases $schema->txn_do(sub { $worker->unprepare_for_work; }); is called, which simply deletes the setting in the DB, but doesn't remove the dirctory.

Acceptance criteria

  • AC1: No more leftover temporary directories on OSD and O3

Suggestions

  • tempdir() is called in two places (here and here)
  • Focus on fixing the cleanup code
  • It might make sense to change the default directory from /tmp to some directory under /var/lib/openqa/... too, since that's usually where we have our faster larger disks mounted

Out of scope


Related issues 3 (1 open2 closed)

Related to openQA Project (public) - action #131447: Some jobs incomplete due to auto_review:"api failure: 400.*/tmp/.*png.*No space left on device.*Utils.pm line 285":retry but enough space visible on machinesResolvedkraih2023-06-27

Actions
Related to openQA Project (public) - action #131516: Consider creating a separate tmp dir filesystem, e.g. tmpfs?New

Actions
Related to openQA Project (public) - action #131465: Make temporary files and directories created by openQA services easier to identify size:MResolvedtinita2023-06-272023-07-13

Actions
Actions

Also available in: Atom PDF