Fri, 31 Mar 2017 17:29:55 +0200
Corrected an issue in various checker services that caused them to block, if an exception was thrown in a checker class.
--- a/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py Fri Mar 31 17:28:12 2017 +0200 +++ b/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py Fri Mar 31 17:29:55 2017 +0200 @@ -9,6 +9,7 @@ import sys import multiprocessing +import queue import pycodestyle from NamingStyleChecker import NamingStyleChecker @@ -18,7 +19,6 @@ from DocStyleChecker import DocStyleChecker from MiscellaneousChecker import MiscellaneousChecker -# TODO: rename the following module from ComplexityChecker import ComplexityChecker @@ -154,11 +154,25 @@ # Get and send results endIndex = len(argumentsList) - initialTasks for i in range(len(argumentsList)): - filename, result = doneQueue.get() - send(fx, filename, result) - if cancelled(): + resultSent = False + wasCancelled = False + + while not resultSent: + try: + # get result (waiting max. 3 seconds and send it to frontend + filename, result = doneQueue.get(timeout=3) + send(fx, filename, result) + resultSent = True + except queue.Empty: + # ignore empty queue, just carry on + if cancelled(): + wasCancelled = True + break + + if wasCancelled or cancelled(): # just exit the loop ignoring the results of queued tasks break + if i < endIndex: taskQueue.put(argumentsList[i + initialTasks])
--- a/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py Fri Mar 31 17:28:12 2017 +0200 +++ b/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py Fri Mar 31 17:29:55 2017 +0200 @@ -13,6 +13,7 @@ import sys import traceback import multiprocessing +import queue try: from pyflakes.checker import Checker @@ -147,11 +148,25 @@ # Get and send results endIndex = len(argumentsList) - initialTasks for i in range(len(argumentsList)): - filename, result = doneQueue.get() - send(fx, filename, result) - if cancelled(): + resultSent = False + wasCancelled = False + + while not resultSent: + try: + # get result (waiting max. 3 seconds and send it to frontend + filename, result = doneQueue.get() + send(fx, filename, result) + resultSent = True + except queue.Empty: + # ignore empty queue, just carry on + if cancelled(): + wasCancelled = True + break + + if wasCancelled or cancelled(): # just exit the loop ignoring the results of queued tasks break + if i < endIndex: taskQueue.put(argumentsList[i + initialTasks])
--- a/Plugins/CheckerPlugins/SyntaxChecker/jsCheckSyntax.py Fri Mar 31 17:28:12 2017 +0200 +++ b/Plugins/CheckerPlugins/SyntaxChecker/jsCheckSyntax.py Fri Mar 31 17:29:55 2017 +0200 @@ -13,6 +13,7 @@ import os import sys import multiprocessing +import queue def initService(): @@ -108,11 +109,25 @@ # Get and send results endIndex = len(argumentsList) - initialTasks for i in range(len(argumentsList)): - filename, result = doneQueue.get() - send(fx, filename, result) - if cancelled(): + resultSent = False + wasCancelled = False + + while not resultSent: + try: + # get result (waiting max. 3 seconds and send it to frontend + filename, result = doneQueue.get() + send(fx, filename, result) + resultSent = True + except queue.Empty: + # ignore empty queue, just carry on + if cancelled(): + wasCancelled = True + break + + if wasCancelled or cancelled(): # just exit the loop ignoring the results of queued tasks break + if i < endIndex: taskQueue.put(argumentsList[i + initialTasks])
--- a/Plugins/CheckerPlugins/Tabnanny/Tabnanny.py Fri Mar 31 17:28:12 2017 +0200 +++ b/Plugins/CheckerPlugins/Tabnanny/Tabnanny.py Fri Mar 31 17:29:55 2017 +0200 @@ -49,6 +49,7 @@ except (ImportError): import io # __IGNORE_WARNING__ import multiprocessing +import queue if not hasattr(tokenize, 'NL'): raise ValueError("tokenize.NL doesn't exist -- tokenize module too old") @@ -165,11 +166,25 @@ # Get and send results endIndex = len(argumentsList) - initialTasks for i in range(len(argumentsList)): - filename, result = doneQueue.get() - send(fx, filename, result) - if cancelled(): + resultSent = False + wasCancelled = False + + while not resultSent: + try: + # get result (waiting max. 3 seconds and send it to frontend + filename, result = doneQueue.get() + send(fx, filename, result) + resultSent = True + except queue.Empty: + # ignore empty queue, just carry on + if cancelled(): + wasCancelled = True + break + + if wasCancelled or cancelled(): # just exit the loop ignoring the results of queued tasks break + if i < endIndex: taskQueue.put(argumentsList[i + initialTasks])