A possible bug in python threading/time module?

vm_usenet vm_usenet at yahoo.com
Sat Jul 5 12:18:22 EDT 2003


"Tim Peters" <tim.one at comcast.net> wrote in message news:<mailman.1057347547.21819.python-list at python.org>...
> [Tim]
> > Turns out that the Windows implementation of the Python C API function
> > PyThread_start_new_thread() contained several "laziness" errors
> >
> > ...
> >
> > I'm testing putative fixes on a Win98 box and don't see any hangs any
> > more. However, with more than about 3000 threads,
> >
> >     thread.error: can't start new thread
> >
> > gets raised because MS's _beginthread() fails (with errno == EAGAIN ==
> > "there are too many threads").
> 
> FYI, these fixes have been checked in and will be part of 2.3 final (and
> 2.2.4, if that's ever released).
> 
> The maximum number of threads you can have alive simultaneously on 32-bit
> Windows in an all-default Python build is actually about 2000.  This is
> because each thread gets a megabyte of stack space by default, and 2048
> threads would entirely exhaust the 31-bit user virtual address space just
> for thread stacks.  If you want to know more about that, Google on
> 
>     CreateThread default stack size
> 
> The top hit is to the current relevant MSDN docs.

I understand what you are saying. Obviously there is a limit for the
amount of threads running at the same time. Thank you for taking the
time to find the problems, and for fixing them.

Here's to a better Python!

vm




More information about the Python-list mailing list