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

Python codeql analysis hangs at UnusedModuleVariable #15466

Closed
njzjz opened this issue Jan 29, 2024 · 3 comments
Closed

Python codeql analysis hangs at UnusedModuleVariable #15466

njzjz opened this issue Jan 29, 2024 · 3 comments
Assignees
Labels
acknowledged GitHub staff acknowledges this issue Python question Further information is requested

Comments

@njzjz
Copy link

njzjz commented Jan 29, 2024

Description of the issue

The codeql runs in a PR (deepmodeling/deepmd-kit#3199, commit deepmodeling/deepmd-kit@ce87afc).

It hung at:

   [88/168 eval 3.7s] Evaluation done; writing results to codeql/python-queries/Variables/MultiplyDefined.bqrs.
  Starting evaluation of codeql/python-queries/Variables/UnusedModuleVariable.ql.

https://github.com/deepmodeling/deepmd-kit/actions/runs/7697851534/job/20975781045

I manually restarted it after several hours, and it hung here again.

https://github.com/deepmodeling/deepmd-kit/actions/runs/7697851534/job/20989521619

I don't quite understand what's wrong with UnusedModuleVariable in this PR. Thank you in advance.

@njzjz njzjz added the question Further information is requested label Jan 29, 2024
@njzjz
Copy link
Author

njzjz commented Jan 30, 2024

Finally, I found that if a class used the following decorator twice (via inheritance), codeql would hang. The reason is unclear to me.

def fitting_check_output(cls):
    class wrapper(cls):
        def __init__(
            self,
            *args,
            **kwargs,
        ):
            super().__init__(*args, **kwargs)
            self.md = self.output_def()

        def __call__(
            self,
            *args,
            **kwargs,
        ):
            ret = cls.__call__(self, *args, **kwargs)
            for kk in self.md.keys():
                dd = self.md[kk]
                check_var(ret[kk], dd)
            return ret

    return wrapper

See also deepmodeling/deepmd-kit#3202, which resolves the hang by just removing this decorator once...

@aibaars
Copy link
Contributor

aibaars commented Jan 30, 2024

Thanks for the detailed report! I'll ask the team to have a look.

@sidshank sidshank added the Python label Feb 1, 2024
@sidshank sidshank added the acknowledged GitHub staff acknowledges this issue label Feb 26, 2024
@sidshank
Copy link
Contributor

👋 @njzjz Apologies for the delayed response. We've invested some time in attempting to reproduce this issue, but haven't been able to so far. Since you have a workaround, I will close this issue for now. If we see others report something similar, we'll reopen and investigate the issue to determine next steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged GitHub staff acknowledges this issue Python question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants