[Zope3-dev] race condition in Python2.3 asyncore

jhylton@speakeasy.net jhylton@speakeasy.net
Wed, 23 Oct 2002 08:27:43 -0700


On 23 Oct 2002, Steve Alexander wrote:

> I've been having fun dubugging a problem with
> Zope3 unit tests running on Python2.3 from CVS
> on intel Linux 2.4 kernel.

Nice work tracking this down!  I've seen the ftp test fail a few times, but was never able to track it down any further.

> The cause of the problem seems to be a race
> condition around the socket_map global of
> asyncore.
>
> If a socket is closed during the time between
> the socket_map being processed into arguments
> for select, and the select.select call, the
> call will raise a 'Bad file descriptor' error.

We definitely need to guard against other threads mucking with files & sockets while the mainloop is running.  I wonder if there are other related problems we should be aware of.

Jeremy