Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Feb 2004 16:32:09 -0500 (EST)
From:      Daniel Eischen <eischen@vigrid.com>
To:        Julian Elischer <julian@elischer.org>
Cc:        current@FreeBSD.org
Subject:   Re: python ports broken (sem_destroy: Resource temporarily
Message-ID:  <Pine.GSO.4.10.10402061626330.24638-100000@pcnet5.pcnet.com>
In-Reply-To: <200402062121.NAA32194@InterJet.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 6 Feb 2004, Julian Elischer wrote:
> 
> On Fri, 6 Feb 2004, Daniel Eischen wrote:
> 
> > On Fri, 6 Feb 2004, Daniel Eischen wrote:
> > 
> > > On Sat, 7 Feb 2004, Hye-Shik Chang wrote:
> > > > 
> > > > Thank you very much!
> > > > py-bsddb unittest is successfully passed with your fixes. And almost
> > > > all of python regression test set is okay except test_threaded_import.
> > > > 
> > > > alice(perky):/usr/local/lib/python2.3/test% sudo python test_threaded_import.py
> > > > Trying 20 threads ... OK.
> > > > Trying 50 threads ...
> > > > Traceback (most recent call last):
> > > >   File "test_threaded_import.py", line 56, in ?
> > > >     test_main()
> > > >   File "test_threaded_import.py", line 50, in test_main
> > > >     thread.start_new_thread(task, ())
> > > > thread.error: can't start new thread
> > > > 
> > > > FYI, python's thread creation routine is located on
> > > > work/Python-2.3.3/Python/thread_pthread.h:188.
> > > 
> > > How many threads does it try after "Trying 50 threads..."?  You
> > > may have to increase kern.threads.max_threads_per_proc.
> > 
> > Arghh.  It's creating system scope threads, so you have
> > to adjust kern.threads.max_groups_per_proc.
> 
> Why?

System scope threads each have their own KSEG/KSE pair.
The default thread limits in the kernel are:

  kern.threads.max_threads_per_proc: 150
  kern.threads.max_groups_per_proc: 50

By default there are 2 KSEGs for a threaded process in
libpthread: one for scope process threads and one for
the signal handling thread.  That leaves 48 for left for
application use.

Those limits are arbitrary, so you can raise/lower them
if you don't like them.  I thought you came up with those
limits ;-)

-- 
Dan Eischen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10402061626330.24638-100000>