smart test crashed with "TypeError: 'int' object is not iterable"

Bug #1421080 reported by Po-Hsu Lin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Checkbox Provider - Base
Fix Released
High
Daniel Manrique

Bug Description

CID: 201211-12073

This system comes with a hybrid SSD, 500 GB HDD as sda, 32 GB SSD as sdb

But the smart job would crash on sdb with the following error message:
-------------------------------[ disk/smart_sdb ]-------------------------------
ID: 2013.com.canonical.certification::disk/smart_sdb
Category: 2013.com.canonical.plainbox::uncategorised
... 8< -------------------------------------------------------------------------
INFO Starting SMART self-test on /dev/sdb
Traceback (most recent call last):
  File "/tmp/nest-q84hanvt.cdb7e37bc62a6361c854bc34da09075b9025db46edcacd0183c5e8766cc104f0/disk_smart", line 321, in <module>
    sys.exit(main())
  File "/tmp/nest-q84hanvt.cdb7e37bc62a6361c854bc34da09075b9025db46edcacd0183c5e8766cc104f0/disk_smart", line 305, in main
    status, returncode = poll_for_status(args, disk, previous_entries)
TypeError: 'int' object is not iterable
------------------------------------------------------------------------- >8 ---
Outcome: job failed

Reproduce rate: 2 out of 2
Also, the extended SMART test from Disks utility works fine on it.

Version information:
root@201211-12073:~$ apt-cache policy checkbox
checkbox:
  Installed: 0.17.10+bzr2829+pkg77+legacy1~ubuntu14.04.1
  Candidate: 0.17.10+bzr2829+pkg77+legacy1~ubuntu14.04.1
  Version table:
 *** 0.17.10+bzr2829+pkg77+legacy1~ubuntu14.04.1 0
        500 http://ppa.launchpad.net/checkbox-dev/ppa/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status
     0.17.6-0ubuntu6 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
root@201211-12073:~$ apt-cache policy plainbox
plainbox:
  Installed: 0.20+bzr3573+pkg24~ubuntu14.04.1
  Candidate: 0.20+bzr3573+pkg24~ubuntu14.04.1
  Version table:
 *** 0.20+bzr3573+pkg24~ubuntu14.04.1 0
        500 http://ppa.launchpad.net/checkbox-dev/ppa/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status
     0.5.3-2 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
root@201211-12073:~$ plainbox dev list provider
provider '2013.com.canonical.certification:certification-client'
provider '2013.com.canonical.certification:checkbox'
provider '2013.com.canonical.certification:plainbox-resources'

Tags: scripts

Related branches

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :
Revision history for this message
Daniel Manrique (roadmr) wrote :

Hi Sam,

Could you do the following on the affected system?

sudo smartctl -t short /dev/sdb

wait 1 minute, then

sudo smartctl -l selftest /dev/sdb | tee /tmp/smartctl-sdb.log

then please attach the /tmp/smartctl-sdb.log file.

Anyway, my theory is that poll_for_status is having trouble and returning 1 (there's only one place in the method where it could return 1, everywhere else it will return a status and return code). So perhaps the fix (if you want to try it) would be this patch:
--- providers/plainbox-provider-checkbox/bin/disk_smart 2014-11-13 13:19:44 +0000
+++ providers/plainbox-provider-checkbox/bin/disk_smart 2015-02-12 14:54:08 +0000
@@ -234,7 +234,7 @@
         if args.timeout is not None:
             if args.timeout <= 0:
                 logging.debug('Polling timed out')
- return 1
+ return "Polling timed out", 1
             else:
                 args.timeout -= args.sleep

If you apply the patch, you could just plainbox run -i 2013.com.canonical.certification::disk/smart_sdb to test it again.

I'll set to incomplete pending your reply but I'm pretty sure this is the problem.

Changed in plainbox-provider-checkbox:
status: New → Incomplete
importance: Undecided → High
Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

Hi Daniel,
hmm... ok, it seems that it does not support selftest on this SSD, combined with the return issue make it crash.

ubuntu@201211-12073:~$ cat /tmp/smartctl-sdb.log
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-45-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART Self-test Log not supported

ubuntu@201211-12073:~$

With the tweak implemented, it will fail correctly instead of hitting the wall.
-------------------------------[ disk/smart_sdb ]-------------------------------
ID: 2013.com.canonical.certification::disk/smart_sdb
Category: 2013.com.canonical.plainbox::uncategorised
... 8< -------------------------------------------------------------------------
INFO Starting SMART self-test on /dev/sdb
ERROR FAIL: SMART Self-Test appears to have failed for some reason. Run 'sudo smartctl -l selftest /dev/sdb' to see the SMART log
------------------------------------------------------------------------- >8 ---
Outcome: job failed

Thanks!

Changed in plainbox-provider-checkbox:
status: Incomplete → Confirmed
Revision history for this message
Daniel Manrique (roadmr) wrote :

OK, If the self-test log is not supported by the hardware, I think the correct fix is to modify the return value from the function so the test doesn't crash, but reports the lack of support. I'll propose the fix.

Daniel Manrique (roadmr)
Changed in plainbox-provider-checkbox:
milestone: none → 0.19
status: Confirmed → In Progress
assignee: nobody → Daniel Manrique (roadmr)
Changed in plainbox-provider-checkbox:
status: In Progress → Fix Committed
Changed in plainbox-provider-checkbox:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.