← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] autopkgtest-cloud:len-if-not-null into autopkgtest-cloud:master

 

Brian Murray has proposed merging autopkgtest-cloud:len-if-not-null into autopkgtest-cloud:master.

Requested reviews:
  Canonical's Ubuntu QA (canonical-ubuntu-qa)

For more details, see:
https://code.launchpad.net/~ubuntu-release/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/463243

cache-amqp was failing to run on one of the autopkgtest-web servers and I saw this in the log / job status:

Mar 27 23:43:06 juju-7f2275-prod-proposed-migration-environment-1 cache-amqp[1870712]: 2024-03-27 23:43:06: Received invalid request format "b'libbio-tools-run-alignment-clustalw-perl\n{"all>
Mar 27 23:43:06 juju-7f2275-prod-proposed-migration-environment-1 cache-amqp[1870712]: "
Mar 27 23:43:06 juju-7f2275-prod-proposed-migration-environment-1 cache-amqp[1870712]: Traceback (most recent call last):
Mar 27 23:43:06 juju-7f2275-prod-proposed-migration-environment-1 cache-amqp[1870712]:   File "/home/ubuntu/webcontrol/cache-amqp", line 281, in <module>
Mar 27 23:43:06 juju-7f2275-prod-proposed-migration-environment-1 cache-amqp[1870712]:     queue_contents = aq.get_queue_contents()
Mar 27 23:43:06 juju-7f2275-prod-proposed-migration-environment-1 cache-amqp[1870712]:   File "/home/ubuntu/webcontrol/cache-amqp", line 185, in get_queue_contents
Mar 27 23:43:06 juju-7f2275-prod-proposed-migration-environment-1 cache-amqp[1870712]:     queue_size = len(requests)
Mar 27 23:43:06 juju-7f2275-prod-proposed-migration-environment-1 cache-amqp[1870712]: TypeError: object of type 'NoneType' has no len()
Mar 27 23:43:06 juju-7f2275-prod-proposed-migration-environment-1 systemd[1]: cache-amqp.service: Main process exited, code=exited, status=1/FAILURE
Mar 27 23:43:06 juju-7f2275-prod-proposed-migration-environment-1 systemd[1]: cache-amqp.service: Failed with result 'exit-code'.
Mar 27 23:43:06 juju-7f2275-prod-proposed-migration-environment-1 systemd[1]: Failed to start Cache queue entries from AMQP.

This MP sorted out the Traceback with try to get the length of a NoneType object but it's possible there is something else wrong with get_queue_requests which sets the value of requests.
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of autopkgtest-cloud:len-if-not-null into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/webcontrol/cache-amqp b/charms/focal/autopkgtest-web/webcontrol/cache-amqp
index 6ebcfc5..6e87b8b 100755
--- a/charms/focal/autopkgtest-web/webcontrol/cache-amqp
+++ b/charms/focal/autopkgtest-web/webcontrol/cache-amqp
@@ -182,7 +182,9 @@ class AutopkgtestQueueContents:
                         requests = []
                         # 404s invalidate the channel for some reason
                         self.amqp_channel = self.amqp_con.channel()
-                    queue_size = len(requests)
+                    queue_size = 0
+                    if requests:
+                        queue_size = len(requests)
                     logging.info(
                         "Queue %s has %d items", queue_name, queue_size
                     )

Follow ups