Page MenuHomePhabricator

Segfault on missing linter when running `arc unit`
Closed, InvalidPublic

Description

I'm trying to run some linters and @joshuaspence mentioned that linters which I do not have installed should be skipped. Unfortunately, this ends up with a segfault.

~/phabricator/arcanist master*
❯ arc unit src/lint/linter/
   PASS  237ms   ArcanistChmodLinterTestCase::testLinter
   PASS  188ms   ArcanistCommitLinterTestCase::testLinter
   PASS   1.2s   ArcanistCSSLintLinterTestCase::testLinter
   PASS  144ms   ArcanistCSSLintLinterTestCase::testVersion
   PASS  301ms   ArcanistClosureLinterTestCase::testLinter
   PASS   51ms   ArcanistClosureLinterTestCase::testVersion
   PASS   5.0s   ArcanistCoffeeLintLinterTestCase::testLinter
   PASS  273ms   ArcanistCoffeeLintLinterTestCase::testVersion
   PASS   76ms   ArcanistCppcheckLinterTestCase::testVersion
   PASS   1.5s   ArcanistCppcheckLinterTestCase::testLinter
   PASS   51ms   ArcanistCpplintLinterTestCase::testVersion
   PASS  363ms   ArcanistCpplintLinterTestCase::testLinter
   PASS  264ms   ArcanistFlake8LinterTestCase::testVersion
   PASS  802ms   ArcanistFlake8LinterTestCase::testLinter
   PASS   46ms★  ArcanistGoLintLinterTestCase::testVersion
   PASS  177ms   ArcanistGoLintLinterTestCase::testLinter
   SKIP  ArcanistHLintLinterTestCase::testVersion
Unable to locate binary "hlint" to run linter ArcanistHLintLinter. You may need to install the binary, or adjust your linter configuration.
TO INSTALL: Install hlint with `cabal install hlint`.
php(23818,0x7fff7da92300) malloc: *** error for object 0xc00007fad4ae8bcf: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
[1]    23818 abort      arc unit src/lint/linter/

I am using PHP 5.4.37

Event Timeline

rymndhng raised the priority of this task from to Needs Triage.
rymndhng updated the task description. (Show Details)
rymndhng added a project: Arcanist.
rymndhng added subscribers: rymndhng, joshuaspence.

I actually hit a similar issue recently when running unit tests in rPHU. I might poke around and see what comes up.

> php --version
PHP 5.6.4-4ubuntu6 (cli) (built: Apr 17 2015 15:47:51) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.3.2, Copyright (c) 2002-2015, by Derick Rethans

> arc unit --everything --trace
libphutil loaded from '/home/joshua/dotfiles/modules/phabricator/libphutil/src'.
arcanist loaded from '/home/joshua/dotfiles/modules/phabricator/arcanist/src'.
Config: Reading user configuration file "/home/joshua/.arcrc"...
Config: Did not find system configuration at "/etc/arcconfig".
Working Copy: Reading .arcconfig from "/home/joshua/workspace/github.com/phacility/libphutil/.arcconfig".
Working Copy: Path "/home/joshua/workspace/github.com/phacility/libphutil" is part of `git` working copy "/home/joshua/workspace/github.com/phacility/libphutil".
Working Copy: Project root is at "/home/joshua/workspace/github.com/phacility/libphutil".
Config: Did not find local configuration at "/home/joshua/workspace/github.com/phacility/libphutil/.git/arc/config".
This is libphutil! Forcing this copy to load...
>>> [0] <exec> $ ARC_PHUTIL_PATH='/home/joshua/workspace/github.com/phacility/libphutil' '/home/joshua/dotfiles/modules/phabricator/arcanist/bin/arc' 'unit' '--everything' '--trace'
libphutil loaded from '/home/joshua/workspace/github.com/phacility/libphutil/src'.
arcanist loaded from '/home/joshua/dotfiles/modules/phabricator/arcanist/src'.
Config: Reading user configuration file "/home/joshua/.arcrc"...
Config: Did not find system configuration at "/etc/arcconfig".
Working Copy: Reading .arcconfig from "/home/joshua/workspace/github.com/phacility/libphutil/.arcconfig".
Working Copy: Path "/home/joshua/workspace/github.com/phacility/libphutil" is part of `git` working copy "/home/joshua/workspace/github.com/phacility/libphutil".
Working Copy: Project root is at "/home/joshua/workspace/github.com/phacility/libphutil".
Config: Did not find local configuration at "/home/joshua/workspace/github.com/phacility/libphutil/.git/arc/config".
>>> [0] <exec> $ git ls-files -z
<<< [0] <exec> 10,578 us
   PASS   75ms   AbstractDirectedGraphTestCase::testBestEffortTopographicSortTree
   PASS   35ms★  AbstractDirectedGraphTestCase::testNonTreeGraph
   PASS   34ms★  AbstractDirectedGraphTestCase::testNoncyclicGraph
   PASS   33ms★  AbstractDirectedGraphTestCase::testTrivialGraph
   PASS   35ms★  AbstractDirectedGraphTestCase::testCyclicGraph
   PASS   33ms★  AbstractDirectedGraphTestCase::testTrivialCyclicGraph
   PASS   34ms★  AbstractDirectedGraphTestCase::testEdgeLoadFailure
   PASS   39ms★  AbstractDirectedGraphTestCase::testTopographicSortTree
   PASS   39ms★  ConduitClientTestCase::testConduitRequestEncoding
