Race condition for first rendering of Connect macros in new/fabric pages

We found a race condition for rendering Connect app/macros and have reported it using DEVHELP-4659 but I’d like to post it here too so that other Connect app developers are aware of the problem:

We and our customers are seeing errors for the very first rendering of a new/fabric page containing a Connect macro that takes significant time to render.

We are not seeing the problem with pages that were created with the old page editor.

We see 2 different errors when rendering the page for the very first time (for example, after copying the page to a new space using the “copy page hierarchy” (cph) API).

  • The macro fails to render and, instead renders an error message:
    Error: RuntimeException occurred while performing an XHTML storage transformation (Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; nested exception is org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1)
    • the error does not go away until the page is edited/changed and published, so in addition to the race condition causing an error, the error is being cached and is hard to refresh
  • The other failure mode seen (randomly) is that the macro fails to render, instead rendering an error message: “Failed to get macro details”
    • this error goes away if you navigate away from and then back to the page, so it does not appear to be cached.

Which error you get is not predictable. Also, the error does not always happen. It seems that the longer the macro takes to render the more likely the errors are.

3 Likes