#7005 allura.tasks.repo_tasks.clone clobbers Project record

v1.1.0
closed
sf-2 (995)
General
2015-08-20
2013-12-18
No

It appears that the allura.tasks.repo_tasks.clone task flushes the Project record at the end, and since that task can take a very long time, any updates (e.g. to project description) get lost when it saves the old project document back to mongo.

I haven't duplicated this in development, but here's what happened on sourceforge:

I didn't find any other tasks with the specific project_id that completed after 06:07:16, so I believe it's the repo clone task at fault.

Related

Tickets: #7103

Discussion

  • Dave Brondsema

    Dave Brondsema - 2014-01-06
    • Size: --> 2
     
  • Cory Johns

    Cory Johns - 2014-01-07
    • status: open --> in-progress
    • assigned_to: Cory Johns
     
  • Cory Johns

    Cory Johns - 2014-01-08
    • status: in-progress --> code-review
     
  • Cory Johns

    Cory Johns - 2014-01-08

    allura:cj/7005
    forgehg:cj/7005

    I tried and failed to come up with a way to create a test case for this; since the tests use MIM, there's no way to do an "out-of-band" update to ensure it doesn't get overwritten.

    To QA:

    Add a breakpoint to, e.g., forgegit.model.git_repo.GitImplementation.clone_from then start a clone of a repo (or just clone a large repo w/o a breakpoint). While it's processing, update something on the project metadata, such as the summary.

    May want to try with the breakpoint in a few different points in the code (start of the task, clone_from, repo_refresh, end of task).

     
  • Tim Van Steenburgh

    • QA: Tim Van Steenburgh
     
  • Tim Van Steenburgh

    • status: code-review --> in-progress
     
  • Tim Van Steenburgh

    Lots of failures like this:

    ======================================================================
    ERROR: test_refresh_commit (forgegit.tests.test_tasks.TestGitTasks)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/tvansteenburgh/tvansteenburgh-1024/forge/ForgeGit/forgegit/tests/test_tasks.py", line 47, in test_refresh_commit
        repo_tasks.refresh()
      File "/home/tvansteenburgh/tvansteenburgh-1024/forge/Allura/allura/tasks/repo_tasks.py", line 77, in refresh
        c.app.repo.refresh()
      File "/home/tvansteenburgh/tvansteenburgh-1024/forge/Allura/allura/model/repository.py", line 579, in refresh
        self.set_status('ready')
      File "/home/tvansteenburgh/tvansteenburgh-1024/forge/Allura/allura/model/repository.py", line 622, in set_status
        session(c.project).flush(c.project)
    AttributeError: 'NoneType' object has no attribute 'flush'
    
     
  • Cory Johns

    Cory Johns - 2014-01-10

    Rebased and force-pushed to:
    allura:cj/7005

     
  • Cory Johns

    Cory Johns - 2014-01-10
    • status: in-progress --> code-review
     
  • Tim Van Steenburgh

    • status: code-review --> closed