Bug #9102

Fix rights duplication in arInheritRightsJob

Added by José Raddaoui Marín over 6 years ago. Updated over 6 years ago.

Status:VerifiedStart date:10/27/2015
Priority:HighDue date:
Assignee:Dan Gillean% Done:

0%

Category:Data model / ORM
Target version:Release 2.3.0
Google Code Legacy ID: Tested version:2.3
Sponsored:No Requires documentation:

Description

Currently is only duplicating the selected culture. We also have a copy method in QubitRights that needs to be fixed after the changes included in arMigration0113 and arMigration0134

screenshot_issue_9102_rights.png (16.3 KB) David Juhasz, 11/03/2015 05:47 PM


Related issues

Blocked by Access to Memory (AtoM) - Bug #8784: Schema and models are out of sync Verified 08/06/2015

History

#2 Updated by José Raddaoui Marín over 6 years ago

Also, the duplicated granted rights are being assigned to the original rights instead of to the new one:

https://github.com/artefactual/atom/blob/qa/2.3.x/lib/job/arInheritRightsJob.class.php#L101

#3 Updated by José Raddaoui Marín over 6 years ago

  • Status changed from New to Code Review
  • Assignee changed from José Raddaoui Marín to Mike Gale

Ready for code review: PR 251

#4 Updated by Mike Gale over 6 years ago

  • Assignee changed from Mike Gale to José Raddaoui Marín

looks good to me

#5 Updated by José Raddaoui Marín over 6 years ago

  • Status changed from Code Review to QA/Review
  • Assignee changed from José Raddaoui Marín to Dan Gillean

Merged in qa/2.3.x

#6 Updated by David Juhasz over 6 years ago

  • Status changed from QA/Review to In progress
  • Assignee changed from Dan Gillean to David Juhasz
I can consistently cause the gearman worker to crash by doing the following:
  1. Create a PREMIS right that has no Rights Holder for a description that has children
  2. Click "More > Manage rights inheritance"
  3. Click "Apply" (default inheritance options)

Screenshot of rights:

Result:
  • Browser returns 500 error:
    500 | Internal Server Error | Net_Gearman_Exception
    No Gearman worker available that can handle the job arInheritRightsJob.
  • AtoM worker log shows the following stack trace (Xdebug enabled):
    2015-11-03 13:28:14 > New ability: arGenerateFindingAidJob
    2015-11-03 13:28:14 > New ability: arInheritRightsJob
    2015-11-03 13:28:14 > New ability: arSearchResultExportCsvJob
    2015-11-03 13:28:15 > Ability not defined: qtSwordPluginWorker. Please ensure the job is in the lib/task/job directory or that the plugin is enabled.
    2015-11-03 13:28:15 > Running worker...
    2015-11-03 13:28:15 > PID 4426
    PHP Fatal error:  Call to a member function __get() on a non-object in /home/vagrant/artefactual/atom/lib/model/om/BaseObject.php on line 549
    PHP Stack trace:
    PHP   1. {main}() /home/vagrant/artefactual/atom/symfony:0
    PHP   2. include() /home/vagrant/artefactual/atom/symfony:14
    PHP   3. sfSymfonyCommandApplication->run() /home/vagrant/artefactual/atom/vendor/symfony/lib/command/cli.php:20
    PHP   4. sfTask->runFromCLI() /home/vagrant/artefactual/atom/vendor/symfony/lib/command/sfSymfonyCommandApplication.class.php:76
    PHP   5. sfBaseTask->doRun() /home/vagrant/artefactual/atom/vendor/symfony/lib/task/sfTask.class.php:97
    PHP   6. jobWorkerTask->execute() /home/vagrant/artefactual/atom/vendor/symfony/lib/task/sfBaseTask.class.php:68
    PHP   7. Net_Gearman_Worker->beginWork() /home/vagrant/artefactual/atom/lib/task/jobs/jobWorkerTask.class.php:123
    PHP   8. Net_Gearman_Worker->doWork() /home/vagrant/artefactual/atom/vendor/net_gearman/Net/Gearman/Worker.php:247
    PHP   9. arBaseJob->run() /home/vagrant/artefactual/atom/vendor/net_gearman/Net/Gearman/Worker.php:351
    PHP  10. arInheritRightsJob->runJob() /home/vagrant/artefactual/atom/lib/job/arBaseJob.class.php:62
    PHP  11. QubitRights->copy() /home/vagrant/artefactual/atom/lib/job/arInheritRightsJob.class.php:81
    PHP  12. BaseRights->__set() /home/vagrant/artefactual/atom/lib/job/arInheritRightsJob.class.php:109
    PHP  13. call_user_func_array() /home/vagrant/artefactual/atom/lib/model/om/BaseRights.php:207
    PHP  14. QubitObject->__set() /home/vagrant/artefactual/atom/lib/model/om/BaseRights.php:207
    PHP  15. call_user_func_array() /home/vagrant/artefactual/atom/lib/model/QubitObject.php:93
    PHP  16. BaseObject->__set() /home/vagrant/artefactual/atom/lib/model/QubitObject.php:93
  • Subsequent attempts to start the atom-worker will produce the same error

