This is what I think is happening:

  • I remove an image (actually a user picture)
  • I upload the removed image with the same source file. Call this FILE_A.jpg
  • So now /admin/content/files shows two lines:
    1. FILE_A.jpg with a use count of zero: the recently deleted User Picture
    2. FILE_A.jpg with a use count of 1: the newly uploaded User Picture
  • Come the next day and FILE_A.jpg is not rendered. It's not in the files/styles directory any more. It's been gc'd.
  • But there's still a line in /admin/content/files saying FILE_A.jpg's status is "permanent".

Is it reasonable to expect this replacement of one image with an image with the same file name to work without error? Are there other situations - e.g. a race condition - that could also cause this confusion?

CommentFileSizeAuthor
Files___Bradford_Abbas_β_Website.png40.75 KBiainH
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

iainH created an issue. See original summary.

swentel’s picture

In the end it might be a file.module problem .. :)

I'll try to write a test for it to see if we can reproduce it.

iainH’s picture

Thanks. There's something funny going on - AFAIR Drupal 7 used to append a suffix if a file was uploaded more than once. But what I see elsewhere on the same site: two separate lines in /admin/content/files for another file: FILE_B.jpg.

I am wondering what happens when one of those is removed from the site. Each one has a use count of one. So when somebody removes their FILE_B.jpg, its use count will go to zero; the image will be gc'd; the other use of FILE_B.jpg will still have a use count of one but will probably look for the gc'd image file in vain.

I expect Drupal is doing something more sophisticated to identify different files with the same name ... in different or the same directories (determined by default by year and month) ... but in this case it looks like something is slipping through.

Then there is the lifecycle of the thumbnails etc. styles generated from the original images ... head spins ... gives up for the night.

Berdir’s picture

The suffix is only added on the stored file, not the saved file name. If you have such duplicates, check if they have different file names on the file system.

There's nothing sophisticated going on as far as I know. Two files, different filenames on storage (uri), same filename in UI, different UUID. Only the UUID is used by e.g. editor.module to track and identify embedded files.

Wim Leers’s picture

In the end it might be a file.module problem .. :)

I suspect and hope so.

Wim Leers’s picture

xjm’s picture

I'm not sure how a bug in editor.module could cause the deletion of user pictures?

This does look like a pure duplicate of #2666700: User profile images unexpectedly deleted though, so leaving this closed as duplicate and promoting that one.