summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* refactor pywin/pypy depswheels3Giampaolo Rodola2020-05-232-3/+6
|
* set timeout for wait()Giampaolo Rodola2020-05-231-2/+2
|
* refactor win testsGiampaolo Rodola2020-05-231-15/+14
|
* remove placeholders for open_filesGiampaolo Rodola2020-05-233-4/+0
|
* fix importGiampaolo Rodola2020-05-231-0/+1
|
* fix race conditionGiampaolo Rodola2020-05-232-3/+8
|
* skip unicode tests on pypy2Giampaolo Rodola2020-05-231-12/+12
|
* revert previous commitGiampaolo Rodola2020-05-231-2/+7
|
* refactor isfile/path_strict funcsGiampaolo Rodola2020-05-232-8/+3
|
* fix other testsGiampaolo Rodola2020-05-233-14/+12
|
* take PYPY into accountGiampaolo Rodola2020-05-231-1/+2
|
* skip testsGiampaolo Rodola2020-05-231-0/+3
|
* revert wmi refactGiampaolo Rodola2020-05-231-25/+18
|
* try to fix win errGiampaolo Rodola2020-05-221-2/+0
|
* skip wmi testsGiampaolo Rodola2020-05-221-22/+27
|
* disable windows specific tests on githubGiampaolo Rodola2020-05-222-5/+5
|
* pypiwin32 -> pywin32Giampaolo Rodola2020-05-222-4/+2
|
* increase sysmem toleranceGiampaolo Rodola2020-05-221-1/+1
|
* try to adjust testGiampaolo Rodola2020-05-221-0/+2
|
* fix exeGiampaolo Rodola2020-05-222-4/+4
|
* try to adjust testGiampaolo Rodola2020-05-222-3/+3
|
* Merge branch 'wheels3' of github.com:giampaolo/psutil into wheels3Giampaolo Rodola2020-05-220-0/+0
|\
| * temporarily disable open_files testsGiampaolo Rodola2020-05-224-0/+5
| |
* | try to fix win failureGiampaolo Rodola2020-05-221-1/+1
| |
* | undo last commitGiampaolo Rodola2020-05-224-0/+5
|/
* try to adjust testGiampaolo Rodola2020-05-191-1/+1
|
* adjust depsGiampaolo Rodola2020-05-193-10/+15
|
* adjust flake8Giampaolo Rodola2020-05-192-6/+4
|
* remove duplicate testGiampaolo Rodola2020-05-195-69/+14
|
* fix for floppyGiampaolo Rodola2020-05-181-1/+2
|
* refactor some testsGiampaolo Rodola2020-05-183-38/+48
|
* look for floppyGiampaolo Rodola2020-05-181-0/+2
|
* fix some testsGiampaolo Rodola2020-05-184-14/+60
|
* refactor FetchAll testGiampaolo Rodola2020-05-181-8/+4
|
* fix occasional false positivesGiampaolo Rodola2020-05-182-2/+4
|
* enable github sponsorsGiampaolo Rodola2020-05-181-1/+1
|
* Wheels2 (#1761)Giampaolo Rodola2020-05-1817-103/+314
|
* Have GitHub build wheels on commit (#1758)Grzegorz Bokota2020-05-165-6/+91
|
* [Linux] Process.rlimit() does not handle LONG LONG properly (#1760)Giampaolo Rodola2020-05-162-3/+2
|
* add strncpy / PSUTIL_STRNCPY variant which adds null terminator (fix gcc-9 ↵Giampaolo Rodola2020-05-165-8/+13
| | | | warning)
* #1758: fix github failuresGiampaolo Rodola2020-05-156-21/+12
|
* better #ifdef detection for prlimit() availbilityGiampaolo Rodola2020-05-152-26/+22
| | | | | | | | | Rely on "__NR_prlimit64" availability and check GLIBC version only. Take kernel version out of the picture. This way it works on both CentOS 6 and 7. Also, have test_contracts.py tests assume prlimit() is always available, so that we will be notified (by failure). Ref: #1758
* shorter testfnGiampaolo Rodola2020-05-151-3/+1
|
* fix some testsGiampaolo Rodola2020-05-153-7/+9
|
* have leak test use 3M instead of 70M to avoid swapping out on CIGiampaolo Rodola2020-05-131-1/+2
|
* rename memleaks scriptGiampaolo Rodola2020-05-137-6/+6
|
* always execute python memleak tests on linux (just fewer times)Giampaolo Rodola2020-05-132-55/+69
|
* put fds test in mem leak classGiampaolo Rodola2020-05-133-128/+70
|
* remove dead codeGiampaolo Rodola2020-05-131-6/+0
|
* Memory leak test: take fluctuations into account (#1757)Giampaolo Rodola2020-05-1310-206/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Preamble ======= We have a [memory leak test suite](https://github.com/giampaolo/psutil/blob/e1ea2bccf8aea404dca0f79398f36f37217c45f6/psutil/tests/__init__.py#L897), which calls a function many times and fails if the process memory increased. We do this in order to detect missing `free()` or `Py_DECREF` calls in the C modules. When we do, then we have a memory leak. The problem ========== A problem we've been having for probably over 10 years, is the false positives. That's because the memory fluctuates. Sometimes it may increase (or even decrease!) due to how the OS handles memory, the Python's garbage collector, the fact that RSS is an approximation and who knows what else. So thus far we tried to compensate that by using the following logic: - warmup (call fun 10 times) - call the function many times (1000) - if memory increased before/after calling function 1000 times, then keep calling it for another 3 secs - if it still increased at all (> 0) then fail This logic didn't really solve the problem, as we still had occasional false positives, especially lately on FreeBSD. The solution ========= This PR changes the internal algorithm so that in case of failure (mem > 0 after calling fun() N times) we retry the test for up to 5 times, increasing N (repetitions) each time, so we consider it a failure only if the memory **keeps increasing** between runs. So for instance, here's a legitimate failure: ``` psutil.tests.test_memory_leaks.TestModuleFunctionsLeaks.test_disk_partitions ... Run #1: extra-mem=696.0K, per-call=3.5K, calls=200 Run #2: extra-mem=1.4M, per-call=3.5K, calls=400 Run #3: extra-mem=2.1M, per-call=3.5K, calls=600 Run #4: extra-mem=2.7M, per-call=3.5K, calls=800 Run #5: extra-mem=3.4M, per-call=3.5K, calls=1000 FAIL ``` If, on the other hand, the memory increased on one run (say 200 calls) but decreased on the next run (say 400 calls), then it clearly means it's a false positive, because memory consumption may be > 0 on second run, but if it's lower than the previous run with less repetitions, then it cannot possibly represent a leak (just a fluctuation): ``` psutil.tests.test_memory_leaks.TestModuleFunctionsLeaks.test_net_connections ... Run #1: extra-mem=568.0K, per-call=2.8K, calls=200 Run #2: extra-mem=24.0K, per-call=61.4B, calls=400 OK ``` Note about mallinfo() ================ Aka #1275. `mallinfo()` on Linux is supposed to provide memory metrics about how many bytes gets allocated on the heap by `malloc()`, so it's supposed to be way more precise than RSS and also [USS](http://grodola.blogspot.com/2016/02/psutil-4-real-process-memory-and-environ.html). In another branch were I exposed it, I verified that fluctuations still occur even when using `mallinfo()` though, despite less often. So that means even `mallinfo()` would not grant 100% stability.