Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicates NEO blocks when saving "Homepage" section #156

Closed
Osze opened this issue Nov 13, 2018 · 17 comments
Closed

Duplicates NEO blocks when saving "Homepage" section #156

Osze opened this issue Nov 13, 2018 · 17 comments
Assignees

Comments

@Osze
Copy link

Osze commented Nov 13, 2018

My NEO block in the entry "Homepage" gets duplicated 9! times when saving the section - "Homepage" (single)

I've made a short video explaining.

https://youtu.be/lcW89xrKjwU

@Osze
Copy link
Author

Osze commented Nov 13, 2018

Created another Single Section "Test" and same issue. Happens only to NEO Blocks.

@ttempleton
Copy link
Contributor

Hi @Osze,

There were duplicating block issues (actually extra block structures mistakenly being created) but they should have been resolved in v2.0.1... I've repeated the process as shown in your video and have as yet been unable to reproduce this. I'll try to look through the plugin code and find any places that fields/blocks could possibly be updated and saved without the block structure also being updated and saved. In the meantime, can I ask, since you've reported the issue with single entries; are you also experiencing this with channel or structure entries, or are they working normally?

@Osze
Copy link
Author

Osze commented Nov 15, 2018

Hi ttempleton,

I only get the issue on singles.
Both Craft and NEO are using the latest version.

If it helps I can give you access to the system. My name is Oscar Carlsson in the Craft Slack channel. Or add me on skype - oscar_carlsson84

Regards
Oscar

@ttempleton
Copy link
Contributor

The offer is much appreciated; for the time being I'm going to see if there's any setting or combination of settings that could cause this, but if I come up empty then I'll be in touch.

@Osze
Copy link
Author

Osze commented Nov 15, 2018

I've been trying to find a pattern or something to understand the bug better. But without luck.

For example:
I created a new Single.
Added my NEO Block to it and saved some content.
Went back to the Single and saved it.

It all looked as it should.

Clear:ed my cache and re-saved the Single Section again. Then the duplicated neo blocked appeard.

hm...

@i-hardy
Copy link

i-hardy commented Nov 16, 2018

I'm seeing this too, latest version of Neo and Craft 3.0.30. Every block in the page is duplicated and I can't actually open it in the CP.

ETA: I managed to fix it by deleting a number of duplicated rows that had been created in the craft_structures table, don't know if this is helpful at all in tracking down the problem.

@Osze
Copy link
Author

Osze commented Nov 18, 2018

@ttempleton did you have time to look at this issue?

I'm hopefully launching the new site tomorrow and would feel much better if this was solved :)

@ttempleton
Copy link
Contributor

Sorry for the delay @Osze and @i-hardy. We've just released v2.0.2 which includes a clean-up of duplicated block structures. If you update Neo and then re-save the affected sections, the appearance of duplicated blocks should be gone. Can both of you please confirm whether this has resolved the situation for you?

@Osze
Copy link
Author

Osze commented Nov 19, 2018

Hi Ttempleton,

I've upgraded NEO to v.2.0.2.

but re-savning my "Hompage" single section doesn't work at all now. Loading trying to Re-save entries, then throws me this error:

PDOException: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction in /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/db/Command.php:1258 Stack trace: #0 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/db/Command.php(1258): PDOStatement->execute() #1 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/db/Command.php(1075): yii\db\Command->internalExecute('UPDATEcraft_e...')
#2 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/db/ActiveRecord.php(281): yii\db\Command->execute()
#3 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/db/BaseActiveRecord.php(802): yii\db\ActiveRecord::updateAll(Array, Array)
#4 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/db/ActiveRecord.php(625): yii\db\BaseActiveRecord->updateInternal(NULL)
#5 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/db/BaseActiveRecord.php(673): yii\db\ActiveRecord->update(false, NULL)
#6 /srv/users/craft/apps/mybetting-in/craft/vendor/craftcms/cms/src/services/Elements.php(438): yii\db\BaseActiveRecord->save(false)
#7 /srv/users/craft/apps/mybetting-in/craft/vendor/craftcms/cms/src/services/Sections.php(1290): craft\services\Elements->saveElement(Object(craft\elements\Entry))
#8 /srv/users/craft/apps/mybetting-in/craft/vendor/craftcms/cms/src/services/Sections.php(635): craft\services\Sections->_onSaveSingle(Object(craft\models\Section), false, Array)
#9 /srv/users/craft/apps/mybetting-in/craft/vendor/craftcms/cms/src/controllers/SectionsController.php(186): craft\services\Sections->saveSection(Object(craft\models\Section))
#10 [internal function]: craft\controllers\SectionsController->actionSaveSection()
#11 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#12 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#13 /srv/users/craft/apps/mybetting-in/craft/vendor/craftcms/cms/src/web/Controller.php(104): yii\base\Controller->runAction('save-section', Array)
#14 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-section', Array)
#15 /srv/users/craft/apps/mybetting-in/craft/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module->runAction('sections/save-s...', Array)
#16 /srv/users/craft/apps/mybetting-in/craft/vendor/craftcms/cms/src/web/Application.php(542): craft\web\Application->runAction('sections/save-s...', Array)
#17 /srv/users/craft/apps/mybetting-in/craft/vendor/craftcms/cms/src/web/Application.php(266): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#18 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#19 /srv/users/craft/apps/mybetting-in/public/index.php(21): yii\base\Application->run()
#20 {main}

