Edgewall Software
Modify

Opened 7 years ago

Closed 7 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

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.

Attachments (5)

Trac after update.jpg (237.9 KB ) - added by anonymous 7 years ago.
trac.log (56.1 KB ) - added by anonymous 7 years ago.
About Trac – Before update.htm (5.3 KB ) - added by anonymous 7 years ago.
About Trac – After update.htm (33.9 KB ) - added by anonymous 7 years ago.
trac-svn-hook (8.0 KB ) - added by anonymous 6 years ago.

Download all attachments as: .zip

Change History (28)

by anonymous, 7 years ago

Attachment: Trac after update.jpg added

comment:1 by anonymous, 7 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, 7 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, 7 years ago

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

by anonymous, 7 years ago

Attachment: trac.log added

by anonymous, 7 years ago

by anonymous, 7 years ago

comment:4 by anonymous, 7 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, 7 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, 7 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, 7 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, 7 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, 7 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, 7 years ago

Adding the additional logging looks like a good idea.

comment:11 by Jun Omae, 7 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, 7 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.

comment:13 by Ryan J Ollos, 7 years ago

OSX test failures on Travis CI. Surely unrelated to r16397, but first seen with the associated test run:

...
1.63s$ rvm get head
Downloading https://get.rvm.io
Downloading https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer.asc
Verifying /Users/travis/.rvm/archives/rvm-installer.asc
gpg: Signature made Sat Sep  9 19:49:18 2017 GMT
gpg:                using RSA key E206C29FBF04FF17
gpg: Can't check signature: No public key
Warning, RVM 1.26.0 introduces signed releases and automated check of signatures when GPG software found.
Assuming you trust Michal Papis import the mpapis public key (downloading the signatures).
GPG signature verification failed for '/Users/travis/.rvm/archives/rvm-installer' - 'https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer.asc'!
try downloading the signatures:
    gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
or if it fails:
    command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
the key can be compared with:
    https://rvm.io/mpapis.asc
    https://keybase.io/mpapis
/Users/travis/.rvm/scripts/functions/cli: line 243: return: _ret: numeric argument required
The command "rvm get head" failed and exited with 255 during .
Your build has been stopped.
/Users/travis/.travis/job_stages: line 166: shell_session_update: command not found
Last edited 7 years ago by Ryan J Ollos (previous) (diff)

in reply to:  13 ; comment:14 by Jun Omae, 7 years ago

Replying to Ryan J Ollos:

OSX test failures on Travis CI. Surely unrelated to r16397, but first seen with the associated test run:

In [16400], removed rvm get head for workaround to prevent shell_session_update error. Currently, it seems the command is not needed.

comment:15 by anonymous, 7 years ago

Hello Jun,

I'm sorry to reopen this quite late, I was working on something else these last months.

The repository resync worked perfectly well. Yet, whenever I successfully make a commit (there is no error message & I can see a new file was created in the /revs subdirectory), it won't show up in the "Browse sources" and "Timeline". They remain stuck to the last revision dating back to the repository resync.

In other words, whenever I make a commit, I need to launch a repository resync to make it appear in "Browse sources" and "Timeline". Which is obviously very time consuming.

Do you know how to avoid this?

Thank you for your valuable help, and have a nice day!

comment:16 by anonymous, 7 years ago

Resolution: worksforme
Status: closedreopened

in reply to:  15 comment:17 by Jun Omae, 7 years ago

Replying to anonymous:

The repository resync worked perfectly well. Yet, whenever I successfully make a commit (there is no error message & I can see a new file was created in the /revs subdirectory), it won't show up in the "Browse sources" and "Timeline". They remain stuck to the last revision dating back to the repository resync.

In other words, whenever I make a commit, I need to launch a repository resync to make it appear in "Browse sources" and "Timeline". Which is obviously very time consuming.

Do you know how to avoid this?

If you're using explicit synchronization, it doesn't seem that trac-admin $ENV changeset added REPONAME REV works. Please check your post-commit hook in the repository.

If you're using per-request synchronization, it seems upgrade steps from 0.12 to 1.2 break the settings. Please post [repositories] section in your trac.ini and repository table in your trac.db.

comment:18 by Jun Omae, 7 years ago

Keywords: needinfo added

in reply to:  14 comment:19 by Ryan J Ollos, 7 years ago

Replying to Jun Omae:

In [16400], removed rvm get head for workaround to prevent shell_session_update error. Currently, it seems the command is not needed.

The final line of output from OSX builds is:

/Users/travis/.travis/job_stages: line 166: shell_session_update: command not found

But it seems to be harmless.

comment:20 by Ryan J Ollos, 7 years ago

Resolution: fixed
Status: reopenedclosed

Closing since there has been no reply for 2 months.

comment:21 by Jun Omae, 7 years ago

Replaced except E, e with except E as e in [16608-16609] on 1.2-stable and trunk.

by anonymous, 6 years ago

Attachment: trac-svn-hook added

comment:23 by anonymous, 6 years ago

Replying to Jun Omae:

Hello Jun,

Thank you for your message, and sorry for the late reply.

I use explicit synchronization indeed, but I don't think I made many specific changes in the hook script. You can find it attached.

Also, this is the way it's called:

rev=`svn info ./ -r 'HEAD' | grep "Last Changed Rev" | cut -d : -f2 | cut -c2-`
/home/scripts/trac-svn-hook /home/www/trac/dreamzer $rev

Please tell me if you notice something wrong!

Thank you for your help and have a nice day.

Last edited 6 years ago by Jun Omae (previous) (diff)

in reply to:  23 comment:24 by Jun Omae, 6 years ago

Replying to anonymous:

I use explicit synchronization indeed, but I don't think I made many specific changes in the hook script. You can find it attached.

You must invoke trac-admin $ENV sync '*' after putting the post-commit and post-revprop-change hooks.

Also, this is the way it's called:

rev=`svn info ./ -r 'HEAD' | grep "Last Changed Rev" | cut -d : -f2 | cut -c2-`
/home/scripts/trac-svn-hook /home/www/trac/dreamzer $rev

No need to invoke manually trac-svn-hook script. Also, /home/www/trac/dreamzer as first argument should be path of Subversion repository, not path of Trac environment.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.