python / cpython

The Python programming language
https://www.python.org
Other
62.77k stars 30.08k forks source link

xmlrpclib.ServerProxy with verbosity produces bad output #55351

Open 5c38da3b-3899-4cdb-974f-bba5d0238034 opened 13 years ago

5c38da3b-3899-4cdb-974f-bba5d0238034 commented 13 years ago
BPO 11142
Nosy @loewis

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['type-feature', 'library'] title = 'xmlrpclib.ServerProxy with verbosity produces bad output' updated_at = user = 'https://bugs.python.org/ErezSh' ``` bugs.python.org fields: ```python activity = actor = 'BreamoreBoy' assignee = 'none' closed = False closed_date = None closer = None components = ['Library (Lib)'] creation = creator = 'Erez.Sh' dependencies = [] files = [] hgrepos = [] issue_num = 11142 keywords = [] message_count = 2.0 messages = ['128141', '220895'] nosy_count = 2.0 nosy_names = ['loewis', 'Erez.Sh'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = 'enhancement' url = 'https://bugs.python.org/issue11142' versions = ['Python 3.5'] ```

5c38da3b-3899-4cdb-974f-bba5d0238034 commented 13 years ago

In xmlrpclib, a ServerProxy initialized with verbose=True produces an occasionally jumbled-up output, due to a multiple threads writing to stdout without synchronizing.

I noticed this happening only for incoming data (at line 1461: print "body:", repr(data) ).

I seem to have fixed it locally by accumulating all the data and printing it (within a lock) outside of the send/recv loop.

It is a useful feature for debugging and logging the 'raw' communication, but virtually useless if one can't rely on its output.

83d2e70e-e599-4a04-b820-3814bbdb9bef commented 10 years ago

I'm assuming that this is classed as an enhancement request and not a bug.