[Patchew-devel] [PATCH] nginx: bump client_max_body_size

Paolo Bonzini posted 1 patch 5 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/patchew next tags/patchew/20190124072804.9622-1-pbonzini@redhat.com
scripts/patchew-server.nginx.conf | 1 +
1 file changed, 1 insertion(+)
[Patchew-devel] [PATCH] nginx: bump client_max_body_size
Posted by Paolo Bonzini 5 years, 2 months ago
Avoid problems when logs are too large.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/patchew-server.nginx.conf | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/patchew-server.nginx.conf b/scripts/patchew-server.nginx.conf
index dbac28f..88b7adb 100644
--- a/scripts/patchew-server.nginx.conf
+++ b/scripts/patchew-server.nginx.conf
@@ -40,6 +40,7 @@ http {
     server_name _ .patchew.org;
 
     keepalive_timeout 5;
+    client_max_body_size 100M;
 
     location = /favicon.ico {
         alias /opt/patchew/static/favicon.ico;
-- 
2.20.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel
[Patchew-devel] [PATCH] patchew-tester: truncate logs if they are too large
Posted by Paolo Bonzini 5 years, 2 months ago
If the logs are too large for the server, the tester loops forever on the same test.
Instead, trap 413 errors (request entity too large) and truncate the log to a smaller
amount of data.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 patchew-cli | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/patchew-cli b/patchew-cli
index 430dbe3..b2d0bbb 100755
--- a/patchew-cli
+++ b/patchew-cli
@@ -577,15 +577,32 @@ class TesterCommand(SubCommand):
                     log = "N/A. Internal error while reading log file\n"
                 print("  Result:", "Passed" if passed else "Failed")
                 logging.debug(log)
-                self.api_do("testing-report", project=r["project"],
-                                              identity=r["identity"],
-                                              test=r["test"]["name"],
-                                              tester=name,
-                                              head=r["head"],
-                                              base=r["base"],
-                                              passed=passed,
-                                              log=log,
-                                              is_timeout=is_timeout)
+                max_size = 100000000
+                prefixed = False
+                orig_log_size = len(log)
+                while max_size > 100000:
+                    try:
+                        self.api_do("testing-report", project=r["project"],
+                                                      identity=r["identity"],
+                                                      test=r["test"]["name"],
+                                                      tester=name,
+                                                      head=r["head"],
+                                                      base=r["base"],
+                                                      passed=passed,
+                                                      log=log,
+                                                      is_timeout=is_timeout)
+                    except error.HTTPError as e:
+                        if e.code != 413:
+                            raise e
+                        if not prefixed:
+                            prefixed = True
+                            log = 'WARNING: Log truncated!\n\n' + log
+                        log = log[:max_size]
+                        max_size = max_size / 10
+                    else:
+                        break
+                if prefixed:
+                    print("Log truncated from %d to %d bytes" % {orig_log_size, len(log)})
                 logf.close()
             finally:
                 if not no_clean_up:
-- 
2.20.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel
[Patchew-devel] [PATCH] patchew-tester: flush stdout after retrieving the patch
Posted by Paolo Bonzini 5 years, 2 months ago
This shows in the logs what is failing.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 patchew-cli | 1 +
 1 file changed, 1 insertion(+)

diff --git a/patchew-cli b/patchew-cli
index 0d89528..430dbe3 100755
--- a/patchew-cli
+++ b/patchew-cli
@@ -510,6 +510,7 @@ class TesterCommand(SubCommand):
         print("  Workdir:", wd)
         print("  Project:", r["project"])
         print("  Identity:", str(r["identity"]))
+        sys.stdout.flush()
         logf = open(os.path.join(wd, "log"), "w+", encoding="utf-8",
                     newline='', errors="ignore")
         test_cmd = r["test"]["script"]
-- 
2.20.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel