[Python-Dev] FW: [Python-Help] Python threads with suncc (Forte 6.1) compiler

Tim Peters tim.one@home.com
Sat, 4 Aug 2001 01:33:03 -0400

Some Socket Wizard should worry about the attached.  What's life like on
64-bit Linux (etc)?  Perhaps more autoconf crap could fudge this.

once-again-windows-shows-the-way<wink>-ly y'rs  - tim

Background info from an earlier Python-Help msg:

> I work on a Solaris 8.0 (64 bit) system. Python is compiled with
> Sun CC (Forte 6.1) compiler with threading support.  A small program
> telnetting to a computer often dumps core.

-----Original Message-----
From: python-help-admin@python.org
Sent: Friday, August 03, 2001 5:06 AM
To: help@python.org
Subject: Re: [Python-Help] Python threads with suncc (Forte 6.1)


I've received some answers that this code running fine in the same
environment.  A collegaue of mine compiled Python 2.0 as I wrote
yesterday, and later he debugged this error.  Purify showed us stack
read and write outside the stack in Modules/selectmodule.c in

static PyObject *
select_select(PyObject *self, PyObject *args)
	/* This would be an awful lot of stack space on Windows! */
	pylist *rfd2obj, *wfd2obj, *efd2obj;
	pylist rfd2obj[FD_SETSIZE + 3];
	pylist wfd2obj[FD_SETSIZE + 3];
	pylist efd2obj[FD_SETSIZE + 3];

In our environment FD_SETSIZE is 65536 as defined in sys/select.h (see
below). The allocated stack space in select_select is
3*sizeof(rfd2obj)*(FD_SETSIZE+3). It is more than 3MB. My collegaue told
me that the difference between the addresses of the same variable in two
seperate threads is about 2MB. Lets suppose char *p1 = (char *)rfd2obj
in thread N and char *p2 = (char *)rfd2obj in thread N + 1, abs(p1-p2)
is about 2MB. The stack is overwritten between the seperate threads. He
could solve the problem, as solved on Windows with allocating these
variables on the heap. Do you have any ideas, how can it happen?

#ifndef	FD_SETSIZE
#ifdef _LP64
#define	FD_SETSIZE	65536
#define	FD_SETSIZE	1024
#endif	/* _LP64 */


Python-Help maillist  -  Python-Help@python.org