Whenever a user visits a Site that inherits a Site Template, Liferay checks to see if there have been any recent modifications to the Site Template that need to be merged. It does this by examining the modifiedDate or last-merge-time of the Layout on the Site, and comparing it against the modifiedDate of the same Layout on the Site Template.
A problem occurs if the Layout on the Site Template is modified while the merge import is still in progress. This will cause things to be in a state where the modifiedDate of the Site Template's Layout will be before the modifiedDate of the Site's Layout, even though the most recent changes to the Site Template's Layout have not yet been propagated to the Site's Layout. This means that those changes will never be propagated until the Site Template is modified again, because Liferay will falsely believe that the changes do not need to be propagated to to the relative modifiedDate between the Site Template's Layout and the Site's Layout.
Steps to Reproduce
1. Create a site template: "temp1"
2. Add another content page to the template: "testpage"
3. Create 2 sites from the template "temp1": "t1site1" and "t1site2"
4. Place a breakpoint at the beginning of LayoutImportController.importFile(..), and configure it to Suspend on Thread only (instead of Suspend All).
5. Edit "testpage" in the template: add a heading fragment
6. Go to http://localhost:8080/web/t1site1/testpage in another tab and wait for it to stop at the breakpoint
7. Edit "testpage" again in the template, add another heading fragment
8. Go to http://localhost:8080/web/t1site2/testpage in a 3rd tab and skip the debug breakpoint if it stops
9. Let the first breakpoint go and disconnect the debugger.
10. Try to reload both sites several times, and notice that the first one doesn't have the second heading fragment, no matter how many times you reload.
Expected Result: The second heading fragment would appear on http://localhost:8080/web/t1site1/testpage after a few refreshes.
Actual Result: The second heading fragment never appears on http://localhost:8080/web/t1site1/testpage no matter how many times you refresh.