codeql
codeql copied to clipboard
Python codeql analysis hangs at `UnusedModuleVariable`
Description of the issue
The codeql runs in a PR (https://github.com/deepmodeling/deepmd-kit/pull/3199, commit https://github.com/deepmodeling/deepmd-kit/pull/3199/commits/ce87afc5be720c15fac114927052104028093764).
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.
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 https://github.com/deepmodeling/deepmd-kit/pull/3202, which resolves the hang by just removing this decorator once...
Thanks for the detailed report! I'll ask the team to have a look.
👋 @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.