>>> [1] <exec> $ sleep 32000
>>> [2] <exec> $ sleep 32000
>>> [3] <exec> $ sleep 32000
>>> [4] <exec> $ sleep 32000
<<< [1] <exec> 26,396 us
<<< [2] <exec> 24,977 us
<<< [3] <exec> 23,407 us
<<< [4] <exec> 21,337 us
   PASS   81ms   ExecFutureTestCase::testMultipleTimeoutsTestShouldRunLessThan1Sec
>>> [5] <exec> $ sleep 32000
<<< [5] <exec> 16,184 us
   PASS   59ms   ExecFutureTestCase::testResolveTimeoutTestShouldRunLessThan1Sec
>>> [6] <exec> $ cat
<<< [6] <exec> 5,475 us
   PASS   45ms★  ExecFutureTestCase::testEmptyWrite
>>> [7] <exec> $ cat
<<< [7] <exec> 166,548 us
   PASS  221ms   ExecFutureTestCase::testLargeBuffer
>>> [8] <exec> $ sleep 32000
<<< [8] <exec> 14,807 us
   PASS   58ms   ExecFutureTestCase::testTimeoutTestShouldRunLessThan1Sec
>>> [9] <exec> $ cat
<<< [9] <exec> 5,689 us
>>> [10] <exec> $ cat
<<< [10] <exec> 5,244 us
   PASS   55ms   ExecFutureTestCase::testReadBuffering
>>> [11] <exec> $ cat
<<< [11] <exec> 42,809 us
   PASS   86ms   ExecFutureTestCase::testBufferLimit
>>> [12] <exec> $ sleep 30
<<< [12] <exec> 5,659 us
   PASS   47ms★  ExecFutureTestCase::testNoHangOnExecFutureDestructionWithRunningChild
>>> [13] <exec> $ cat
<<< [13] <exec> 6,680 us
   PASS   47ms★  ExecFutureTestCase::testKeepPipe
>>> [14] <exec> $ echo quack
<<< [14] <exec> 4,974 us
   PASS   46ms★  ExecFutureTestCase::testMultipleResolves
>>> [15] <exec> $ exit
<<< [15] <exec> 3,894 us
   PASS   47ms★  ExecPassthruTestCase::testExecPassthru
>>> [16] <exec> $ find . "(" -path './exclude' -o -path 'subdir.txt' ")" -prune -o -type 'f' "(" -name '*.txt' ")" "(" -path '*/include_dir.txt/subdir.txt/alsoinclude.txt' ")" -print0
<<< [16] <exec> 7,353 us
   PASS   58ms   FileFinderTestCase::testFinderWithPath
>>> [17] <exec> $ find . "(" -path './exclude' -o -path 'subdir.txt' ")" -prune -o -type 'f' "(" -name 'test' ")" "(" -path '*' ")" -print0
<<< [17] <exec> 7,563 us
   PASS   75ms   FileFinderTestCase::testFinderWithNames
