This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: multiprocessing: conn_recv_string() broken error handling
Type: behavior Stage: resolved
Components: IO Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jnoller Nosy List: asksol, hfuru, jnoller, python-dev, sbt, vstinner
Priority: normal Keywords: patch

Created on 2010-10-17 20:14 by hfuru, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
conn_recv_string_failures.diff hfuru, 2010-10-17 20:14 conn_recv_string() error handling
Messages (4)
msg118978 - (view) Author: Hallvard B Furuseth (hfuru) Date: 2010-10-17 20:14
Neither conn_recv_string() nor its callers free *newbuffer on error.

The promotion rules break negative 'res' for 64-bit Py_ssize_t
in the (ulength <= buflength) branch:
res = -1 ==> (UINT32)-1 ==> Py_ssize_t 0xffffffff instead of -1.

While I'm writing: The _conn_recvall() calls can be factored out
of the if().

This patch applies to both 3.2a3 and 2.7.  However, the patched failure
cases are untested: I do not know how to test them. It passes make test.
msg162618 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-06-11 14:19
New changeset 60a7b704de5c by Richard Oudkerk in branch '2.7':
Issue #10133: Make multiprocessing deallocate buffer if socket read fails.
http://hg.python.org/cpython/rev/60a7b704de5c

New changeset 5643697070c0 by Richard Oudkerk in branch '3.2':
Issue #10133: Make multiprocessing deallocate buffer if socket read fails.
http://hg.python.org/cpython/rev/5643697070c0
msg162622 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-06-11 15:12
Thanks for the patch, I have applied it.  (I don't think there was a problem with the promotion rules because res was a never converted to UINT32.)
msg162665 - (view) Author: Hallvard B Furuseth (hfuru) Date: 2012-06-12 10:35
Richard Oudkerk <report@bugs.python.org> wrote:
> Thanks for the patch, I have applied it.  (I don't think there was a
> problem with the promotion rules because res was a never converted to
> UINT32.)

 True now that res is a Py_ssize_t.  It was int when I wrote the patch.

 Hallvard
History
Date User Action Args
2022-04-11 14:57:07adminsetgithub: 54342
2012-06-12 10:35:26hfurusetmessages: + msg162665
2012-06-11 17:57:29amaury.forgeotdarclinkissue15046 superseder
2012-06-11 15:12:45sbtsetstatus: open -> closed
resolution: fixed
messages: + msg162622

stage: resolved
2012-06-11 14:19:56python-devsetnosy: + python-dev
messages: + msg162618
2012-06-08 14:44:38sbtsetnosy: + sbt
2010-11-04 13:14:29hfurusetversions: + Python 3.1, Python 2.7
2010-11-04 11:55:49vstinnersetnosy: + vstinner
2010-11-02 14:57:35asksolsetnosy: + asksol
2010-10-17 22:02:42amaury.forgeotdarcsetassignee: jnoller

nosy: + jnoller
title: conn_recv_string() broken error handling -> multiprocessing: conn_recv_string() broken error handling
2010-10-17 20:14:54hfurucreate