jenkins-bot has submitted this change and it was merged.
Change subject: Prevent hang in LiveRCPageGenerator
......................................................................
Prevent hang in LiveRCPageGenerator
The socketio client is being disconnected, but continues to poll
for new items indefinitely.
Detect disconnection and stop polling, making LiveRCPageGenerator
fail to fetch the requested total number of items instead of
stalling.
Correct item counter so that the thread quits after total
instead of total+1, reducing the chance of a disconnect.
These changes allows other tests to run after the disconnection,
lowering the impact and frequency of this bug.
Bug: T85717
Change-Id: I0748938b5fbe22a70e032f909c61d3c5bd2b7034
---
M pywikibot/comms/rcstream.py
1 file changed, 5 insertions(+), 5 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
XZise: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/pywikibot/comms/rcstream.py b/pywikibot/comms/rcstream.py
index f3282ac..7b4ea73 100644
--- a/pywikibot/comms/rcstream.py
+++ b/pywikibot/comms/rcstream.py
@@ -85,10 +85,6 @@
debug('Received change %r' % change, _logger)
thread.count += 1
- if thread.total is not None and thread.count > thread.total:
- thread.stop()
- return
-
thread.queue.put(change)
if thread.queue.qsize() > thread.warn_queue_length:
warning('%r queue length exceeded %i'
@@ -96,6 +92,10 @@
thread.warn_queue_length),
_logger=_logger)
thread.warn_queue_length = thread.warn_queue_length + 100
+
+ if thread.total is not None and thread.count >= thread.total:
+ thread.stop()
+ return
def on_connect(self):
debug('Connected to %r; subscribing to %s'
@@ -115,7 +115,7 @@
def run(self):
""" Threaded function. Runs insided the thread when started with
.start(). """
self.running = True
- while self.running:
+ while self.running and self.client.connected:
self.client.wait(seconds=0.1)
debug('Shut down event loop for %r' % self, _logger)
self.client.disconnect()
--
To view, visit https://gerrit.wikimedia.org/r/184285
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0748938b5fbe22a70e032f909c61d3c5bd2b7034
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>
Gerrit-Reviewer: Gerrit Patch Uploader <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: XZise <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits