Bug 829767 - JSON serialization broken in F17
JSON serialization broken in F17
Status: ON_QA
Product: Gofer
Classification: Community
Component: python-gofer (Show other bugs)
0.66
Unspecified Linux
unspecified Severity high
: ---
: ---
Assigned To: Jeff Ortel
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-07 10:01 EDT by Jeff Ortel
Modified: 2012-06-08 18:26 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jeff Ortel 2012-06-07 10:01:13 EDT
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 16:43:19 EDT
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 18:25:37 EDT
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.