Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pybind: avoid "exception 'int' object is not iterable" #11532

Merged
merged 1 commit into from Oct 24, 2016

Conversation

javeme
Copy link
Contributor

@javeme javeme commented Oct 18, 2016

Run a command: ceph tell osd.0 pg 1.0 list_missing
If it's interrupted by CTRL+C, it would output a strange error message:
"exception 'int' object is not iterable".

The reason is the caller expects run_in_thread() to return a tuple, but
it returns an int. this patch we fix the bug, then it would just output
a message like: "Error EINTR: Interrupted!"

Detailed error message:
Traceback (most recent call last):
  File "./bin/ceph", line 949, in <module>
    retval = main()
  File "./bin/ceph", line 882, in main
    sigdict, inbuf, verbose)
  File "./bin/ceph", line 480, in new_style_command
    inbuf=inbuf)
  File "ceph/src/pybind/ceph_argparse.py", line 1334, in
json_command
    raise RuntimeError('"{0}": exception {1}'.format(argdict, e))
RuntimeError: "{'prefix': u'pg', u'cmd': u'list_missing', u'pgid':
u'1.0'}": exception "['{"prefix": "pg", "cmd": "list_missing", "pgid":
"1.0"}']": exception 'int' object is not iterable

Signed-off-by: Javeme javaloveme@gmail.com

@javeme
Copy link
Contributor Author

javeme commented Oct 18, 2016

In addition, I'm not sure why this command "ceph tell osd.0 pg 1.0 list_missing" hangs up?

@javeme
Copy link
Contributor Author

javeme commented Oct 19, 2016

The failure of this test case "run-rbd-unit-tests" may be caused by issue #17566

@tchaikov
Copy link
Contributor

you commit title reads:

fix bug: exception 'int' object is not iterable

could you prefix it with the subcomponent your are changing ? see https://github.com/ceph/ceph/blob/master/SubmittingPatches.rst#preparing-and-sending-patches, in this case, it could be "pybind: "

and it would be ideal if you can be more concise when describing the change, i'd recommend something like:

pybind: return a tuple in run_in_thread() if interrupted

<describe the change in more detail>

Callers expect run_in_thread() to return a tuple, but it
returns an int. When interrupt the function it would raise
an iterable exception.

This patch fix the bug, and it would just output a message
like: "Error EINTR: Interrupted!"

Signed-off-by: Javeme <javaloveme@gmail.com>
@javeme
Copy link
Contributor Author

javeme commented Oct 20, 2016

@tchaikov Thank you! I have updated the commit message.

@tchaikov
Copy link
Contributor

lgtm.

@tchaikov
Copy link
Contributor

@tchaikov tchaikov merged commit 57ed9c5 into ceph:master Oct 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants