Project

General

Profile

Actions

Bug #36842

closed

Specific key breaks cache-method

Added by Markus Bucher 12 months ago. Updated 11 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

This is a tricky one:

We had the problem, that REX-Jobs were successful on the host, but reported as failed, with a strange log-message:

ArgumentError (invalid %-encoding (http%3A%2F%2F...

From the Backtrace it was visible, that this happened during Rails.cache.delete_matched()

Running a foreman-rake tmp:cache:clear fixed the issue for a short time, but the error re-appeared.

I was able to reproduce it with the following code-snippet:

a = "http://thisisaverylonghostname.de/pulp/content/Organize/installation_media/installation_media/custom/installation_media/Ubuntu20_04_1//dists/focal/main/installer-amd64/current/legacy-images/netboot/ubuntu-installer/amd64/initrd.gz" 
Rails.cache.write a, 'hello'
Rails.cache.delete_matched(/hello/)

This leads to the following Error:

Traceback (most recent call last):
        2: from lib/tasks/console.rake:5:in `block in <top (required)>'
        1: from (irb):4
ArgumentError (invalid %-encoding (http%3A%2F%2Fthisisaverylonghostname.de%2Fpulp%2Fcontent%2FOrganize%2Finstallation_media%2Finstallation_media%2Fcustom%2Finstallation_media%2FUbuntu20_04_1%2F%2Fdists%2Ffocal%2Fmain%2Finstaller-amd64%2Fcurrent%2Flegacy-images%/2Fnetboot%2Fubuntu-installer%2Famd64%2Finitrd.gz))

This IMHO is a generic problem with the FileStore-cache in rails: https://github.com/rails/rails/issues/49690

But it looks like we can mitigate it by adding a trailing / to the cache-path, since then, only the second part will be decoded.

Actions #1

Updated by The Foreman Bot 12 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/9869 added
Actions #2

Updated by The Foreman Bot 11 months ago

  • Fixed in Releases 3.9.0 added
Actions #3

Updated by Markus Bucher 11 months ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF