Jump to content


Review creation fails, leaves review in unfinished state

swarm strict enforcement exclusive lock unshelve

  • Please log in to reply
No replies to this topic

#1 jiriklouda

jiriklouda

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 04 May 2016 - 09:41 PM

I've got a setup here for a project where we shelve files with #review tag to create a review and tie it to a job connected through jira with p4dtg. When review gets approved, it can be committed and we got a strict enforcement setup through the swarm trigger.

The first time I encountered this issue was when a developer reported that he cannot commit his approved change.

Submit validation failed – fix problems then use 'p4 submit -c 123455'.
'swarm.strict.enforcement' validation failed: @=123456 - no file(s) at that changelist number.
Error obtaining fstat output for this change (123455) or its associated review (123456); please contact your administrator.

I traced it down to strict enforcement check and essentially the fstat command on change and review returned different outputs. On closer inspection I found out that there are no files under the review id.

> p4 fstat -O1 -T "depotFile, headType, digest" @="123456"
@=123456 - no file(s) at that changelist number.
>


I looked at the json metadata for the review and find out that it has no versions or projects unlike all the other reviews:

> p4 counter -u swarm-review-xxxxxx | egrep "versions|projects"
"projects" : null,
"versions" : null,
>


So I looked what happened in swarm and what I have found in the log was that the review was created based on metadata of another previous review, which already had bad metadata (bug #1) due to swarm jira linkage counter link through a job that was common to both changes/reviews.

So I dug further in the log to find the original changelist and review and what I found was an exception:

2016-05-04T00:00:00-07:00 DEBUG (7): P4 (0000000057a97e8500000000e77ec6b0) start command: unshelve --bypass-exclusive-lock -s 123410 -c 123411
2016-05-04T00:00:01-07:00 ERR (3): exception 'Record\Exception\Exception' with message 'Cannot unshelve review (123411). One or more files are exclusively open. Ensure you have Perforce Server version 2014.2/1073410+ with the filetype.bypasslock configurable enabled.' in /opt/perforce/swarm/module/Reviews/src/Reviews/Model/Review.php:2513
Stack trace:
#0 /opt/perforce/swarm/module/Reviews/src/Reviews/Model/Review.php(392): Reviews\Model\Review->exclusiveOpenCheck(Object(P4\Connection\CommandResult))
#1 /opt/perforce/swarm/module/Reviews/src/Reviews/Listener/Review.php(136): Reviews\Model\Review->updateFromChange(Object(P4\Spec\Change), false)
#2 [internal function]: Reviews\Listener\Review->processReview(Object(Zend\EventManager\Event))
#3 /opt/perforce/swarm/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\EventManager\Event))
#4 /opt/perforce/swarm/library/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('task.review', Object(Zend\EventManager\Event), NULL)
#5 /opt/perforce/swarm/module/Queue/src/Queue/Controller/IndexController.php(179): Zend\EventManager\EventManager->trigger(Object(Zend\EventManager\Event))
#6 /opt/perforce/swarm/library/Zend/Mvc/Controller/AbstractActionController.php(83): Queue\Controller\IndexController->workerAction()
#7 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#8 /opt/perforce/swarm/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#9 /opt/perforce/swarm/library/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#10 /opt/perforce/swarm/library/Zend/Mvc/Controller/AbstractController.php(117): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#11 /opt/perforce/swarm/library/Zend/Mvc/DispatchListener.php(114): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#12 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#13 /opt/perforce/swarm/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#14 /opt/perforce/swarm/library/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#15 /opt/perforce/swarm/library/Zend/Mvc/Application.php(309): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#16 /opt/perforce/swarm/public/index.php(57): Zend\Mvc\Application->run()
#17 {main}

It turns out that the shelved files in the changelist contain a .exe file with an exclusive lock on it.

> p4 fstat -O1 -T "depotFile, headType, digest" @="123455"
... depotFile //depot/dir/file.exe
... headType binary+lx

... depotFile //depot/dir/file.cpp
... headType ktext

>


Either way, it seems like there is a configuration option called filetype.bypasslock that needs to be set to 1 to workaround this issue. But if it is not, everything just silently fails with exception in the log, but nothing else. I would assume that if someone put in the option into unshelve to --bypass-exclusive-lock, they would also error check the command to do something sensible when it fails, not just leave malformed review around for everyone to guess at what could have possibly happened (bug #2).

I hope this forum article has enough searchable keywords to save somebody couple hours of their life :)

-Jiri



Also tagged with one or more of these keywords: swarm, strict enforcement, exclusive lock, unshelve

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users