Closed (fixed)
Project:
Party
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Feb 2013 at 20:37 UTC
Updated:
25 Feb 2013 at 13:50 UTC
Jump to comment: Most recent file
On Party Dashboard - Edit Subscription fails with PDO exception on first try - second try all is fine.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 1907744-2-prevent_recusive_errors_in_data_controller_save.patch | 5.61 KB | andrewbelcher |
Comments
Comment #1
rlmumfordThis is still a bug and is on one of our clients so bumping to major.
It is trying to add the Subscriber to the party_attached_enitity twice. What I expect is happening is that the first time this modal is opened when no subscriber entity is available the following happens.
$controller->getEntityByEmail('email') Creates a new simplenews subscriber.
$controller->save() loops over all the simplenews subscribers (in this case there is only one).
$controller->save() calls entity_save on the subscriber, inserting the simplenews subscriber into the database
party_simplenews_simplenews_subscriber_insert() finds a party and attaches it
$controller->save() then tries to attach it again.
I'm not sure what the right way of avoiding this kind of scenario is.
Comment #2
andrewbelcher commentedOk, so the issue is recursiveness in
PartyDefaultDataSet::save().The attached patch fixed that by introducing a lock on the delicate bits of the method, allowing recursive calls to happen without conflicts in data or PDO exceptions. It also means we can be better from a performance POV as we only write to the DB once. Along with that, I've update the call to
setLabel()to only store if we have a lock.This information is also passed onto the
preSave()andpostSave()methods so overloading classes can also implement this properly.Comment #3
rlmumfordI reviewed this fairly extensively with andrewbelcher before the patch came on here. So I'm happy to commit this now.