Hhvm: hh_client hangs on `instanceof` in function call

Created on 11 Aug 2019  路  4Comments  路  Source: facebook/hhvm

HHVM Version

Please include the output of hhvm --version and hh_client --version

$ hhvm --version
HipHop VM 4.17.1 (rel)
Compiler: 1565219311_680317822
Repo schema: db6d381a92c607fc27aa4545f27800c5143c4b73

Operating System and Version

For example, 'Debian Squeeze', 'Ubuntu 16.04', 'MacOS High Sierra'. Please
also mention if you are using Docker or similar images.

Reproduced on MacOS Mojave and Ubuntu 16.04, both on HHVM 4.17.1

Standalone code, or other way to reproduce the problem

This should not depend on installing any libraries or frameworks. Ideally, it
should be possible to copy-paste this into a single file and reproduce the
problem by running hhvm and/or hh_client

<?hh // strict
function foo(): void {
    $a = some_function(1 instanceof SomeClass);
}

Actual result

If applicable, please copy-paste output from hhvm or hh_client

For more detailed logs, try `tail -f $(hh_client --monitor-logname) $(hh_client --logname)`
Server launched with the following command:
    '/usr/local/Cellar/hhvm-4.17/4.17.1/bin/hh_server' '-d' '/tests/sandbox/2019-08-10-1' '--waiting-client' '7'
Spawned typechecker (child pid=3513)
Logs will go to /private/tmp/hh_server/monitor_logs/zStestszSsandboxzS2019-08-10-1-2019-08-10-23-10-17.monitor_log
hh_server is busy: [parsing] -

Expected result

Not hanging; a bunch of errors about how some_function and SomeClass don't exist, and instanceof is deprecated, etc.

The structure is very specific: it needs to be assigned to a variable, and instanceof needs to be called within a function call. It doesn't matter if the class or function exists.

I didn't write new code like this, but this prevented some of my older code from running after an upgrade to more recent versions because it had old dependencies; in my case, on an old version of HHVM's difflib with this line in it. I had to hunt this error down by binary searching all the Hack files in my project, so it would help greatly just to save the effort to find this error if it didn't cause a hang.

Diff Ready hack

Most helpful comment

All 4 comments

So that was it! I have had a similar issue too. My project has difflib as a far distant third party dependency. After upgrading to 4.17 for _real_ generics, my typechecker would spin forever during parsing. After removing vendor it worked again. I couldn't find out why. I just removed all dependencies and reinstalled only what was needed for my code in src to work. Does hacktest rely on that version of difflib?

@lexidor Ah, I've got to say it's slightly consoling to know I wasn't alone. It's a direct dependency to hhast which is depended on by many others, including hacktest. But, if you just upgrade your packages it should go away because difflib 鈮1.1.1 has changed instanceof over to is.

Fixed in 1dc83a9.

Was this page helpful?
0 / 5 - 0 ratings