summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsylvainduchesne <35115147+sylvainduchesne@users.noreply.github.com>2018-09-26 14:35:12 -0400
committerGiampaolo Rodola <g.rodola@gmail.com>2018-09-26 20:35:12 +0200
commit1d7516c10cc89c60b8b5607ff9656d2f817b22b1 (patch)
tree968d4b152b8dba2c4ad10f02bb77ede448fa3dfb
parent7be5d9c6a1d829c60855edec6543039db6316631 (diff)
downloadpsutil-1d7516c10cc89c60b8b5607ff9656d2f817b22b1.tar.gz
Fix random 0xC0000001 errors when querying for Connections (#1335)
Fix random 0xC0000001 errors when querying for Connections (#1335)
-rw-r--r--CREDITS2
-rw-r--r--HISTORY.rst4
-rw-r--r--psutil/_psutil_windows.c14
3 files changed, 10 insertions, 10 deletions
diff --git a/CREDITS b/CREDITS
index 8df9090f..bfb68627 100644
--- a/CREDITS
+++ b/CREDITS
@@ -548,7 +548,7 @@ N: Alex Manuskin
W: https://github.com/amanusk
I: 1284
-N: sylvainduchesne
+N: Sylvain Duchesne
W: https://github.com/sylvainduchesne
I: 1294
diff --git a/HISTORY.rst b/HISTORY.rst
index 0b6f3852..0c79a30a 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -9,7 +9,9 @@ XXXX-XX-XX
- 1332_: psutil debug messages are erroneously printed all the time. (patch by
yanok)
-
+- 1294_: [Windows] psutil.Process().connections() may sometimes fail with
+ intermittent 0xC0000001. (patch by Sylvain Duchesne)
+
5.4.7
=====
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c
index 1d44dd0b..4acea360 100644
--- a/psutil/_psutil_windows.c
+++ b/psutil/_psutil_windows.c
@@ -1530,15 +1530,14 @@ static DWORD __GetExtendedTcpTable(_GetExtendedTcpTable call,
// that the size of the table increases between the moment where we
// query the size and the moment where we query the data. Therefore, it's
// important to call this in a loop to retry if that happens.
- //
- // Also, since we may loop a theoretically unbounded number of times here,
- // release the GIL while we're doing this.
+ // See https://github.com/giampaolo/psutil/pull/1335 concerning 0xC0000001 error
+ // and https://github.com/giampaolo/psutil/issues/1294
DWORD error = ERROR_INSUFFICIENT_BUFFER;
*size = 0;
*data = NULL;
error = call(NULL, size, FALSE, address_family,
TCP_TABLE_OWNER_PID_ALL, 0);
- while (error == ERROR_INSUFFICIENT_BUFFER)
+ while (error == ERROR_INSUFFICIENT_BUFFER || error == 0xC0000001)
{
*data = malloc(*size);
if (*data == NULL) {
@@ -1569,15 +1568,14 @@ static DWORD __GetExtendedUdpTable(_GetExtendedUdpTable call,
// that the size of the table increases between the moment where we
// query the size and the moment where we query the data. Therefore, it's
// important to call this in a loop to retry if that happens.
- //
- // Also, since we may loop a theoretically unbounded number of times here,
- // release the GIL while we're doing this.
+ // See https://github.com/giampaolo/psutil/pull/1335 concerning 0xC0000001 error
+ // and https://github.com/giampaolo/psutil/issues/1294
DWORD error = ERROR_INSUFFICIENT_BUFFER;
*size = 0;
*data = NULL;
error = call(NULL, size, FALSE, address_family,
UDP_TABLE_OWNER_PID, 0);
- while (error == ERROR_INSUFFICIENT_BUFFER)
+ while (error == ERROR_INSUFFICIENT_BUFFER || error == 0xC0000001)
{
*data = malloc(*size);
if (*data == NULL) {