Edgewall Software

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#12960 closed defect (fixed)

Age column displaying "48 years" after upgrading to 1.2.2 + Empty Author, Last change & Log Message — at Version 12

Reported by: dreamzer@… Owned by: Jun Omae
Priority: normal Milestone: 1.0.17
Component: version control/browser Version: 1.2.2
Severity: normal Keywords: svn needinfo
Cc: Branch:
Release Notes:

Add debug-logging when NoSuchChangeset is raised.

API Changes:
Internal Changes:

Description (last modified by anonymous)

Hello,

We recently changed our development server, and upgraded from 0.12.2 to 1.2.2.

But now, for all our files and directories, the "Age" column shows "48 years" (it thinks that the file/directly was last modified on 1970-01-01), the "Author" and the "Last change" column are empty (see attached screenshot). Same for the "Log Message".

The subversion directory didn't change at all.

Change History (16)

by anonymous, 6 years ago

Attachment: Trac after update.jpg added

comment:1 by anonymous, 6 years ago

Description: modified (diff)
Summary: Age column displaying "48 years" after upgrading to 1.2.2 + Empty Author & Last changeAge column displaying "48 years" after upgrading to 1.2.2 + Empty Author, Last change & Log Message

comment:2 by Jun Omae, 6 years ago

Component: generalversion control/browser
Keywords: svn added

Could you please post trac.log in your Trac Environment after enabling TracLogging with DEBUG level and visiting the browser page?

comment:3 by Jun Omae, 6 years ago

Also, please post current and before-upgrading System Information in About page of your Trac.

by anonymous, 6 years ago

Attachment: trac.log added

by anonymous, 6 years ago

by anonymous, 6 years ago

comment:4 by anonymous, 6 years ago

Hello Jun,

Thank you very much for your message and for your help. Please find attached all the things you asked for. Let me know if you need anything else.

Thank you and have a nice day,

comment:5 by Jun Omae, 6 years ago

Thanks for the feedback.

According to the upload files, Subversion 1.9.5 on Ubuntu zesty is used and the following is logged.

2017-12-01 11:43:35,256 Trac[util] WARNING: Unable to get changeset [39468]

It seems that Trac is unable to read revision properties from the repository.

Could you please verify using svnadmin verify command with the repository?

$ sudo -u www-data svnadmin verify /path/to/repos/dreamzer

comment:6 by anonymous, 6 years ago

Hi Jun,

I had already made a svnadmin verify and it went all fine. I've just done it again and it was exactly the same.

comment:7 by Ryan J Ollos, 6 years ago

I would try running resync on the repository (TracAdmin):

$ trac-admin $env repository resync "dreamzer"

where $env is the path to the Trac environment.

$ trac-admin $env help repository resync
repository resync <repos> [rev]

    Re-synchronize trac with repositories

    When [rev] is specified, only that revision is synchronized. Otherwise, the
    complete revision history is synchronized. Note that this operation can
    take a long time to complete. If synchronization gets interrupted, it can
    be resumed later using the `sync` command.

    To synchronize all repositories, specify "*" as the repository.

comment:8 by Jun Omae, 6 years ago

Thinking another possibilities, metadata in repository table might be broken.

Please post result of the following query in your trac.db:

SELECT * FROM repository ORDER BY id, name;

Currently, nothing about the reason is logged when invalid revision is given to get_changeset(). I think it is good to add logging when NoSuchChangeset is raised to investigate such a situation:

Proposed changes for 1.0-stable:

  • trac/versioncontrol/web_ui/util.py

    diff --git a/trac/versioncontrol/web_ui/util.py b/trac/versioncontrol/web_ui/util.py
    index 5eac6c3e1..44573f6e1 100644
    a b def get_changes(repos, revs, log=None):  
    4444            changeset = Changeset(repos, rev, '', '',
    4545                                  datetime(1970, 1, 1, tzinfo=utc))
    4646            if log is not None:
    47                 log.warning("Unable to get changeset [%s]", rev)
     47                log.warning("Unable to get changeset [%s] in %s", rev,
     48                            repos.reponame or '(default)')
    4849        changes[rev] = changeset
    4950    return changes
    5051
  • tracopt/versioncontrol/svn/svn_fs.py

    diff --git a/tracopt/versioncontrol/svn/svn_fs.py b/tracopt/versioncontrol/svn/svn_fs.py
    index 385d39299..6b0ae405a 100644
    a b class SubversionRepository(Repository):  
    431431            return self.youngest_rev
    432432        else:
    433433            try:
    434                 rev = int(rev)
    435                 if 0 <= rev <= self.youngest_rev:
    436                     return rev
    437             except (ValueError, TypeError):
    438                 pass
     434                normrev = int(rev)
     435                if 0 <= normrev <= self.youngest_rev:
     436                    return normrev
     437                else:
     438                    self.log.debug("%r cannot be normalized in %s: out of [0, "
     439                                   "%r]", rev, self.reponame or '(default)',
     440                                   self.youngest_rev)
     441            except (ValueError, TypeError), e:
     442                self.log.debug("%r cannot be normalized in %s: %s", rev,
     443                               self.reponame or '(default)',
     444                               exception_to_unicode(e))
    439445            raise NoSuchChangeset(rev)
    440446
    441447    def close(self):
    class SubversionNode(Node):  
    967973class SubversionChangeset(Changeset):
    968974
    969975    def __init__(self, repos, rev, scope, pool=None):
     976        self.log = repos.log
    970977        self.rev = rev
    971978        self.scope = scope
    972979        self.fs_ptr = repos.fs_ptr
    class SubversionChangeset(Changeset):  
    10931100            yield tuple(change)
    10941101
    10951102    def _get_prop(self, name):
    1096         return fs.revision_prop(self.fs_ptr, self.rev, name, self.pool())
     1103        try:
     1104            return fs.revision_prop(self.fs_ptr, self.rev, name, self.pool())
     1105        except core.SubversionException, e:
     1106            self.log.debug("%r of the %r cannot be retrieved", name, self.rev)
     1107            raise
    10971108
    10981109
    10991110#

After the patch:

>>> env = Environment('/var/trac/1.0-sqlite')
>>> repos = rm.get_repository('trac.svn')
>>> repos.get_changeset(-1)
2017-12-05 12:25:00,654 Trac[svn_fs] DEBUG: -1 cannot be normalized in trac.svn: out of [0, 16103L]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/src/tracdev/git/trac/versioncontrol/cache.py", line 70, in get_changeset
    return CachedChangeset(self, self.normalize_rev(rev), self.env)
  File "/src/tracdev/git/tracopt/versioncontrol/svn/svn_fs.py", line 262, in normalize_rev
    return self.repos.normalize_rev(rev)
  File "/src/tracdev/git/tracopt/versioncontrol/svn/svn_fs.py", line 445, in normalize_rev
    raise NoSuchChangeset(rev)
trac.versioncontrol.api.NoSuchChangeset: No changeset -1 in the repository
>>> repos.get_changeset('aaa')
2017-12-05 12:25:20,160 Trac[svn_fs] DEBUG: 'aaa' cannot be normalized in trac.svn: ValueError: invalid literal for int() with base 10: 'aaa'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/src/tracdev/git/trac/versioncontrol/cache.py", line 70, in get_changeset
    return CachedChangeset(self, self.normalize_rev(rev), self.env)
  File "/src/tracdev/git/tracopt/versioncontrol/svn/svn_fs.py", line 262, in normalize_rev
    return self.repos.normalize_rev(rev)
  File "/src/tracdev/git/tracopt/versioncontrol/svn/svn_fs.py", line 445, in normalize_rev
    raise NoSuchChangeset(rev)
trac.versioncontrol.api.NoSuchChangeset: No changeset aaa in the repository
>>> direct_repos = repos.repos
>>> SubversionChangeset(direct_repos, 999999, direct_repos.pool)
2017-12-05 12:28:10,102 Trac[svn_fs] DEBUG: 'svn:log' of the 999999 cannot be retrieved
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/src/tracdev/git/tracopt/versioncontrol/svn/svn_fs.py", line 984, in __init__
    raise NoSuchChangeset(rev)
trac.versioncontrol.api.NoSuchChangeset: No changeset 999999 in the repository

comment:9 by anonymous, 6 years ago

Hi Jun,

The repository resync worked perfectly well. I couldn't be happier, thank you very much for your help!

Maybe this could be added to the Troubleshooting part of the documentation, in case other people ever have the same problem.

Once again, I'm sending you 1,000 thank you. Have a nice day!

comment:10 by Ryan J Ollos, 6 years ago

Adding the additional logging looks like a good idea.

comment:11 by Jun Omae, 6 years ago

Milestone: 1.0.17
Owner: set to Jun Omae
Status: newassigned

Thanks. I'm going to commit the additional logging.

comment:12 by Jun Omae, 6 years ago

Release Notes: modified (diff)
Resolution: worksforme
Status: assignedclosed

Commtted in [16397] and merged in [16398,16399].

Closing this ticket but feel free to reopen it or create new ticket if anyone can reproduce the issue.

Note: See TracTickets for help on using tickets.