[Python-bugs-list] [ python-Bugs-472798 ] SSL in non-blocking mode

noreply@sourceforge.net noreply@sourceforge.net
Fri, 19 Oct 2001 08:18:06 -0700


Bugs item #472798, was opened at 2001-10-19 07:26
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=472798&group_id=5470

Category: Python Library
Group: Python 2.1.1
Status: Closed
Resolution: Out of Date
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Jeremy Hylton (jhylton)
Summary: SSL in non-blocking mode

Initial Comment:
There is a memory leak when you use SSL sockets in
Non-blocking mode.

The fix that works for me:
In socketmodule.c, in function SSL_SSLRead()
Add a  Py_DECREF(buf); to the default in the switch
statement.

Below is the code to change...

Change the switch statement from:

switch (res) {
	case SSL_ERROR_NONE:
		assert(count > 0);
		break;
	case SSL_ERROR_ZERO_RETURN: /* normal EOF */
		assert(count == 0);
		break;
	default:
          return PyErr_SetFromErrno(SSLErrorObject);
	}


To


switch (res) {
	case SSL_ERROR_NONE:
		assert(count > 0);
		break;
	case SSL_ERROR_ZERO_RETURN: /* normal EOF */
		assert(count == 0);
		break;
	default:
          Py_DECREF(buf);
          return PyErr_SetFromErrno(SSLErrorObject);
	}

Note the Py_DECREF(buf);  in the default case


----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-10-19 08:18

Message:
Logged In: YES 
user_id=6380

I've plugged this leak in the 2.1.2 branch in the way
suggested by the bug report -- it is obviously correct.

----------------------------------------------------------------------

Comment By: Jeremy Hylton (jhylton)
Date: 2001-10-19 08:05

Message:
Logged In: YES 
user_id=31392

The read() function is radically different in 2.2b1.  I
expect the specific problem is fixed.  Please file a new bug
report if it still exists.


----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-10-19 07:40

Message:
Logged In: YES 
user_id=6380

Jeremy, this is an easy one. I believe this has been fixed
in 2.2b1; can you confirm that? Also, maybe this is a 2.1.2
bugfix candidate.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=472798&group_id=5470