The problem

  • Say, you have a node which can be translated to Eng (default language) and Fre.
  • I could not reproduce the exact steps, but sometimes, the node_field_data ends up in such a state that ContentEntityStorageBase::getLatestTranslationAffectedRevisionId($entity_id, $langcode) returns an empty value
  • As a result of this, ModerationInformation::hasPendingRevision() cannot load the $latest_revision.
  • Since $latest_revision cannot be loaded, it then ends up calling $latest_revision->wasDefaultRevision on NULL; This results in a WSOD when editors try to edit the node in the language which has node_field_data.revision_translation_affected = NULL.

Question 1

So, my question is, possible to have the node_field_data table in the following state:

+-----+------+---------+----------+--------+-----------------------------------+-----+------------+------------+------------------+
| nid | vid  | type    | langcode | status | title                             | uid | created    | changed    | default_langcode |
+-----+------+---------+----------+--------+-----------------------------------+-----+------------+------------+------------------+
| 781 | 4432 | article | en       |      1 | Différé EN29 janvier              |   0 | 1548799632 | 1549314390 |                0 |
| 781 | 4432 | article | fr       |      1 | Différé FR 29 janvier - Revised   |   0 | 1548799632 | 1549472245 |                1 |
+-----+------+---------+----------+--------+-----------------------------------+-----+------------+------------+------------------+

Question 2

If the above state of the tables is normal, then it is also normal for ContentEntityStorageBase::getLatestTranslationAffectedRevisionId() to return an empty value. In that case, I'd like to propose the patch I'll be posting in comment 1.

CommentFileSizeAuthor
#2 3031142-01-check-before-load.patch1.09 KBjigarius

Comments

jigarius created an issue. See original summary.

jigarius’s picture

Status: Active » Needs review
StatusFileSize
new1.09 KB

Here's the patch which validates latest revision id before trying to load the latest revision. So, when latest revision id is empty, we don't attempt to load the latest revision, even though $latest_revision_id != $default_revision_id might turn out to be TRUE.

Marking as Needs Review so that we can determine if all that I said makes sense.

sam152’s picture

Issue summary: View changes
sam152’s picture

This sounds like the same problem as the related issue I'm adding.

sam152’s picture

Unfortunately the other issue doesn't have steps to reproduce either, so this is tricky to write tests for.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

maximpodorov’s picture

Possible source (for some cases) of this problem: #3025709: "Create new revision" option is ignored when updating EntityReferenceRevisionsItem
Another source is incorrect manual creation of revisions.

grimreaper’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#3001299: Error Loading Language Not Translated For Current Revision

Closing as a duplication because a not null condition has been added by #3001299: Error Loading Language Not Translated For Current Revision.