classification
Title: Improved serialization error logging in xmlrpclib
Type: enhancement Stage: test needed
Components: Library (Lib) Versions: Python 3.10, Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: blunck2, brian.curtin, ezio.melotti, kristjan.jonsson, loewis, r.david.murray
Priority: normal Keywords: patch

Created on 2008-03-21 20:39 by blunck2, last changed 2020-11-11 17:30 by iritkatriel.

Files
File name Uploaded Description Edit
Python-2.4.4.all.patch04 blunck2, 2008-03-21 20:39 Patch to Lib/xmlrpclib.py
issue2449_v2.diff brian.curtin, 2010-01-11 05:47 patch against r77393 review
Messages (7)
msg64274 - (view) Author: Christopher Blunck (blunck2) Date: 2008-03-21 20:39
When xmlrpclib fails to serialize objects into XML a generic "failed to
serialize output" error is returned to the client and no log messages
are produced to give insight into the true cause of the problem.  In
real-world scenarios where lots of data moves along the wire it can be
difficult to determine the cause of the serialization problem.

I propose the attached patch as an initial cut at improving xmlrpclib
under circumstances where serialization fails.
msg97557 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-01-10 22:49
Christopher, are you willing to update your patch for the current trunk (2.7)?
msg97572 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-01-11 04:26
Here is blunck2's patch updated against r77393. Once I have a better understanding of the issue I'll see if I can write tests (eg. I don't know the significance of 8002 on line 675, etc).
msg97574 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2010-01-11 05:15
A few things about the patch:
1) the MarshallError class has a 'message' attribute that results in a warning on some Python versions, it should be renamed in something different (like 'msg');
2) I'm not sure why the <marshallerror></marshallerror> in the exception message is necessary, but I didn't look at the code in xmlrpclib.py so it might be ok;
3) the first 'pos' is not used in the for loop where it is created but only some lines later inside the except, this is not immediately clear, so a short comment should be added;
4) the str(e) is redundant -- there's already %s;
5) the "except Exception, e:" look suspicious, a more specific exception(s) should probably be specified;
6) 'as' should be used instead of the comma in the 'except' statements.
msg97575 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-01-11 05:47
This patch should address all but #2. I'm not exactly sure of the use-case blunck2 had in mind so I'm not sure how the message would be used.
msg97587 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-01-11 13:49
I was curious, so I googled.  You may have already found this as well: it's a 'fault code', and apparently there's no standard for such codes.  The choice of 8002 may be modeled on what twisted.web does with exceptions.  Staying consistent with them is not a bad idea if you decide this is a similar enough fault case, but whatever is done it will need to be documented.

On the other hand, I also happened on this document, but I have no idea what its status is in the xmlrpc community:

http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
msg189779 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2013-05-21 19:48
Slipped under the radar?
History
Date User Action Args
2020-11-11 17:30:59iritkatrielsetversions: + Python 3.9, Python 3.10, - Python 2.7, Python 3.2
2014-02-03 18:28:18BreamoreBoysetnosy: - BreamoreBoy
2013-05-21 19:48:27BreamoreBoysetnosy: + BreamoreBoy
messages: + msg189779
2010-01-11 13:49:29r.david.murraysetnosy: + r.david.murray

messages: + msg97587
versions: + Python 3.2
2010-01-11 05:47:52brian.curtinsetfiles: - issue2449.diff
2010-01-11 05:47:40brian.curtinsetfiles: + issue2449_v2.diff

messages: + msg97575
2010-01-11 05:15:25ezio.melottisetpriority: normal
nosy: + loewis, ezio.melotti, kristjan.jonsson
messages: + msg97574

2010-01-11 04:27:19brian.curtinsetfiles: + issue2449.diff
keywords: + patch
2010-01-11 04:26:24brian.curtinsetmessages: + msg97572
stage: needs patch -> test needed
2010-01-10 22:49:32brian.curtinsetversions: + Python 2.7, - Python 2.4
nosy: + brian.curtin

messages: + msg97557

stage: needs patch
2008-03-21 20:39:47blunck2create