From: Hans-Christoph Steiner Date: Sat, 2 Dec 2017 12:24:13 +0000 (+0100) Subject: build: hard exit on success to avoid hanging X-Git-Tag: 1.0.0~55 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=b8ed892ad9ed7e125278bc41ce5545a9d0c57994;p=fdroidserver.git build: hard exit on success to avoid hanging Something is preventing `fdroid build --all` from exiting after a long run. @bubu, @uniqx and I think it is because of the use of AsynchronousFileReader, somehow it's thread does not exit. So the workaround for now is to just try a hard exit instead of waiting for things to finish cleanly with `sys.exit(0)`. https://jenkins.debian.net/job/reproducible_fdroid_build_apps/94/console --- diff --git a/fdroidserver/build.py b/fdroidserver/build.py index 17d5cfd2..8e59553e 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -1345,7 +1345,10 @@ def main(): logging.info(ngettext("{} build failed", "{} builds failed", len(failed_apps)).format(len(failed_apps))) - sys.exit(0) + # hack to ensure this exits, even is some threads are still running + sys.stdout.flush() + sys.stderr.flush() + os._exit(0) if __name__ == "__main__": diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 6ed43d4c..e7a1f1ec 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -1970,6 +1970,7 @@ def FDroidPopenBytes(commands, cwd=None, envs=None, output=True, stderr_to_stdou raise BuildException("OSError while trying to execute " + ' '.join(commands) + ': ' + str(e)) + # TODO are these AsynchronousFileReader threads always exiting? if not stderr_to_stdout and options.verbose: stderr_queue = Queue() stderr_reader = AsynchronousFileReader(p.stderr, stderr_queue)