| Commit message (Collapse) | Author | Age | Files | Lines | |
|---|---|---|---|---|---|
| * | update devguide | Giampaolo Rodola | 2020-11-14 | 1 | -128/+61 |
| | | |||||
| * | re-enable pypy | Giampaolo Rodola | 2020-11-08 | 1 | -3/+5 |
| | | |||||
| * | Merge branch 'master' into prlimit | Giampaolo Rodola | 2020-11-05 | 1 | -1/+1 |
| |\ | |||||
| | * | Fix definition of RPM (#1870) | Christopher Hewett | 2020-11-04 | 1 | -1/+1 |
| | | | | | | | RPM is actually revolutions per minute, current docs say its rounds per minute | ||||
| * | | update doc | Giampaolo Rodola | 2020-10-31 | 1 | -3/+45 |
| |/ | |||||
| * | disk_partitions() maxfile and maxpath (#1863) | Giampaolo Rodola | 2020-10-24 | 1 | -11/+19 |
| | | |||||
| * | pre release | Giampaolo Rodola | 2020-10-23 | 1 | -1/+5 |
| | | |||||
| * | [FreeBSD] process resource limits (#1859) (#809) | Giampaolo Rodola | 2020-10-23 | 2 | -38/+49 |
| | | |||||
| * | fix #1855 doc | Giampaolo Rodola | 2020-10-19 | 1 | -1/+4 |
| | | |||||
| * | add sponsors in doc | Giampaolo Rodola | 2020-10-18 | 1 | -16/+45 |
| | | |||||
| * | Update README (#1854) | Giampaolo Rodola | 2020-10-18 | 2 | -0/+0 |
| | | |||||
| * | Fix labeling in Process cpu_times() documentation (#1853) | kellurs | 2020-10-15 | 1 | -1/+1 |
| | | | | Changed system_user to children_system to match the named tupple and expected behaviour. Change description to match. | ||||
| * | Update index.rst (#1835) | Piotr Dworzynski | 2020-10-09 | 1 | -1/+1 |
| | | | | Fixed typo in documentation of user.name attribute. | ||||
| * | update doc for #1830 (net_if_stats() isup check if NIC is running) | Giampaolo Rodola | 2020-09-21 | 1 | -1/+3 |
| | | |||||
| * | give CREDITS for #1800 / @ArminGrunner | Giampaolo Rodola | 2020-08-13 | 1 | -2/+1 |
| | | |||||
| * | pre-releaserelease-5.7.2 | Giampaolo Rodola | 2020-07-15 | 1 | -0/+1 |
| | | |||||
| * | pre-release | Giampaolo Rodola | 2020-07-15 | 1 | -0/+4 |
| | | |||||
| * | pre-releaserelease-5.7.1 | Giampaolo Rodola | 2020-07-15 | 1 | -0/+4 |
| | | |||||
| * | update personal site URL | Giampaolo Rodola | 2020-06-16 | 1 | -3/+3 |
| | | |||||
| * | update doc | Giampaolo Rodola | 2020-06-10 | 1 | -5/+6 |
| | | |||||
| * | Memory leak test: take fluctuations into account (#1757) | Giampaolo Rodola | 2020-05-13 | 1 | -12/+12 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. | ||||
| * | Process wait() improvements (#1747) | Giampaolo Rodola | 2020-05-03 | 2 | -19/+35 |
| | | | | | | | | | | | | | | | | | | | | | | | * `Process.wait()` on POSIX now returns an `enum` showing the negative which was used to terminate the process: ```python >>> import psutil >>> p = psutil.Process(9891) >>> p.terminate() >>> p.wait() <Negsignal.SIGTERM: -15> ``` * the return value is cached so that the exit code can be retrieved on then next call, mimicking `subprocess.Popen.wait()` * `Process` object provides more `status` and `exitcode` additional info on `str()` and `repr()`: ``` >>> proc psutil.Process(pid=12739, name='python3', status='terminated', exitcode=<Negsigs.SIGTERM: -15>, started='15:08:20') ``` Extra: * improved `wait()` doc * reverted #1736: `psutil.Popen` uses original `subprocess.Popen.wait` method (safer) | ||||
| * | Revert #1736: Popen inheriting from subprocess (#1744) | Giampaolo Rodola | 2020-05-01 | 1 | -34/+13 |
| | | |||||
| * | psutil.Popen: inherit from subprocess + support wait(timeout=...) parameter ↵ | Giampaolo Rodola | 2020-04-28 | 1 | -12/+15 |
| | | | | | (#1736) | ||||
| * | Parallel tests (UNIX) (#1709) | Giampaolo Rodola | 2020-04-26 | 1 | -6/+7 |
| | | |||||
| * | sensors_fans is not available on MacOS (#1710) | crusaderky | 2020-03-04 | 1 | -1/+1 |
| | | |||||
| * | Git hook for renamed/added/deleted files + flake8 print() + tidelift (#1704) | Giampaolo Rodola | 2020-02-21 | 1 | -2/+1 |
| | | |||||
| * | Add C linter script (#1698) | Giampaolo Rodola | 2020-02-18 | 2 | -1/+5 |
| | | |||||
| * | revert process_iter() exactly how it was pre #1667 | Giampaolo Rodola | 2020-02-18 | 1 | -2/+3 |
| | | |||||
| * | revert #1667 process_iter() new_only param | Giampaolo Rodola | 2020-02-18 | 1 | -12/+1 |
| | | | | | | | | | | | On a second thought I realized that process_iter() uses a global variable, so it's not thread safe. That means that if the are 2 threads using it, the first thread one calling the function (+ consume the iterator), will "steal" the processes of the second thread. psutil.cpu_percent() has the same problem. That means we have a problem can't solve with the current API and requires a lot of thinking on how to solve it as it's not obvious. | ||||
| * | refactor print colors utils | Giampaolo Rodola | 2020-02-15 | 1 | -0/+7 |
| | | |||||
| * | update doc | Giampaolo Rodola | 2020-02-15 | 1 | -0/+3 |
| | | |||||
| * | update doc | Giampaolo Rodola | 2020-02-15 | 1 | -3/+3 |
| | | |||||
| * | update doc | Giampaolo Rodola | 2020-02-15 | 1 | -10/+10 |
| | | |||||
| * | update doc | Giampaolo Rodola | 2020-02-15 | 1 | -27/+18 |
| | | |||||
| * | #1681, revert 00a3398 | Giampaolo Rodola | 2020-02-13 | 1 | -2/+0 |
| | | |||||
| * | refactor doc | Giampaolo Rodola | 2020-02-12 | 4 | -166/+47 |
| | | |||||
| * | small refact | Giampaolo Rodola | 2020-02-11 | 1 | -1/+1 |
| | | |||||
| * | fix #1681 / linux / disk_partitions: show swap | Giampaolo Rodola | 2020-02-11 | 1 | -0/+2 |
| | | |||||
| * | skip memleak tests on PyPy: they are unreliable probably because of the JIT | Giampaolo Rodola | 2020-02-10 | 1 | -2/+2 |
| | | |||||
| * | update doc | Giampaolo Rodola | 2020-02-07 | 1 | -1/+1 |
| | | |||||
| * | #1610: clarify in the doc what cpu_count means | Giampaolo Rodola | 2020-02-04 | 1 | -2/+4 |
| | | |||||
| * | [Windows] use NtQuerySystemInformation to determine process exe() (#1677) | Giampaolo Rodola | 2020-02-01 | 1 | -2/+2 |
| | | |||||
| * | Add CI testing for FreeBSD (#1671) | Giampaolo Rodola | 2020-01-24 | 1 | -0/+4 |
| | | |||||
| * | Add *new_only* parameter for process_iter() (#1667) | Giampaolo Rodola | 2020-01-18 | 1 | -20/+15 |
| | | |||||
| * | #1020: remove doc part mentionin open_files() on win is only able to list ↵ | Giampaolo Rodola | 2020-01-09 | 1 | -4/+3 |
| | | | | | files living on the C drive | ||||
| * | #1652: also drop support for Windows Server 2003 | Giampaolo Rodola | 2020-01-02 | 1 | -3/+2 |
| | | |||||
| * | Merge branch 'master' of github.com:giampaolo/psutil | Giampaolo Rodola | 2020-01-02 | 1 | -2/+2 |
| |\ | |||||
| | * | Drop windows XP support (#1652) | Giampaolo Rodola | 2020-01-01 | 1 | -2/+2 |
| | | | | | | | | | minimum supported now is Windows Vista | ||||
| * | | update/fix wait_procs() doc | Giampaolo Rodola | 2019-12-29 | 1 | -3/+3 |
| |/ | |||||
