diff --git a/CHANGES.txt b/CHANGES.txt index 7d8106be2..bd5a4712d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -16,6 +16,7 @@ - proper assembly coloring in the MetaQUAST HTML report for more than 14 assemblies; - catching the Krona charts crashes prematurely; - proper checking of user BED files in the read alignment mode; + - prevent crashes due to multi-threading on macOS and Python 3.8+ (switch to single-thread); - cosmetic changes in warning/error messages. 5. Documentation: diff --git a/quast_libs/log.py b/quast_libs/log.py index 469449357..446733e32 100644 --- a/quast_libs/log.py +++ b/quast_libs/log.py @@ -201,29 +201,11 @@ def error(self, message='', exit_with_code=0, to_stderr=False, indent='', fake_i self._num_nf_errors += 1 def exception(self, e, exit_code=0): - # FIXME: special case: handling the known bug of macOS & Python3.8+ & joblib - # see: https://github.com/ablab/quast/issues/175 - extra_message = '' - if type(e) == TypeError and 'NoneType' in str(e) and 'int' in str(e): - if qconfig.max_threads and qconfig.max_threads > 1 and qconfig.platform_name == 'macosx' and \ - sys.version_info.major == 3 and sys.version_info.minor >= 8: - extra_message = '\n\nThis seems to be a known bug when using multi-threading in Python 3.8+ on macOS!\n' \ - 'The current workarounds are\n' \ - ' to switch to single-thread execution (-t 1)\n' \ - 'or\n' \ - ' to downgrade your Python to 3.7 or below.\n' \ - 'Sorry for the inconvenience!\n' \ - 'Please find more details in https://github.com/ablab/quast/issues/175\n' - if self._logger.handlers: self._logger.error('') self._logger.exception(e) - if extra_message: - self._logger.info(extra_message) else: sys.stderr.write(str(e) + '\n') - if extra_message: - sys.stderr.write(extra_message + '\n') if exit_code: exit(exit_code) diff --git a/quast_libs/qconfig.py b/quast_libs/qconfig.py index 8983b487b..7f92b0d1a 100644 --- a/quast_libs/qconfig.py +++ b/quast_libs/qconfig.py @@ -314,6 +314,14 @@ def set_max_threads(logger): max_threads = DEFAULT_MAX_THREADS logger.notice('Maximum number of threads is set to ' + str(max_threads) + ' (use --threads option to set it manually)') + # FIXME: special case: handling the known bug of macOS & Python3.8+ & joblib + # see: https://github.com/ablab/quast/issues/175 + if max_threads > 1 and platform_name == 'macosx' and sys.version_info.major == 3 and sys.version_info.minor >= 8: + max_threads = 1 + logger.warning('Maximum number of threads is reset to 1 to prevent the crash ' + 'due to a known bug when using multi-threading in Python 3.8+ on macOS! ' + 'For multi-threading please downgrade your Python to 3.7. Sorry for the inconvenience! ' + 'Please find more details in https://github.com/ablab/quast/issues/175') def quast_version():