Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixture file based tests fail due to Linux Kernel issue #537

Open
kevindew opened this issue Dec 7, 2021 · 1 comment
Open

Fixture file based tests fail due to Linux Kernel issue #537

kevindew opened this issue Dec 7, 2021 · 1 comment

Comments

@kevindew
Copy link
Member

kevindew commented Dec 7, 2021

People have experienced problems running the test suites of Content Publisher and Whitehall (I'm not aware of other apps but there could be more) using govuk-docker. It transpires this issue is a problem with the Linux kernel, in particular the version that Docker-for-mac is using currently (on my machine it's 5.10.47-linuxkit) but I'm recording this here so the GOV.UK issue is documented and can be tracked to a degree.

The evidence of the problem is tests that fail like so:

     MiniMagick::Invalid:
       `identify /tmp/mini_magick20211206-1-7orhba.jpg` failed with error:
       identify-im6.q16: insufficient image data in file `/tmp/mini_magick20211206-1-7orhba.jpg' @ error/jpeg.c/ReadJPEGImage_/1166.

or

Error:
ImageUploaderTest#test_should_store_all_the_versions_of_a_bitmap_image_in_asset_manager:
CarrierWave::ProcessingError: Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: `convert /govuk/whitehall/tmp/1321009871-957757668381030-0168-8098/s960/minister-of-funk.960x640.jpg -auto-orient -resize 960x640^ -gravity Center -background rgba(255,255,255,0.0) -extent 960x640 /tmp/image_processing20111111-428-11fn1kn.jpg` failed with error:
convert-im6.q16: insufficient image data in file `/govuk/whitehall/tmp/1321009871-957757668381030-0168-8098/s960/minister-of-funk.960x640.jpg' @ error/jpeg.c/ReadJPEGImage_/1166.
convert-im6.q16: no images defined `/tmp/image_processing20111111-428-11fn1kn.jpg' @ error/convert.c/ConvertImageCommand/3229.

The source of the issue is a relatively obscure set of circumstances: a file is stored on a docker mount (i.e. a test fixture), it is then copied to be a temporary file (i.e. a test faking the upload of a file) and then is copied again (i.e copying the uploaded file for processing).

The issue is discussed (at length) in: docker/for-linux#1015. It looks like versions of Linux Kernel > 5.10 are fixed and it appears that a backported fix for 5.10 is imminent, however it's completely unclear how long it will take for any fixes to make their way into a Docker-for-mac releases.

The two options I see ahead of us for this are:

  1. Wait it out, expect that a future release of Docker Desktop for mac resolves it
  2. Refactor test code that is affected by this issue to no longer be affected by the circumstances - there seems to be some examples based off the issue

By default, we're effectively doing 1) now - I imagine if this issue continues for multiple months we may switch to taking 2)

ollietreend added a commit that referenced this issue Dec 7, 2021
This commit is a workaround for the issue #537. It allows the Content Publisher and Whitehall test suites to pass in the GOV.UK Docker development environment.

Once docker/for-linux#1015 has been fixed, this workaround will no longer be needed.
@ollietreend
Copy link
Contributor

I've implemented a workaround for the Whitehall and Content Publisher apps in #539, which follows an approach laid out in a comment on docker/for-linux#1015.

In short: it turns out the bug doesn't occur when /tmp is mounted as a tmpfs volume.

ollietreend added a commit that referenced this issue Dec 7, 2021
Mount /tmp as a tmpfs volume to work around #537
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants