Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-9656

When Importing external repositories, the username placed in the logs is not necessarily the user who performed the import

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Low Low
    • 5.0.0
    • 4.13.0
    • None
    • None

      Please consider improving the logs that are written when there is an error importing an external git repository.

      A user recently entered an URL that was unreachable from the Bitbucket Server. There error message in the logs was

      2017-03-15 14:30:31,817 DEBUG \[pool-6-thread-6] USERNAME_X@somedomain.com @1QOQFXAx1185x347398x0 1i21hy1 999.999.999.999,10.20.300.1 "POST /rest/importer/latest/projects/<PROJ_SLUG>/import/repos HTTP/1.1" c.a.bitbucket.scm.BaseCommand Executed /usr/bin/git \-c gc.auto=0 fetch \-\-force \-\-prune \-\-progress http://<USERNAME>@<SOMEURL>/<PATH>/<REPO>.git \+refs/\*:refs/\*\\ com.atlassian.bitbucket.scm.CommandFailedException: '/usr/bin/git \-c gc.auto=0 fetch \-\-force \-\-prune \-\-progress http://<USERNAME>@<SOMEURL>/<PATH>/<REPO>.git \+refs/\*:refs/\*' exited with code 128 saying: fatal: unable to access 'http://<USERNAME>@<SOMEURL>/<PATH>/<REPO>.git/': Could not resolve host: SOMEURL
      

      The Problem is, USERNAME_X was not the person who was performing the import. The import was being performed by USERNAME_A who is in a completely different department.

      Turns out though that USERNAME_X was likely the first person to have performed a completely different import of a completely different external repository several days earlier, and after a Bitbucket server restart.

      Working with support, the response from development was:

      When you're on a thread pool thread (which [pool-6-thread-6] is), you generally can't "trust" the username. Quite often, that username was captured when that pool thread was first created and is never updated after that

      If this is the case, an individual username should have never been attributed to the thread and some internal identifier, or no username at all would be preferable to using an incorrect name

      Please consider improving the information that is written to the logs so that activities are not incorrectly attributed to the wrong user.

            [BSERV-9656] When Importing external repositories, the username placed in the logs is not necessarily the user who performed the import

            Frank Doherty added a comment - - edited

            Since 5.x the mechanism for transferring "state" information (username, request id, action etc) to a background thread has changed, in such a way that old information should not be reused or output to the logs.

            So this issue should no longer apply from 5.x upwards.

            Frank Doherty added a comment - - edited Since 5.x the mechanism for transferring "state" information (username, request id, action etc) to a background thread has changed, in such a way that old information should not be reused or output to the logs. So this issue should no longer apply from 5.x upwards.

              fdoherty@atlassian.com Frank Doherty
              cdrummond Craig Drummond
              Affected customers:
              1 This affects my team
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: