com.atlassian.bitbucket.ServerException: An error occurred while executing an external process: Expected diff header, but found [@@ -4145,9 +4145,9 @@ l5^Mɷ^Ot]

Atlassian JIRA | Thiago Bomfim [Atlassian] | 10 months ago
  1. 0

    h3. Summary {{git diff}} doesn't support CR (^M) as a line ending. This is a Git limitation, and not something related to Bitbucket Server or Stash. This manifests in two ways: * Files which _only_ contain CR line endings show as a single-line diff, but they are processed correctly * Files with _mixed_ line endings (part of the file is LF, or CRLF, and part is CR) show unexpected results _and can fail processing entirely_ When a mixed-ending file fails diffs, it can cause cascading failures in other parts of the system. The most important of these is comment drift, but it can also cause user-visible errors when attempting to view commit or pull request diffs. h3. Expected Results Unexpected CR (^M) line endings in the output _shouldn't_ cause diff processing to fail.. h3. Actual Results One example of a CR (^M) related failure appearing in {{atlassian-bitbucket.log}}: {noformat:title=atlassian-bitbucket.log} 2016-02-13 18:03:51,028 DEBUG [drift:thread-1] c.a.bitbucket.scm.BaseCommand Executed /usr/local/git/bin/git diff -C --color=never -U1 0 --dst-prefix=dst:// --src-prefix=src:// da4a5448b487f62ef520a400f17db84fc82eb1ec 521a0d8597944d79ad88f1c0230da962b37900c0 -- 2016-02-13 18:03:51,035 ERROR [drift:thread-1] c.a.s.i.p.c.d.DriftCommentUpdateProcessor 13108:352@27: Error calculating comment drift (1 attempts). First: 13108:360@14 (004bf1e4586c5ba193847e23d387393dda043d80, cd4936b90d6daab2df118a360c219c0f4bec65ea) -> (004bf1e4586c5ba193847e23d387393dda043d80, 5018f411979ba93ed8bbfa0bd1a8a356b65865b1) Last: 13108:360@14 (004bf1e4586c5ba193847e23d387393dda043d80, bf5df9fbf301c2776715a1bda416909edcee31a7) -> (004bf1e4586c5ba193847e23d387393dda043d80, 7fedf1e8d3a169332891b5b5aea2ed34aa110a99) com.atlassian.bitbucket.ServerException: An error occurred while executing an external process: Expected diff header, but found [@@ -4145,9 +4145,9 @@ l5^Mɷ^Ot] at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:115) ~[na:na] at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.onCancel(GitCommandExitHandler.java:49) ~[na:na] at com.atlassian.bitbucket.scm.BaseCommand.callExitHandler(BaseCommand.java:135) ~[bitbucket-spi-4.1.0.jar:na] at com.atlassian.bitbucket.scm.BaseCommand$CommandFuture.internalGet(BaseCommand.java:251) ~[bitbucket-spi-4.1.0.jar:na] at com.atlassian.bitbucket.scm.BaseCommand$CommandFuture.get(BaseCommand.java:220) ~[bitbucket-spi-4.1.0.jar:na] at com.atlassian.bitbucket.scm.BaseCommand.call(BaseCommand.java:75) ~[bitbucket-spi-4.1.0.jar:na] at com.atlassian.stash.internal.pull.comment.drift.DiffCommentDriftStrategy.calculateDrift(DiffCommentDriftStrategy.java:233) ~[bitbucket-service-impl-4.1.0.jar:na] {noformat} h3. Workaround CR (^M) is not a valid line ending to Git. Files which use CR line endings should be converted to use either LF (Linux, Unix) or CRLF (Windows) line endings. Files which consistently use LF or CRLF endings will diff correctly and parse without issue.

    Atlassian JIRA | 10 months ago | Thiago Bomfim [Atlassian]
    com.atlassian.bitbucket.ServerException: An error occurred while executing an external process: Expected diff header, but found [@@ -4145,9 +4145,9 @@ l5^Mɷ^Ot]
  2. 0

    h3. Summary {{git diff}} doesn't support CR (^M) as a line ending. This is a Git limitation, and not something related to Bitbucket Server or Stash. This manifests in two ways: * Files which _only_ contain CR line endings show as a single-line diff, but they are processed correctly * Files with _mixed_ line endings (part of the file is LF, or CRLF, and part is CR) show unexpected results _and can fail processing entirely_ When a mixed-ending file fails diffs, it can cause cascading failures in other parts of the system. The most important of these is comment drift, but it can also cause user-visible errors when attempting to view commit or pull request diffs. h3. Expected Results Unexpected CR (^M) line endings in the output _shouldn't_ cause diff processing to fail.. h3. Actual Results One example of a CR (^M) related failure appearing in {{atlassian-bitbucket.log}}: {noformat:title=atlassian-bitbucket.log} 2016-02-13 18:03:51,028 DEBUG [drift:thread-1] c.a.bitbucket.scm.BaseCommand Executed /usr/local/git/bin/git diff -C --color=never -U1 0 --dst-prefix=dst:// --src-prefix=src:// da4a5448b487f62ef520a400f17db84fc82eb1ec 521a0d8597944d79ad88f1c0230da962b37900c0 -- 2016-02-13 18:03:51,035 ERROR [drift:thread-1] c.a.s.i.p.c.d.DriftCommentUpdateProcessor 13108:352@27: Error calculating comment drift (1 attempts). First: 13108:360@14 (004bf1e4586c5ba193847e23d387393dda043d80, cd4936b90d6daab2df118a360c219c0f4bec65ea) -> (004bf1e4586c5ba193847e23d387393dda043d80, 5018f411979ba93ed8bbfa0bd1a8a356b65865b1) Last: 13108:360@14 (004bf1e4586c5ba193847e23d387393dda043d80, bf5df9fbf301c2776715a1bda416909edcee31a7) -> (004bf1e4586c5ba193847e23d387393dda043d80, 7fedf1e8d3a169332891b5b5aea2ed34aa110a99) com.atlassian.bitbucket.ServerException: An error occurred while executing an external process: Expected diff header, but found [@@ -4145,9 +4145,9 @@ l5^Mɷ^Ot] at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:115) ~[na:na] at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.onCancel(GitCommandExitHandler.java:49) ~[na:na] at com.atlassian.bitbucket.scm.BaseCommand.callExitHandler(BaseCommand.java:135) ~[bitbucket-spi-4.1.0.jar:na] at com.atlassian.bitbucket.scm.BaseCommand$CommandFuture.internalGet(BaseCommand.java:251) ~[bitbucket-spi-4.1.0.jar:na] at com.atlassian.bitbucket.scm.BaseCommand$CommandFuture.get(BaseCommand.java:220) ~[bitbucket-spi-4.1.0.jar:na] at com.atlassian.bitbucket.scm.BaseCommand.call(BaseCommand.java:75) ~[bitbucket-spi-4.1.0.jar:na] at com.atlassian.stash.internal.pull.comment.drift.DiffCommentDriftStrategy.calculateDrift(DiffCommentDriftStrategy.java:233) ~[bitbucket-service-impl-4.1.0.jar:na] {noformat} h3. Workaround CR (^M) is not a valid line ending to Git. Files which use CR line endings should be converted to use either LF (Linux, Unix) or CRLF (Windows) line endings. Files which consistently use LF or CRLF endings will diff correctly and parse without issue.

    Atlassian JIRA | 10 months ago | Thiago Bomfim [Atlassian]
    com.atlassian.bitbucket.ServerException: An error occurred while executing an external process: Expected diff header, but found [@@ -4145,9 +4145,9 @@ l5^Mɷ^Ot]
  3. 0

    Under some circumstances the Bulk Pull Request re-scope algorithm becomes unresponsive and terminates with a process time-out exception. As a result the number of rows for the specific repository grows in the *pr_rescope_requests* table and no Pull Requests for the repository in question gets updated when pushed to. Even extending time-out to 5 mins makes no difference. The following error can be found in the {{atlassian-bitbucket.log}}: {code}2016-05-03 10:57:56,180 ERROR [pull-request-rescoping:thread-1] c.a.s.i.c.HazelcastBucketedExecutor Attempt 1 of 1 at processing bucket 'pull-request-rescoping@4' for executor 'pull-request-rescoping' failed: com.atlassian.bitbucket.ServerException: An error occurred while executing an external process: process timed out at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:115) ~[na:na] at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.onError(GitCommandExitHandler.java:160) ~[na:na] at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onExit(DefaultCommandExitHandler.java:31) ~[bitbucket-spi-4.5.2.jar:na] at com.atlassian.bitbucket.scm.BaseCommand.callExitHandler(BaseCommand.java:138) ~[bitbucket-spi-4.5.2.jar:na] at com.atlassian.bitbucket.scm.BaseCommand$CommandFuture.internalGet(BaseCommand.java:252) ~[bitbucket-spi-4.5.2.jar:na] at com.atlassian.bitbucket.scm.BaseCommand$CommandFuture.get(BaseCommand.java:221) ~[bitbucket-spi-4.5.2.jar:na] at com.atlassian.bitbucket.scm.BaseCommand.call(BaseCommand.java:75) ~[bitbucket-spi-4.5.2.jar:na] at com.atlassian.stash.internal.scm.git.command.BulkRescopeCommand.call(BulkRescopeCommand.java:99) ~[na:na] at com.atlassian.stash.internal.scm.git.command.BulkRescopeCommand.call(BulkRescopeCommand.java:40) ~[na:na] at com.atlassian.stash.internal.scm.PluginScmService.bulkRescope(PluginScmService.java:173) ~[bitbucket-service-impl-4.5.2.jar:na] at com.atlassian.stash.internal.pull.rescope.DefaultPullRequestRescopeService.determineRescopes(DefaultPullRequestRescopeService.java:172) ~[bitbucket-service-impl-4.5.2.jar:na] at com.atlassian.stash.internal.pull.rescope.DefaultPullRequestRescopeService.rescopeInternal(DefaultPullRequestRescopeService.java:305) ~[bitbucket-service-impl-4.5.2.jar:na] at com.atlassian.stash.internal.pull.rescope.DefaultPullRequestRescopeService.lambda$rescope$0(DefaultPullRequestRescopeService.java:112) ~[bitbucket-service-impl-4.5.2.jar:na] at com.atlassian.stash.internal.pull.rescope.DefaultPullRequestRescopeService$$Lambda$138/1462439340.perform(Unknown Source) ~[na:na] at com.atlassian.stash.internal.user.DefaultEscalatedSecurityContext.call(DefaultEscalatedSecurityContext.java:51) ~[bitbucket-service-impl-4.5.2.jar:na] at com.atlassian.stash.internal.pull.rescope.DefaultPullRequestRescopeService.rescope(DefaultPullRequestRescopeService.java:111) ~[bitbucket-service-impl-4.5.2.jar:na] at com.atlassian.stash.internal.pull.rescope.PullRequestRescopeBucketProcessor.process(PullRequestRescopeBucketProcessor.java:131) ~[bitbucket-service-impl-4.5.2.jar:na] at com.atlassian.stash.internal.concurrent.HazelcastBucketedExecutor$BucketProcessingBootstrapper.run(HazelcastBucketedExecutor.java:125) ~[bitbucket-service-impl-4.5.2.jar:na] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_40] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_40] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_40] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_40] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_40] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40] ... 34 frames trimmed Caused by: com.atlassian.utils.process.ProcessTimeoutException: process timed out at com.atlassian.utils.process.ExternalProcessImpl.wrapUpProcess(ExternalProcessImpl.java:675) ~[atlassian-processutils-1.7.5.jar:na] at com.atlassian.utils.process.ExternalProcessImpl.finish(ExternalProcessImpl.java:161) ~[atlassian-processutils-1.7.5.jar:na] at com.atlassian.bitbucket.scm.BaseCommand$CommandFuture.get(BaseCommand.java:219) ~[bitbucket-spi-4.5.2.jar:na] ... 19 common frames omitted{code}

    Atlassian JIRA | 7 months ago | Charles Olivier [Atlassian]
    com.atlassian.bitbucket.ServerException: An error occurred while executing an external process: process timed out
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.atlassian.bitbucket.ServerException

      An error occurred while executing an external process: Expected diff header, but found [@@ -4145,9 +4145,9 @@ l5^Mɷ^Ot]

      at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.evaluateThrowable()
    2. com.atlassian.bitbucket
      BaseCommand.call
      1. com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:115)[na:na]
      2. com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.onCancel(GitCommandExitHandler.java:49)[na:na]
      3. com.atlassian.bitbucket.scm.BaseCommand.callExitHandler(BaseCommand.java:135)[bitbucket-spi-4.1.0.jar:na]
      4. com.atlassian.bitbucket.scm.BaseCommand$CommandFuture.internalGet(BaseCommand.java:251)[bitbucket-spi-4.1.0.jar:na]
      5. com.atlassian.bitbucket.scm.BaseCommand$CommandFuture.get(BaseCommand.java:220)[bitbucket-spi-4.1.0.jar:na]
      6. com.atlassian.bitbucket.scm.BaseCommand.call(BaseCommand.java:75)[bitbucket-spi-4.1.0.jar:na]
      6 frames
    3. com.atlassian.stash
      DiffCommentDriftStrategy.calculateDrift
      1. com.atlassian.stash.internal.pull.comment.drift.DiffCommentDriftStrategy.calculateDrift(DiffCommentDriftStrategy.java:233)[bitbucket-service-impl-4.1.0.jar:na]
      1 frame