Project

General

Profile

Actions

Bug #17310

closed

image.stat() call in librbdpy fails sometimes

Added by Jens Harbott over 7 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
High
Assignee:
Jason Dillaman
Target version:
-
% Done:

0%

Source:
Community (user)
Tags:
Backport:
jewel,hammer
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

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 2 (0 open2 closed)

Copied to rbd - Backport #17373: jewel: image.stat() call in librbdpy fails sometimesResolvedLoïc DacharyActions
Copied to rbd - Backport #17374: hammer: image.stat() call in librbdpy fails sometimesResolvedNathan CutlerActions
Actions #1

Updated by Jason Dillaman over 7 years ago

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

Updated by Jason Dillaman over 7 years ago

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

Updated by Jason Dillaman over 7 years ago

  • Status changed from In Progress to Fix Under Review
Actions #4

Updated by Jason Dillaman over 7 years ago

  • Priority changed from Urgent to High
Actions #5

Updated by Mykola Golub over 7 years ago

  • Status changed from Fix Under Review to Pending Backport
Actions #6

Updated by Nathan Cutler over 7 years ago

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

Updated by Nathan Cutler over 7 years ago

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

Updated by Nathan Cutler over 7 years ago

  • Status changed from Pending Backport to Resolved
Actions

Also available in: Atom PDF