When I clear cache, especially on high traffic times, my menu seems to go out of ordering. Usually I don't see any log messages except for one time:

Message Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction: INSERT INTO {cache_render}

That time my ram and CPU also spiked. What I mean about go out of ordering is this:

Image of code

The ul.menu-level-1 is suppose to be inside the div.container, but for some reason, when I clear cache, sometimes it's rendered outside the div.container.

I am using the menu items extra module module. It does not have an issue related to this. My network team is pretty adamant that the resources I have are sufficient and i hover about 30%-40% utilization normally for my ram and cpu. The web and database nodes are separate.

I am self-hosted and have cloudflare in front of my website. I do not have caching in cloudflare turned on. Does anyone have any suggestions on what this could be. It normally only happens on my production site - of course - but it's happened on my test sites in the past as well. That's why I don't think its cloudflare.

  • Also, the fix to get my menu to go back to normal, ironically is to clear cache one or more times. Commented Mar 31, 2020 at 4:44
  • Rendered outside div.container often means incorrect markup, like a stray or surplus div tag. Have you checked the real rendered markup? (In the page source [using CTRL + U in Chrome], not beautified version in developer console)
    – Hudri
    Commented Mar 31, 2020 at 5:46
  • I think I have and its still renders outside. If there were a stray div, wouldn't it break ever time? Commented Mar 31, 2020 at 6:08

1 Answer 1


I believe this had something to do with mysql's setting max_allowed_packet. Mine was only set to 1MB, when drupal recommended 16mb.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.