mirror of https://github.com/python/cpython
gh-110693: Use a Larger Queue for Per-Interpreter Pending Calls (gh-118302)
This is an improvement over the status quo, reducing the likelihood of completely filling the pending calls queue. However, the problem won't go away completely unless we move to an unbounded linked list or add a mechanism for waiting until the queue isn't full.
This commit is contained in:
parent
194fd17bc6
commit
1d33925176
|
@ -20,7 +20,7 @@ struct _pending_call {
|
||||||
int flags;
|
int flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PENDINGCALLSARRAYSIZE 32
|
#define PENDINGCALLSARRAYSIZE 300
|
||||||
|
|
||||||
#define MAXPENDINGCALLS PENDINGCALLSARRAYSIZE
|
#define MAXPENDINGCALLS PENDINGCALLSARRAYSIZE
|
||||||
/* For interpreter-level pending calls, we want to avoid spending too
|
/* For interpreter-level pending calls, we want to avoid spending too
|
||||||
|
@ -31,7 +31,9 @@ struct _pending_call {
|
||||||
# define MAXPENDINGCALLSLOOP MAXPENDINGCALLS
|
# define MAXPENDINGCALLSLOOP MAXPENDINGCALLS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAXPENDINGCALLS_MAIN PENDINGCALLSARRAYSIZE
|
/* We keep the number small to preserve as much compatibility
|
||||||
|
as possible with earlier versions. */
|
||||||
|
#define MAXPENDINGCALLS_MAIN 32
|
||||||
/* For the main thread, we want to make sure all pending calls are
|
/* For the main thread, we want to make sure all pending calls are
|
||||||
run at once, for the sake of prompt signal handling. This is
|
run at once, for the sake of prompt signal handling. This is
|
||||||
unlikely to cause any problems since there should be very few
|
unlikely to cause any problems since there should be very few
|
||||||
|
|
|
@ -1570,9 +1570,9 @@ class TestPendingCalls(unittest.TestCase):
|
||||||
self.assertEqual(added, maxpending)
|
self.assertEqual(added, maxpending)
|
||||||
|
|
||||||
with self.subTest('not main-only'):
|
with self.subTest('not main-only'):
|
||||||
# Per-interpreter pending calls has the same low limit
|
# Per-interpreter pending calls has a much higher limit
|
||||||
# on how many may be pending at a time.
|
# on how many may be pending at a time.
|
||||||
maxpending = 32
|
maxpending = 300
|
||||||
|
|
||||||
l = []
|
l = []
|
||||||
added = self.pendingcalls_submit(l, 1, main=False)
|
added = self.pendingcalls_submit(l, 1, main=False)
|
||||||
|
|
Loading…
Reference in New Issue