#7 Updated by David Juhasz over 6 years ago

The problem seems to occur because:
  1. https://github.com/artefactual/atom/blob/qa/2.3.x/lib/model/QubitRights.php#L109 attempts to assign an object to set the foreign key rights_holder_id $newRights->rightsHolder = $this->rightsHolder;
  2. If there is no Rights holder then $this->rightsHolder is null
  3. https://github.com/artefactual/atom/blob/qa/2.3.x/lib/model/om/BaseObject.php#L549 tries to call $value->__get(), but in this case $value == null

#8 Updated by David Juhasz over 6 years ago

Upload screenshot for comment 6

#9 Updated by David Juhasz over 6 years ago

  • Blocked by Bug #8784: Schema and models are out of sync added

#10 Updated by David Juhasz over 6 years ago

I have a fix on https://github.com/artefactual/atom/tree/dev/issue-9102 that may fix this issue, but it is dependent on Radda's fixes for #8784 which is currently waiting for Code Review.

#11 Updated by David Juhasz over 6 years ago

  • Status changed from In progress to Code Review
  • Assignee changed from David Juhasz to Jesús García Crespo

Jesús, can you please code review this?
https://github.com/artefactual/atom/pull/253

#12 Updated by David Juhasz over 6 years ago

  • Status changed from Code Review to QA/Review
  • Assignee changed from Jesús García Crespo to Dan Gillean

Hi Dan. To QA/Review this you can test the PREMIS rights inheritance with the rights statement shown in comment 6 and confirm the job completes without the atom worker crashing.

#13 Updated by Dan Gillean over 6 years ago

  • Status changed from QA/Review to Verified

Repeated steps in note 6 without any issues, first without any digi objects at lower levels, then with some present (mix of local upload and external link). Further tried editing the original right and then redoing inheritance and still had no issues. Marking verified.

#14 Updated by Dan Gillean over 6 years ago

Note: because this fix involved a number of fundamental changes to the ORM code, which could potentially introduce regressions, we have decided at this time NOT to backport this fix to stable/2.2.x, for inclusion in the 2.2.1 release.

Adding some untested, tentative notes from David Juhasz, in case this becomes relevant for user forum support for 2.2 users:

I think the fix for 2.2 would be to change: https://github.com/artefactual/atom/blob/stable/2.2.x/lib/model/QubitRights.php#L109

from:

$newRights->rightsHolder = $this->rightsHolder;

to:

$newRights->rightsHolderId = $this->rightsHolderId;

The bug only happens when trying to pass a null object (e.g. $this->rightsHolder ). There are likely a few other lines that would need to be updated from objects to ids.

Also available in: Atom PDF