Bug 829767 - JSON serialization broken in F17
Summary: JSON serialization broken in F17
Keywords:
Status: ON_QA
Alias: None
Product: Gofer
Classification: Community
Component: python-gofer
Version: 0.66
Hardware: Unspecified
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Jeff Ortel
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-06-07 14:01 UTC by Jeff Ortel
Modified: 2012-06-08 22:26 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description Jeff Ortel 2012-06-07 14:01:13 UTC
The json serialization is broken on F17.  In F17, simplejson jumped to version 2.5.2 (from 2.16 in F16).  In 2.5.2, support for collections.namedtuples is added which intruduces the problem.  The encode() detects namedtuples by doing hasattr(o, '_asdict') and them blindly call it without doing a callable() check.  The gofer Envelope object overrides __getattr__() so hasattr() is True but then encode() tries to call None.

This trace can be seen in agent.log:

2012-06-06 15:06:05,537 [ERROR][Actions] __call__() @ action.py:129 - 'NoneType' object is not callable
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/gofer/agent/action.py", line 127, in __call__
    self.target()
  File "/usr/lib64/gofer/plugins/pulpplugin.py", line 94, in heartbeat
    return self.send()
  File "/usr/lib64/gofer/plugins/pulpplugin.py", line 105, in send
    p.send(topic, ttl=delay, heartbeat=body)
  File "/usr/lib/python2.7/site-packages/gofer/messaging/producer.py", line 49, in send
    json = envelope.dump()
  File "/usr/lib/python2.7/site-packages/gofer/messaging/__init__.py", line 80, in dump
    return json.dumps(d, indent=2)
  File "/usr/lib64/python2.7/site-packages/simplejson/__init__.py", line 296, in dumps
    **kw).encode(obj)
  File "/usr/lib64/python2.7/site-packages/simplejson/encoder.py", line 228, in encode
    chunks = list(chunks)
  File "/usr/lib64/python2.7/site-packages/simplejson/encoder.py", line 509, in _iterencode
    for chunk in _iterencode_dict(o._asdict(), _current_indent_level):
TypeError: 'NoneType' object is not callable
2012-06-06 15:06:15,552 [ERROR][Actions] __call__() @ action.py:129 - 'NoneType' object is not callable
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/gofer/agent/action.py", line 127, in __call__
    self.target()
  File "/usr/lib64/gofer/plugins/pulpplugin.py", line 94, in heartbeat
    return self.send()
  File "/usr/lib64/gofer/plugins/pulpplugin.py", line 105, in send
    p.send(topic, ttl=delay, heartbeat=body)
  File "/usr/lib/python2.7/site-packages/gofer/messaging/producer.py", line 49, in send
    json = envelope.dump()
  File "/usr/lib/python2.7/site-packages/gofer/messaging/__init__.py", line 80, in dump
    return json.dumps(d, indent=2)
  File "/usr/lib64/python2.7/site-packages/simplejson/__init__.py", line 296, in dumps
    **kw).encode(obj)
  File "/usr/lib64/python2.7/site-packages/simplejson/encoder.py", line 228, in encode
    chunks = list(chunks)
  File "/usr/lib64/python2.7/site-packages/simplejson/encoder.py", line 509, in _iterencode
    for chunk in _iterencode_dict(o._asdict(), _current_indent_level):
TypeError: 'NoneType' object is not callable

Comment 1 Jeff Ortel 2012-06-08 20:43:19 UTC
Looks like this is fixed in simplejson 2.5.2.  In this version, it does a callable() check.

Comment 2 Jeff Ortel 2012-06-08 22:25:37 UTC
Fixed in gofer 0.69.

Also fixed in python-simplejson-2.5.2-1.fc17 available in F17 (updates).


Note You need to log in before you can comment on or make changes to this bug.