Page MenuHomePhabricator

Exception on arc diff with PHPCS linter
Closed, ResolvedPublic

Description

When using arc diff command on the SVN repository, then revision is created, but following exception happens:

Running unit tests...
No unit test engine is configured for this project.



    You have not specified any reviewers. Continue anyway? [y/N] y

 SKIP STAGING  Phabricator does not support staging areas for this repository.
[2015-08-12 11:44:21] EXCEPTION: (ConduitClientException) ERR-CONDUIT-CORE: Missing required parameters: name at [<phutil>/src/conduit/ConduitFuture.php:58]
arcanist(head=master, ref.master=5ed1aa876bec), phutil(head=master, ref.master=8ceb827cc0b3)
  #0 <#2> ConduitFuture::didReceiveResult(array) called at [<phutil>/src/future/FutureProxy.php:58]
  #1 <#2> FutureProxy::getResult() called at [<phutil>/src/future/FutureProxy.php:35]
  #2 <#2> FutureProxy::resolve() called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:2825]
  #3 phlog(ConduitClientException) called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:2831]
  #4 ArcanistDiffWorkflow::updateAutotargets(string, NULL) called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:535]
  #5 ArcanistDiffWorkflow::run() called at [<arcanist>/scripts/arcanist.php:382]
Created a new Differential revision:
        Revision URI: http://qa.in-portal.org/D106

Included changes:
  M       core/kernel/application.php
  M       core/kernel/nparser/nparser.php

Since differential revision is created, then I presume the exception has something to do with 2 'harbormaster.sendmessage' conduit calls for reposting lint and unit test errors.

For this diff I had some lint errors, produced by phpcs.

Event Timeline

aik099 raised the priority of this task from to Needs Triage.
aik099 updated the task description. (Show Details)
aik099 added a project: Arcanist.
aik099 added a subscriber: aik099.
aik099 updated the task description. (Show Details)

Missing required parameters:

Hints at a version mismatch between the client's arc version and the server's version.

Try updating arc (on the client, using arc upgrade) and see if this is still an issue.
If it does, run with --trace to get a full trace of the issue, and include the server's versions.

If this reproduces at HEAD, I'd guess you have a linter which raises lint messages without names. This field is required. We can improve the API so you're given a better warning about this which points at the problem more specifically.

https://secure.phabricator.com/diffusion/ARC/browse/master/src/lint/linter/ArcanistPhpcsLinter.php;807057087d65298e69bb8260db81bee1ae109084$114-120 - yes, the PHPCS linter doesn't set name, which is bad considering it knows (from xml report) which sniff name it is, that raised an error/warning.

Maybe it never sent a name, but from some point in time that API call was introduced (that I mentioned in task description) that wanted to rely on fact, that name is passed.

Here is the complete trace (reproducible):

→ arc diff --trace --create 
libphutil loaded from '/usr/local/phabricator/libphutil/src'.
arcanist loaded from '/usr/local/phabricator/arcanist/src'.
Config: Reading user configuration file "/home/user/.arcrc"...
Config: Did not find system configuration at "/etc/arcconfig".
Working Copy: Reading .arcconfig from "/path/to/project/.arcconfig".
Working Copy: Path "/path/to/project" is part of `svn` working copy "/path/to/project".
Working Copy: Project root is at "/path/to/project".
Config: Did not find local configuration at "/path/to/project/.svn/arc/config".
>>> [0] <conduit> conduit.connect() <bytes = 464>
>>> [1] <http> http://phabricator.domain.com/api/conduit.connect
<<< [1] <http> 161,655 us
<<< [0] <conduit> 162,417 us
>>> [2] <exec> $ svn --xml status '/path/to/project/'
<<< [2] <exec> 40,186 us
>>> [3] <exec> $ svn --xml info '/path/to/project/'
<<< [3] <exec> 17,601 us
>>> [4] <exec> $ svn --xml status '/path/to/project'
<<< [4] <exec> 38,923 us
>>> [5] <event> diff.didCollectChanges <listeners = 0>
<<< [5] <event> 159 us
Linting...
>>> [6] <exec> $ svn diff --depth empty --diff-cmd '/usr/local/phabricator/arcanist/scripts/repository/binary_safe_diff.sh' -x -U32767 'index.php'
<<< [6] <exec> 15,324 us
Examining paths for linter 'php-lint'.
Found 1 matching paths for linter 'php-lint'.
Examining paths for linter 'checkstyle'.
Found 1 matching paths for linter 'checkstyle'.
>>> [7] <exec> $ which 'phpcs'
<<< [7] <exec> 11,890 us
>>> [8] <exec> $ which 'phpcs'
<<< [8] <exec> 10,416 us
>>> [9] <exec> $ 'phpcs' --version
<<< [9] <exec> 55,629 us
>>> [10] <exec> $ which 'php'
<<< [10] <exec> 10,822 us
>>> [11] <exec> $ which 'php'
<<< [11] <exec> 10,538 us
>>> [12] <exec> $ 'php' --run 'echo phpversion();'
<<< [12] <exec> 42,624 us
>>> [13] <lint> PHP_CodeSniffer <paths = 1>
>>> [14] <exec> $ which 'phpcs'
<<< [14] <exec> 11,574 us
>>> [15] <exec> $ 'phpcs' '--report=xml' '--standard=vendor/aik099/coding-standard/CodingStandard' '/path/to/project/index.php'
<<< [13] <lint> 16,309 us
>>> [16] <lint> php -l <paths = 1>
>>> [17] <exec> $ which 'php'
<<< [17] <exec> 15,460 us
>>> [18] <exec> $ 'php' '-l' '/path/to/project/index.php'
<<< [16] <lint> 22,701 us
>>> [19] <lint> PHP_CodeSniffer <paths = 1>
<<< [15] <exec> 167,517 us
<<< [19] <lint> 145,668 us
>>> [20] <lint> php -l <paths = 1>
<<< [18] <exec> 147,922 us
<<< [20] <lint> 591 us
>>> Lint for index.php:


   Error  (PHPCS.E.CodingStandard.Commenting.InlineComment.InvalidEndChar) 
    Inline comments must end in full-stops, exclamation marks, or question
    marks

              11 * or other free or open source software licenses.
              12 * See http://www.in-portal.org/license for copyright notices and details.
              13 */
    >>>       14 	$start = getmicrotime(); // lowercased comment
              15 
              16 	define('FULL_PATH', realpath(dirname(__FILE__)));
              17 	include_once(FULL_PATH.'/core/kernel/startup.php');

   Error  (PHPCS.E.CodingStandard.Commenting.InlineComment.NotCapital) 
    Inline comments must start with a capital letter

              11 * or other free or open source software licenses.
              12 * See http://www.in-portal.org/license for copyright notices and details.
              13 */
    >>>       14 	$start = getmicrotime(); // lowercased comment
              15 
              16 	define('FULL_PATH', realpath(dirname(__FILE__)));
              17 	include_once(FULL_PATH.'/core/kernel/startup.php');
 LINT ERRORS  Lint raised errors!


