Project

General

Profile

Actions

action #88347

closed

upload_asset function fails for larger files

Added by psladek over 3 years ago. Updated almost 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Regressions/Crashes
Target version:
Start date:
2021-01-29
Due date:
% Done:

0%

Estimated time:

Description

Observation

When the upload_asset() function is called in SUT on files larger than (exactly) 256kiB, they are uploaded into pool/X/assets_public (or pool/X/assets_private) with 0600 permissions (and not 0644 as for smaller files) with _openqa_worker user. This is than unreadable from server side for geekotest user and upload fails with :
'...Failed receiving asset: Can't copy file "/var/lib/openqa/pool/1/assets_public/testfile" to "/var/lib/openqa/share/factory/tmp/public/testfile.CHUNKS/testfile": Permission denied at /usr/share/openqa/script/../lib/OpenQA/Schema/Result/Jobs.pm...'
in worker log.
This problem appears only if LOCAL_UPLOAD (very useful feature otherwise) is set.

Steps to reproduce

  • Crosscheck original description when tests upload files larger than 256kiB

Problem

It turns out that this can be fixed by adding
'chmod 0644, $file;'
line in
lib/OpenQA/Worker/Job.pm
in either
'_upload_asset' sub in 'upload_local.prepare' => sub {' block,
or in
'_stop_step_4_upload' sub below 'next unless -f $file;' line.
This fixes permissions just before the final upload. If fix like this is ok, than the issue can probably be considered resolved. However as it seems that it can be fixed on more places, I am not sure about finding best solution, since I am not at all expert on the client or server upload code. It should probably be fixed already at the moment the file is placed in the pool/X/assets_public directory, or in some even more appropriate places.

Suggestion

  • Understand the current code and where it distinguishes different flows based on the file size (likely related to upload chunk size)
  • Fix in the same way regardless of the file size
Actions

Also available in: Atom PDF