Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal error: Could not find class when running hh_client --lint --json #8950

Open
Atry opened this issue Dec 10, 2021 · 0 comments
Open

Comments

@Atry
Copy link
Contributor

Atry commented Dec 10, 2021

I am creating a test triggering hh_client --lint --json against some temporary files.

The content of the temporary source file is like

/*
 *  Copyright (c) 2017-present, Facebook, Inc.
 *  All rights reserved.
 *
 *  This source code is licensed under the MIT license found in the
 *  LICENSE file in the root directory of this source tree.
 *
 */
final class Test {
  private static function testThis() {
    \SomeNamespace\__Private\SomeEnumName::SOME_VALUE;
  }
}

Even though this file should not type check, I would expect no lint errors should be reported.

However, when hh_client --lint path/to/the/temporary/file.hack --json is running, sometimes hh_client prints the following error:

{"descr":"Internal error: Could not find class","severity":"error","path":"\/workspaces\/hhast\/.var\/tmp\/hhast\/HHClientDuplicatedLintErrorTest\/1902a47e82576d16a1e026e177dc583b.php","line":9,"start":13,"end":16,"code":0,"bypass_changed_lines":false,"original":"","replacement":""}

To trigger this bug:

git clone https://github.com/atry/hhast.git --branch hhvm-bug-report && cd hhast && composer install && vendor/bin/hacktest tests/HHClientDuplicatedLintErrorTest.hack

This bug is not reproducible from manual execution of hh_client --lint --json, because it only happens when the temporary file is newly created (maybe while the typechecking is still running?) and there are many concurrent hh_client calls (some race condition?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant