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

expression in assignments are evaluated and can cause pylint to run out of memory or time #4041

Closed
jkrinke opened this issue Jan 23, 2021 · 4 comments
Labels
Astroid Related to astroid Bug 🪲 Crash 💥 A bug that makes pylint crash

Comments

@jkrinke
Copy link

jkrinke commented Jan 23, 2021

Steps to reproduce

  1. Create a file that only contains v=999999999999999**999999999999999
  2. Run pylon on it.

Current behavior

Pylint seems to evaluate the expression of the assignment which will take a very long time and in the end will run out of time.

Expected behavior

Pylint should not attempt evaluation expressions.

pylint --version output

pylint 2.6.0
astroid 2.4.2
Python 3.8.6 (default, Sep 28 2020, 04:41:02)
[Clang 11.0.3 (clang-1103.0.32.62)]

@hippo91
Copy link
Contributor

hippo91 commented Jan 30, 2021

@jkrinke thanks for this report. However i'm not sure this is really an issue.
astroid, the inference engine used by pylint, has to evaluate some simple expression to be able to infer correctly more complex expressions. Moreover if plyint takes a long time to evaluate, then python will do so.
It may be interesting to monitor this execution time and raise a warning if it takes too much time.

@hippo91 hippo91 added Astroid Related to astroid Enhancement ✨ Improvement to a component labels Jan 30, 2021
@jkrinke
Copy link
Author

jkrinke commented Feb 3, 2021

@hippo91 the behaviour is problematic in a CI/CD setting where one expects that a static analysis tool would not crash (run out of memory) or not terminate.

I am currently running pylint on the above file. After 48h of run time, the process now uses 4GB of main memory. I expect that the machine would come to a grinding halt within 96h of run time. Let's assume an extremely fast processor - then pylint would crash running out of main memory within a short time. I would consider this a bug...

@hippo91 hippo91 added Bug 🪲 Crash 💥 A bug that makes pylint crash and removed Enhancement ✨ Improvement to a component labels Feb 6, 2021
@jkrinke
Copy link
Author

jkrinke commented Feb 12, 2021

@hippo91
Copy link
Contributor

hippo91 commented Feb 16, 2021

@jkrinke it seems indeed that it is not related to pylint.
I close the issue but will reopen it if needed.

@hippo91 hippo91 closed this as completed Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Astroid Related to astroid Bug 🪲 Crash 💥 A bug that makes pylint crash
Projects
None yet
Development

No branches or pull requests

2 participants