>>> [18] <exec> $ find . "(" -path './exclude' -o -path 'subdir.txt' ")" -prune -o -type 'f' "(" -name '*.txt' ")" "(" -path '*' ")" -print0
<<< [18] <exec> 7,761 us
   PASS   93ms   FileFinderTestCase::testFinderWithChecksums
>>> [19] <exec> $ find . "(" -path './exclude' -o -path 'subdir.txt' ")" -prune -o -type 'f' "(" -name '*.txt' ")" "(" -path '*' ")" -print0
<<< [19] <exec> 10,962 us
   PASS   80ms   FileFinderTestCase::testFinderWithoutChecksums
>>> [20] <exec> $ find . "(" -path './exclude' -o -path 'subdir.txt' ")" -prune -o "(" -name '*.txt' ")" "(" -path '*' ")" -print0
<<< [20] <exec> 14,718 us
   PASS   92ms   FileFinderTestCase::testFinderWithDirectories
>>> [21] <exec> $ which 'which'
<<< [21] <exec> 9,021 us
>>> [22] <exec> $ which 'halting-problem-decider'
<<< [22] <exec> 5,793 us
   PASS   79ms   FilesystemTestCase::testResolveBinary
>>> [23] <exec> $ which 'which'
<<< [23] <exec> 6,441 us
>>> [24] <exec> $ which 'halting-problem-decider'
<<< [24] <exec> 17,635 us
   PASS   85ms   FilesystemTestCase::testBinaryExists
   PASS   50ms   FilesystemTestCase::testReadRandomBytes
   PASS   53ms   FilesystemTestCase::testWriteUniqueFile
>>> [25] <exec> $ cat
<<< [25] <exec> 9,291 us
>>> [26] <exec> $ cat
<<< [26] <exec> 5,831 us
   PASS   63ms   FutureIteratorTestCase::testAddingFuture
>>> [27] <exec> $ cat
<<< [27] <exec> 9,705 us
   PASS   8.3s   LinesOfALargeExecFutureTestCase::testExecLongLine
>>> [28] <exec> $ cat
<<< [28] <exec> 6,785 us
   PASS  592ms   LinesOfALargeExecFutureTestCase::testExecLargeFile
>>> [29] <exec> $ does-not-exist.exe.sh
<<< [29] <exec> 9,141 us
   PASS   89ms   LinesOfALargeExecFutureTestCase::testExecException
>>> [30] <exec> $ cat
<<< [30] <exec> 11,790 us
   PASS   93ms   LinesOfALargeExecFutureTestCase::testExecBasics
   PASS  641ms   LinesOfALargeFileTestCase::testLargeFile
   PASS   62ms   LinesOfALargeFileTestCase::testEmptyLines
   PASS   56ms   LinesOfALargeFileTestCase::testTerminalDelimiterPresent
   PASS   51ms   LinesOfALargeFileTestCase::testBasics
   PASS   46ms★  LinesOfALargeFileTestCase::testTerminalDelimiterAbsent
   PASS   48ms★  LinesOfALargeFileTestCase::testChangeDelimiter
   PASS   52ms   LinesOfALargeFileTestCase::testLineFilter
   PASS  10.8s   LinesOfALargeFileTestCase::testLongLine
   PASS   84ms   LinesOfALargeFileTestCase::testReadFailure
>>> [31] <exec> $ '/home/joshua/workspace/github.com/phacility/libphutil/src/parser/xhpast/bin/xhpast' --version
<<< [31] <exec> 7,116 us
>>> [32] <exec> $ '/home/joshua/workspace/github.com/phacility/libphutil/src/parser/xhpast/bin/xhpast'
<<< [32] <exec> 9,402 us
>>> [33] <exec> $ '/home/joshua/workspace/github.com/phacility/libphutil/src/parser/xhpast/bin/xhpast'
<<< [33] <exec> 11,857 us
>>> [34] <exec> $ '/home/joshua/workspace/github.com/phacility/libphutil/src/parser/xhpast/bin/xhpast'
<<< [34] <exec> 18,918 us
>>> [35] <exec> $ '/home/joshua/workspace/github.com/phacility/libphutil/src/parser/xhpast/bin/xhpast'
<<< [35] <exec> 10,507 us
>>> [36] <exec> $ '/home/joshua/workspace/github.com/phacility/libphutil/src/parser/xhpast/bin/xhpast'
<<< [36] <exec> 8,028 us
>>> [37] <exec> $ diff -L 'Old Value' -L 'New Value' -U '65535' '/tmp/3p8iv453yneo0gcg/14371-V3BIcI' '/tmp/1tzzrpasnhgk04cw/14371-tJ0IgH'
<<< [37] <exec> 10,977 us
   FAIL  PHPASTParserTestCase::testParser