Lint issued unresolved errors! Provide explanation to continue or press Enter
to abort.

>>> [21] <exec> $ bash -c 'true'
<<< [21] <exec> 12,809 us
    Explanation: errors found
Running unit tests...
No unit test engine is configured for this project.
>>> [22] <exec> $ svn diff --depth empty --diff-cmd '/usr/local/phabricator/arcanist/scripts/repository/binary_safe_diff.sh' -x -U32767 'index.php'
>>> [23] <exec> $ svn info '/path/to/project/index.php'@
<<< [23] <exec> 30,713 us
<<< [22] <exec> 52,166 us
You have a saved revision message in '.svn/arc/create-message'.
Message begins:

       Show how errors look like

You can use this message, or discard it.

    Do you want to use this message? [Y/n] n

>>> [24] <conduit> differential.parsecommitmessage() <bytes = 202>
>>> [25] <http> http://phabricator.domain.com/api/differential.parsecommitmessage
<<< [25] <http> 142,616 us
<<< [24] <conduit> 143,419 us
>>> [26] <event> diff.willBuildMessage <listeners = 0>
<<< [26] <event> 185 us
>>> [27] <conduit> differential.getcommitmessage() <bytes = 236>
>>> [28] <http> http://phabricator.domain.com/api/differential.getcommitmessage
<<< [28] <http> 143,002 us
<<< [27] <conduit> 143,651 us
>>> [29] <exec> $ svn info .
<<< [29] <exec> 21,640 us
>>> [30] <exec> $ /usr/bin/mcedit  '/tmp/edit.bc5q9pjeotckcww0/new-commit'

<<< [30] <exec> 15,883,837 us
>>> [31] <conduit> differential.parsecommitmessage() <bytes = 346>
>>> [32] <http> http://phabricator.domain.com/api/differential.parsecommitmessage
<<< [32] <http> 171,618 us
<<< [31] <conduit> 172,297 us
>>> [33] <conduit> user.query() <bytes = 216>
>>> [34] <http> http://phabricator.domain.com/api/user.query
<<< [34] <http> 137,686 us
<<< [33] <conduit> 140,444 us
>>> [35] <event> diff.didBuildMessage <listeners = 0>
<<< [35] <event> 157 us
>>> [36] <conduit> repository.query() <bytes = 193>
>>> [37] <http> http://phabricator.domain.com/api/repository.query
<<< [37] <http> 123,836 us
<<< [36] <conduit> 124,431 us
>>> [38] <conduit> differential.creatediff() <bytes = 3011>
>>> [39] <http> http://phabricator.domain.com/api/differential.creatediff
<<< [39] <http> 192,708 us
<<< [38] <conduit> 193,531 us
>>> [40] <event> diff.wasCreated <listeners = 0>
<<< [40] <event> 349 us
 SKIP STAGING  Phabricator does not support staging areas for this repository.
>>> [41] <conduit> harbormaster.queryautotargets() <bytes = 284>
>>> [42] <http> http://phabricator.domain.com/api/harbormaster.queryautotargets
<<< [42] <http> 312,553 us
<<< [41] <conduit> 313,314 us
>>> [43] <conduit> harbormaster.sendmessage() <bytes = 925>
>>> [44] <http> http://phabricator.domain.com/api/harbormaster.sendmessage
>>> [45] <conduit> harbormaster.sendmessage() <bytes = 268>
>>> [46] <http> http://phabricator.domain.com/api/harbormaster.sendmessage
<<< [44] <http> 309,218 us
<<< [43] <conduit> 320,870 us
[2015-08-12 15:38:35] EXCEPTION: (ConduitClientException) ERR-CONDUIT-CORE: Missing required parameters: name at [<phutil>/src/conduit/ConduitFuture.php:58]
arcanist(head=master, ref.master=5ed1aa876bec), phutil(head=master, ref.master=8ceb827cc0b3)
  #0 <#2> ConduitFuture::didReceiveResult(array) called at [<phutil>/src/future/FutureProxy.php:58]
  #1 <#2> FutureProxy::getResult() called at [<phutil>/src/future/FutureProxy.php:35]
  #2 <#2> FutureProxy::resolve() called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:2825]
  #3 phlog(ConduitClientException) called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:2831]
  #4 ArcanistDiffWorkflow::updateAutotargets(string, NULL) called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:535]
  #5 ArcanistDiffWorkflow::run() called at [<arcanist>/scripts/arcanist.php:382]
>>> [47] <conduit> differential.setdiffproperty() <bytes = 263>
>>> [48] <http> http://phabricator.domain.com/api/differential.setdiffproperty
>>> [49] <conduit> differential.setdiffproperty() <bytes = 1313>
>>> [50] <http> http://phabricator.domain.com/api/differential.setdiffproperty
>>> [51] <conduit> differential.setdiffproperty() <bytes = 403>
>>> [52] <http> http://phabricator.domain.com/api/differential.setdiffproperty
<<< [48] <http> 532,006 us
<<< [47] <conduit> 532,804 us
<<< [50] <http> 545,983 us
<<< [52] <http> 540,122 us
<<< [49] <conduit> 547,245 us
<<< [51] <conduit> 541,126 us
>>> [53] <event> revision.willCreateRevision <listeners = 0>
<<< [53] <event> 307 us
>>> [54] <conduit> differential.createrevision() <bytes = 415>
>>> [55] <http> http://phabricator.domain.com/api/differential.createrevision
<<< [55] <http> 707,443 us
<<< [54] <conduit> 707,931 us
>>> [56] <conduit> differential.getcommitmessage() <bytes = 182>
>>> [57] <http> http://phabricator.domain.com/api/differential.getcommitmessage
<<< [57] <http> 560,632 us
<<< [56] <conduit> 561,141 us
Created a new Differential revision:
        Revision URI: http://phabricator.domain.com/D12

Included changes:
  M       index.php

The changed file was index.php,

I confirm having the same problem with phpcs linter. Each time phpcs raises warnings or errors, arcanist throws that exception and in my code review the Arcanist Lint Result remains into "Waiting for Message" status. You should fix it quickly as phpcs is not usable anymore :(

avivey renamed this task from Exception on differential revision creation via Arcanist to Exception on arc diff with PHPCS linter.Sep 8 2015, 4:19 PM

In waiting for an official fix from Phabricator teams, if someone knows how to quickly fix this issue, it should be great to share it.

I tried to add the following line of code into the file <arcanist>/src/lint/linter/ArcanistPhpcsLinter.php

$message->setName('None');

But I get another unexpected error :

Running unit tests...
No unit test engine is configured for this project.
 SKIP STAGING  No staging area is configured for this repository.
[2015-09-10 08:48:11] EXCEPTION: (HTTPFutureHTTPResponseStatus) [HTTP/500] Internal Server Error
{"result":null,"error_code":"ERR-CONDUIT-CORE","error_info":"#1406: Data too long for column 'code' at row 1"} at [<phutil>/src/future/http/BaseHTTPFuture.php:339]
arcanist(head=master, ref.master=8f3a002cdb19), exit(head=test, ref.master=3d609f7e9b57, ref.test=44864dad1e70), phutil(head=master, ref.master=e8389097abcc)
  #0 <#2> BaseHTTPFuture::parseRawHTTPResponse(string) called at [<phutil>/src/future/http/HTTPSFuture.php:415]
  #1 <#2> HTTPSFuture::isReady() called at [<phutil>/src/future/FutureProxy.php:30]
  #2 <#2> FutureProxy::isReady() called at [<phutil>/src/future/FutureIterator.php:198]
  #3 <#2> FutureIterator::next() called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:2776]
  #4 phlog(HTTPFutureHTTPResponseStatus) called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:2783]
  #5 ArcanistDiffWorkflow::updateAutotargets(string, NULL) called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:528]
  #6 ArcanistDiffWorkflow::run() called at [<arcanist>/scripts/arcanist.php:382]