U4-7823 - Could not retrieve media 0 from Examine index

Created by Sunnefa 25 Jan 2016, 10:56:58 Updated by Stephan 16 Aug 2016, 13:33:24

Relates to: U4-8856

After upgrading to 7.3.4 our log is filled with the following:

Could not retrieve media 0 from Examine index, reverting to looking up media via legacy library.GetMedia method

This happens several times per second and results in the log file becoming very large and very slow to be written into causing the entire website to slow down. I did not find any issue relating to this but there is a forum post with no answers: https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/74307-could-not-retrieve-media-0-from-examine-index

This really is a show stopper for us as we have to keep monitoring the index. If we rebuild the index it's fixed for a while but it always happens again after a couple of hours.

Comments

Stephan 26 Feb 2016, 10:37:40

PR https://github.com/umbraco/Umbraco-CMS/pull/1150

That will fail fast if media ID is <= 0, and return null. Now, it would be interesting to figure out what code is trying to retrieve a media with ID 0...


Stephan 02 Mar 2016, 15:12:31

Cannot really figure out what code is trying to retrieve a media with ID zero, would need to add some debugging trace etc. Not major, considering fixed.


Chris Houston 15 Aug 2016, 16:18:16

@zpqrtbnk I think this is still an issue in 7.4.3

Here is another forum post that I think is related to the one mentioned above:

https://our.umbraco.org/forum/developers/api-questions/73890-could-not-retrieve-media

We have a client site with thousands of nodes, if our client deletes one of the nodes and it was referenced by a multi-picker ( this can be a content or media node ) they then start to received the above error message in the logs and it has a big detrimental effect on the performance of the site.

I don't remember this ever being an issue before?

It seems that someone has now written an extension for Umbraco to prevent this from happening, but surely this is something that Umbraco should be doing natively? I.e. not allowing an item to be deleted if it is referenced by another node?

https://our.umbraco.org/projects/backoffice-extensions/pund-prevent-used-node-deletion/

My client is a multi-national and they are considering not using Umbraco again due to this effectively crippling their site every time they edit their site, I have assured them this is not normal behaviour as I don't remember this ever happening on a client site before?

Cheers, Chris


Chris Houston 15 Aug 2016, 16:28:34

From what I can see, when a node is deleted it is not immediately an issue. I think the issue occurs when the application is restarted and I think the index is rebuilt (or somehow refreshed?) this is when we then see the errors occurring in the log file and the performance degrades.

Even without this issue, it doesn't seem right that a node can be deleted leaving potentially hundreds of orphaned references behind?

If the client opens a document that references a deleted node and then saves and publishes this document, the references are removed, but this does not happen if you do a top level re-publish, obviously a client with 27k nodes does not want to have to re-edit every single document after they delete a node :)


Stephan 15 Aug 2016, 16:36:41

Quick Q: which error are you seeing exactly, the one mentioned in here (warning about media 'zero') or the one in the Our post (warning about media with ID)?

Warnings about medias not being in the Examine cache... well, I believe we should get rid of them entirely. They may indicate that something is wrong with the cache, but they may also be normal, when trying to get a media that has been deleted. ''=> Looking into it.''

Now, when you say ''it doesn't seem right that a node can be deleted'' - well, that has always been the case with Umbraco: being 'picked' (eg in a media picker or content picker) does not prevent a media or content from being deleted (or unpublished...). When processing / displaying the content of a (multiple) picker, one should always check that the IDs actually correspond to items (ie check for null instead of blindly accepting them). Making sense?


Chris Houston 15 Aug 2016, 23:32:51

Hi, the error is for specific IDs but it's not necessarily media items that are being deleted, in fact I think the majority of nodes I have looked into have all been content nodes, which means the error message is pretty miss leading to say the least.

For us the real issue is not only is this adding a lot of warnings to the log, but it is also having a definite negative impact on the load times of pages.

Happy to show you via a webex if the client gives the ok.


Stephan 16 Aug 2016, 06:40:17

Er... a ''content node''? Meaning, you're seeing this error message but the ID is for the ''content node''? That would be super weird and I sure would love to see a repro.


Priority: Major

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.3.4

Due in version: 7.4.2

Sprint: Sprint 10

Story Points:

Cycle: