chiark / gitweb /
build: hard exit on success to avoid hanging
authorHans-Christoph Steiner <hans@eds.org>
Sat, 2 Dec 2017 12:24:13 +0000 (13:24 +0100)
committerHans-Christoph Steiner <hans@eds.org>
Sat, 2 Dec 2017 12:48:47 +0000 (13:48 +0100)
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

fdroidserver/build.py
fdroidserver/common.py

index 17d5cfd21ed0b4e0c03abd5906aa0a720ce01a97..8e59553e62404f8f9b90b4fe022245cacbd9f791 100644 (file)
@@ -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__":
index 6ed43d4c4e465eda49d752eb7ceea09d7eb6af5a..e7a1f1ece58ca159a8ffbe4f702d48e054c88efd 100644 (file)
@@ -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)