Assertion failed, expected values to be equal (at PHPASTParserTestCase.php:128): Parser output for "php-access-on-instanciation.test".
Expected vs Actual Output Diff
--- Old Value
+++ New Value
@@ -1,643 +1,643 @@
 '{
   "tree": [
     9000,
     0,
     74,
     [
       [
         9006,
         0,
         73,
         [
           [
             9007,
             0,
             0
           ],
           [
             9004,
             2,
             25,
             [
               [
                 9051,
                 2,
                 25,
                 [
                   [
                     9052,
                     2,
                     2
                   ],
                   [
                     9090,
                     4,
                     4
                   ],
                   [
                     9005
                   ],
                   [
                     9005
                   ],
                   [
                     9006,
                     6,
                     25,
                     [
                       [
                         9004,
                         8,
                         11,
                         [
                           [
                             9063,
                             8,
                             10,
                             [
                               [
                                 9070,
                                 8,
                                 8,
                                 [
                                   [
                                     9013,
                                     8,
                                     8
                                   ]
                                 ]
                               ],
                               [
                                 9064,
                                 10,
                                 10,
                                 [
                                   [
                                     9047,
                                     10,
                                     10
                                   ],
                                   [
                                     9005
                                   ]
                                 ]
                               ]
                             ]
                           ]
                         ]
                       ],
                       [
                         9004,
                         13,
                         23,
                         [
                           [
                             9067,
                             13,
                             23,
                             [
                               [
                                 9068,
                                 13,
                                 13,
                                 [
                                   [
                                     9013,
                                     13,
                                     13
                                   ]
                                 ]
                               ],
                               [
                                 9005
                               ],
                               [
                                 9013,
                                 17,
                                 17
                               ],
                               [
                                 9059,
                                 18,
                                 19
                               ],
                               [
                                 9005
                               ],
                               [
                                 9006,
                                 21,
                                 23
                               ]
                             ]
                           ]
                         ]
                       ]
                     ]
                   ]
                 ]
               ]
             ]
           ],
           [
             9004,
             27,
             38,
             [
               [
                 9077,
                 27,
                 37,
                 [
                   [
                     9047,
                     27,
                     27
                   ],
                   [
                     9081,
                     29,
                     29
                   ],
                   [
                     9092,
                     31,
                     37,
                     [
                       [
                         9074,
                         31,
                         35,
                         [
                           [
                             9090,
                             34,
                             34
                           ],
                           [
                             9005
                           ]
                         ]
                       ],
                       [
                         9013,
                         37,
                         37
                       ]
                     ]
                   ]
                 ]
               ]
             ]
           ],
           [
             9004,
             40,
             53,
             [
               [
                 9077,
                 40,
                 52,
                 [
                   [
                     9047,
                     40,
                     40
                   ],
                   [
                     9081,
                     42,
                     42
                   ],
                   [
                     9102,
                     44,
                     52,
                     [
                       [
                         9092,
                         44,
                         50,
                         [
                           [
                             9074,
                             44,
                             48,
                             [
                               [
                                 9090,
                                 47,
                                 47
                               ],
                               [
                                 9005
                               ]
                             ]
                           ],
                           [
                             9013,
                             50,
                             50
                           ]
                         ]
                       ],
                       [
                         9095,
                         51,
                         52
                       ]
                     ]
                   ]
                 ]
               ]
             ]
           ],
           [
             9004,
             55,
             62,
             [
               [
                 9092,
                 55,
                 61,
                 [
                   [
                     9074,
                     55,
                     59,
                     [
                       [
                         9090,
                         58,
                         58
                       ],
                       [
                         9005
                       ]
                     ]
                   ],
                   [
                     9013,
                     61,
                     61
                   ]
                 ]
               ]
             ]
           ],
           [
             9004,
             64,
             73,
             [
               [
                 9102,
                 64,
                 72,
                 [
                   [
                     9092,
                     64,
                     70,
                     [
                       [
                         9074,
                         64,
                         68,
                         [
                           [
                             9090,
                             67,
                             67
                           ],
                           [
                             9005
                           ]
                         ]
                       ],
                       [
                         9013,
                         70,
                         70
                       ]
                     ]
                   ],
                   [
                     9095,
                     71,
                     72
                   ]
                 ]
               ]
             ]
           ]
         ]
       ]
     ]
   ],
   "stream": [
     [
       371,
       6
     ],
     [
       375,
       1
     ],
     [
       356,
       5
     ],
     [
       375,
       1
     ],
     [
       309,
       1
     ],
     [
       375,
       1
     ],
     [
       123,
       1
     ],
     [
       375,
       2
     ],
     [
-      345,
+      350,
       6
     ],
     [
       375,
       1
     ],
     [
       311,
       2
     ],
     [
       59,
       1
     ],
     [
       375,
       3
     ],
     [
-      345,
+      350,
       6
     ],
     [
       375,
       1
     ],
     [
       337,
       8
     ],
     [
       375,
       1
     ],
     [
       309,
       1
     ],
     [
       40,
       1
     ],
     [
       41,
       1
     ],
     [
       375,
       1
     ],
     [
       123,
       1
     ],
     [
       375,
       1
     ],
     [
       125,
       1
     ],
     [
       375,
       1
     ],
     [
       125,
       1
     ],
     [
       375,
       2
     ],
     [
       311,
       2
     ],
     [
       375,
       1
     ],
     [
       61,
       1
     ],
     [
       375,
       1
     ],
     [
       40,
       1
     ],
     [
-      301,
+      300,
       3
     ],
     [
       375,
       1
     ],
     [
       309,
       1
     ],
     [
       41,
       1
     ],
     [
       360,
       2
     ],
     [
       309,
       1
     ],
     [
       59,
       1
     ],
     [
       375,
       2
     ],
     [
       311,
       2
     ],
     [
       375,
       1
     ],
     [
       61,
       1
     ],
     [
       375,
       1
     ],
     [
       40,
       1
     ],
     [
-      301,
+      300,
       3
     ],
     [
       375,
       1
     ],
     [
       309,
       1
     ],
     [
       41,
       1
     ],
     [
       360,
       2
     ],
     [
       309,
       1
     ],
     [
       40,
       1
     ],
     [
       41,
       1
     ],
     [
       59,
       1
     ],
     [
       375,
       2
     ],
     [
       40,
       1
     ],
     [
-      301,
+      300,
       3
     ],
     [
       375,
       1
     ],
     [
       309,
       1
     ],
     [
       41,
       1
     ],
     [
       360,
       2
     ],
     [
       309,
       1
     ],
     [
       59,
       1
     ],
     [
       375,
       2
     ],
     [
       40,
       1
     ],
     [
-      301,
+      300,
       3
     ],
     [
       375,
       1
     ],
     [
       309,
       1
     ],
     [
       41,
       1
     ],
     [
       360,
       2
     ],
     [
       309,
       1
     ],
     [
       40,
       1
     ],
     [
       41,
       1
     ],
     [
       59,
       1
     ],
     [
       375,
       1
     ]
   ]
 }
 '

Segmentation fault (core dumped)
<<< [0] <exec> 23,802,009 us

From syslog:

kernel: [23981.397649] php[14132]: segfault at 47c6000 ip 00007f21aadfd0f1 sp 00007fffc51b0600 error 4 in xdebug.so[7f21aaded000+36000]

I didn't make any other progress here.

@joshuaspence: does disabling the xdebug extension resolve this?
@rymndhng: do you have xdebug enabled?

It should normally be impossible for anything we do to cause segfaults, so this is almost certainly a PHP / extension / system problem and unlikely to be something we can fix.

@rymndhng: do you have xdebug enabled?

It should normally be impossible for anything we do to cause segfaults, so this is almost certainly a PHP / extension / system problem and unlikely to be something we can fix.

Yes, you're right, Thanks! Disabling xdebug made the problem go away.

If this is a known issue and the scope of it is beyond arcanist, feel free to close this ticket.

joshuaspence claimed this task.

Yeah, I originally thought that this might be an XHPAST thing but definitely seems to be XDebug.