Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Loss of bloqs data in field when saving

Status Resolved
Add-on / Version Bloqs 5.0.12
Severity
EE Version 7.3.15 & 7.4.2

Eric Harth

Feb 28, 2024

Description of the problem

When saving an entry with a bloqs field, if a parallel save request is issued the entry can lose all bloqs, lose some bloqs, have additional bloqs created (normally observed as duplication of all bloqs without children get a copy adjacent to themselves).

It has been reported by editors that this is happening. The most reliable way we’ve found to replicate this is to click the save, save & close or save & new buttons while it is still saving. This will send an additional save page request before the initial one has finished. It looks like these buttons /should/ be disabled after the first click, but they don’t appear to be. The system takes about 9-15 seconds to save an entry due to its size and age, giving a large window of opportunity for something to be done.

When questioned, the editors claim to not recall multiple clicking on the save, so we are unsure of how they are causing this issue. We’re not sure if there are other ways this bug can be triggered through other interruptions.

We’ve tried to replicate this issue in a clean system, but suspect due to the speed of the system it is very hard to find that window of error opportunity.

What we’ve seen in the code

When looking through the bloq saving code it looks like early in the save process it retrieves all the existing bloqs from the DB as some sort of reference. Shortly after that as it starts to process the new bloqs it then removes all of the existing DB rows for that entry’s bloqs (see note). The suspicion is that if a second request comes in after the DB has been emptied and before the new bloqs have been inserted that it gets an empty set of bloqs and this combined with two sets of saving happening simultaneously is causing the variety of incorrect outcomes.

** Note ** Due to there being a short period where all bloqs are removed, it has been noticed that if that coincides with a front end refresh, the page content will be blank. This is of particular concern when we’re using Speedy for caching, as it’ll cache an empty page.

Environment Details: - PHP Version 8.2 - MySQL Version 8 - OS: Linux - Web Server: Apache

We’ve tested this with and without Publisher installed and the result is the same.

Also, we noticed that with revisions turned on, if an entry gets corrupted the most recently saved revision, with the last set of updates, is successfully saved and can be restored.

#1

BoldMinded (Brian)

The way you describe Bloqs saving is correct it, but only if Publisher is installed. Do you have the latest version of Publisher?

I could add some JS to prevent double clicking the save buttons, but that should be native EE behavior.

#2

BoldMinded (Brian)

Closing due to inactivity.

#3

Eric Harth

Hi Brian

Some additional JS would be helpful, I did think it was meant to prevent this by default but it appears it can still be clicked again. We’ve also seen that occasionally editors will get a browser ‘Network interrupted’ error, likely not due to the addon, but the normal action they take is to hit refresh which will trigger a parallel save even if the initial hasn’t finished. Some way of blocking a simultaneous save from occurring would be good.

Thanks Eric

#4

Eric Harth

Additional note, your support forum doesn’t seem to take notice of the notification email address when it is given against a ticket, and notifications always just go to the account email address.

#5

BoldMinded (Brian)

I’ll take a look at preventing double clicks and see if it differs from EE’s functionality at all, but it’s going to be some time before I can look into it.

#6

BoldMinded (Brian)

Add this to the top of the cp.js file in the Bloqs theme directory and see if it helps.

;jQuery(function ($) {

    if ('publisher' in EE) {
        $('.form-standard > form:first-child').find('[name=submit"]').bind('click', function (e) {
            $(this).css('pointer-events', 'none');
        });
    }

   // ... rest of the file
#7

BoldMinded (Brian)

There is a typo in there, should be

if ('publisher' in EE) {
        $('.form-standard > form:first-child').find('[name="submit"]').bind('click', function (e) {
            $(this).css('pointer-events', 'none');
        });
    }
#8

BoldMinded (Brian)

I’m going to close this out. I’ve added that code to the next release of Bloqs and it seems to prevent double clicks for me so we’ll see how that goes for others.

Login to reply