Next yii\db\Exception: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction
The SQL being executed was: UPDATE craft_elements SET fieldLayoutId=3128, enabled=1, archived=0, dateUpdated='2018-11-19 08:45:20' WHERE id=2 in /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/db/Schema.php:664
Stack trace:
#0 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/db/Command.php(1263): yii\db\Schema->convertException(Object(PDOException), 'UPDATE craft_e...') #1 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/db/Command.php(1075): yii\db\Command->internalExecute('UPDATE craft_e...')
#2 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/db/ActiveRecord.php(281): yii\db\Command->execute()
#3 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/db/BaseActiveRecord.php(802): yii\db\ActiveRecord::updateAll(Array, Array)
#4 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/db/ActiveRecord.php(625): yii\db\BaseActiveRecord->updateInternal(NULL)
#5 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/db/BaseActiveRecord.php(673): yii\db\ActiveRecord->update(false, NULL)
#6 /srv/users/craft/apps/mybetting-in/craft/vendor/craftcms/cms/src/services/Elements.php(438): yii\db\BaseActiveRecord->save(false)
#7 /srv/users/craft/apps/mybetting-in/craft/vendor/craftcms/cms/src/services/Sections.php(1290): craft\services\Elements->saveElement(Object(craft\elements\Entry))
#8 /srv/users/craft/apps/mybetting-in/craft/vendor/craftcms/cms/src/services/Sections.php(635): craft\services\Sections->_onSaveSingle(Object(craft\models\Section), false, Array)
#9 /srv/users/craft/apps/mybetting-in/craft/vendor/craftcms/cms/src/controllers/SectionsController.php(186): craft\services\Sections->saveSection(Object(craft\models\Section))
#10 [internal function]: craft\controllers\SectionsController->actionSaveSection()
#11 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#12 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#13 /srv/users/craft/apps/mybetting-in/craft/vendor/craftcms/cms/src/web/Controller.php(104): yii\base\Controller->runAction('save-section', Array)
#14 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-section', Array)
#15 /srv/users/craft/apps/mybetting-in/craft/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module->runAction('sections/save-s...', Array)
#16 /srv/users/craft/apps/mybetting-in/craft/vendor/craftcms/cms/src/web/Application.php(542): craft\web\Application->runAction('sections/save-s...', Array)
#17 /srv/users/craft/apps/mybetting-in/craft/vendor/craftcms/cms/src/web/Application.php(266): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#18 /srv/users/craft/apps/mybetting-in/craft/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#19 /srv/users/craft/apps/mybetting-in/public/index.php(21): yii\base\Application->run()
#20 {main}
Additional Information:
Array
(
[0] => HY000
[1] => 1205
[2] => Lock wait timeout exceeded; try restarting transaction
)

Copy Stacktrace Search Stackoverflow Search Google Exception
Database Exception – yii\db\Exception
SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction
The SQL being executed was: UPDATE craft_elements SET fieldLayoutId=3128, enabled=1, archived=0, dateUpdated='2018-11-19 08:45:20' WHERE id=2
Error Info: Array
(
[0] => HY000
[1] => 1205
[2] => Lock wait timeout exceeded; try restarting transaction
)`

@ttempleton
Copy link
Contributor

That is strange; in my testing I completely removed the deletion of old block structures and re-saved until I was seeing 36 of one block, then added the cleanup mechanism and it worked fine.

Does the error still occur if you re-save the homepage entry directly? (you should not need to delete any of the duplicated blocks for this)

@Osze
Copy link
Author

Osze commented Nov 19, 2018

Yeah, same issue when saving the entry directly.

Tried it on 2 different craft installations and same problem. Endless loading until General error: 1205 Lock wait timeout exceeded;.

@ttempleton
Copy link
Contributor

I've just been testing on a few Craft installations across a couple of machines and didn't run into any errors. Were your Craft installations on the same machine and do they have the same plugins installed? I'm starting to wonder in particular if there's some conflict with another plugin, given that my tests have admittedly been on Craft installations that have been light on plugins. If possible, could you please test with a totally clean Craft install, no plugins installed except Neo, and let me know if you still get the error?

@Osze
Copy link
Author

Osze commented Nov 20, 2018

I have two installations with the same setup and same plugins.

On both the mysql locks the table when saving the Hompage section and sometimes the Homepage entry:

SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction
The SQL being executed was: UPDATE craft_elements SET fieldLayoutId=3128, enabled=1, archived=0, dateUpdated='2018-11-20 02:54:41' WHERE id=2

I've tried to get Craft support helping me without any success.

I have another installation that is almost the same, but not updated to the latest NEO 2.0.2.
On that site the Homepage entry and Homepage section is able to save. No locking problems.
...but then the neo blocks get duplicated (earlier issue) when saving the section instead.

This really starts to get annoying.

I'm running a m5.large on Amazon configured by Serverpilot, so the system is definitely good enough.

@Osze
Copy link
Author

Osze commented Nov 20, 2018

  • Using MySQL 5.7.24 on the system where I get lock wait timeout.
  • MySQL 5.5.62 on the system where neo blocks get duplicated. Don't dare to update to NEO 2.0.2 because of the locking issue on the other server.

@ttempleton
Copy link
Contributor

Can you try a clean Craft installation with Neo as the only plugin installed and see if you still get the error? Or alternatively can you please let me know what other plugins you're using? We've done further testing without any problems -- whether SQL errors or block duplicating -- which makes me wonder whether Neo is somehow conflicting with another plugin.

@Osze
Copy link
Author

Osze commented Nov 20, 2018

Hi ttempleton, you are right. I don't think it is a NEO issue anymore.

I think it might have something with Blitz Cache. Just typically that Blitz also made an update at the same time you fixed #1 bug in NEO.
Sorry for taking your time on this!

@ttempleton
Copy link
Contributor

No worries @Osze -- if it's a Blitz Cache issue, hopefully that gets sorted out soon.

I'll close this issue now, but if it does still turn out that Neo is involved, let us know and we'll reopen; and @i-hardy if you continue to experience issues with Neo after updating to v2.0.2, let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants