Node access table can be left in inconsistent state if node_access_needs_rebuild is not set.

Created on 3 June 2019, almost 6 years ago
Updated 30 January 2023, about 2 years ago

Problem/Motivation

node_access_rebuild() clears the node access table, then rebuilds it. We had an issue were node_access_rebuild() was called during directly during a deploy script, and failed to complete due to a memory exhausted error, leaving the node access table in an inconsistent/incorrect state and causing access denied on most pages.

Since node_access_needs_rebuild was not set to TRUE prior to calling node_access_rebuild(), there was no indication that the node access table was not rebuilt correctly.

While best practice is probably to call node_access_needs_rebuild(TRUE) prior to / instead of calling node_access_rebuild() directly, it makes sense to set node_access_needs_rebuild explicitly once the operation is started. The flag is cleared automatically after successful completion.

Proposed resolution

Once node_access_rebuild() clears the node_access table, force the node_access_needs_rebuild flag to TRUE. This way, if the function fails (long-running/time- and memory-consuming, so not unlikely to happen), it is clear that a rebuild is still required.

Remaining tasks

Review

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Needs work

Version

10.1

Component
Node system 

Last updated about 3 hours ago

No maintainer
Created by

🇧🇪Belgium mr.baileys 🇧🇪 (Ghent)

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024