Project

General

Profile

Bug #17310

image.stat() call in librbdpy fails sometimes

Added by Jens Harbott 11 months ago. Updated 9 months ago.

Status:
Resolved
Priority:
High
Target version:
-
Start date:
09/20/2016
Due date:
% Done:

0%

Source:
Community (user)
Tags:
Backport:
jewel,hammer
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Release:
jewel
Needs Doc:
No

Description

I'm running a simple test script to reproduce this:

import rados
import rbd
cluster = rados.Rados(conffile='/etc/ceph/ceph.conf')
cluster.connect()
ioctx = cluster.open_ioctx('images')
image = rbd.Image(ioctx, '41a6aadf-c655-49c8-b77d-eedd356f5349')
stat = image.stat()
print stat['size'] == image.size()
print stat['block_name_prefix']
print len(stat['block_name_prefix'])

and I am seeing varying results like

$ python test.py
Traceback (most recent call last):
  File "test.py", line 7, in <module>
    stat = image.stat()
  File "rbd.pyx", line 1124, in rbd.Image.stat (/build/ceph-XmVvyr/ceph-10.2.2/src/build/rbd.c:10803)
  File "rbd.pyx", line 433, in rbd.decode_cstr (/build/ceph-XmVvyr/ceph-10.2.2/src/build/rbd.c:2440)
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xaf in position 24: invalid start byte
$ python test.py
True
rbd_data.3d98fcf378d97c0(
26
$ python test.py
True
rbd_data.3d98fcf378d97c0|
26

Looking at the code in src/pybind/rbd/rbd.pyx it seems like decode_cstr(info.block_name_prefix) is being called assuming that block_name_prefix is a null-terminated string, which it isn't.


Related issues

Copied to rbd - Backport #17373: jewel: image.stat() call in librbdpy fails sometimes Resolved
Copied to rbd - Backport #17374: hammer: image.stat() call in librbdpy fails sometimes Resolved

History

#1 Updated by Jason Dillaman 11 months ago

  • Project changed from Ceph to rbd
  • Category deleted (libvirt)

#2 Updated by Jason Dillaman 11 months ago

  • Status changed from New to In Progress
  • Assignee set to Jason Dillaman
  • Backport set to jewel,hammer

#3 Updated by Jason Dillaman 11 months ago

  • Status changed from In Progress to Need Review

#4 Updated by Jason Dillaman 11 months ago

  • Priority changed from Urgent to High

#5 Updated by Mykola Golub 11 months ago

  • Status changed from Need Review to Pending Backport
  • Needs Doc set to No

#6 Updated by Nathan Cutler 11 months ago

  • Copied to Backport #17373: jewel: image.stat() call in librbdpy fails sometimes added

#7 Updated by Nathan Cutler 11 months ago

  • Copied to Backport #17374: hammer: image.stat() call in librbdpy fails sometimes added

#8 Updated by Nathan Cutler 9 months ago

  • Status changed from Pending Backport to Resolved

Also available in: Atom PDF