A) you have run out of handles.
or
B) you ran ns_db gethandle main twice within the same thread which
doesn't work either. From the AOLserver docs:
ns_db gethandle returns the specified number of handles from the
specified pool. If poolname is not specified, the Defaultpool from the
configuration file is used. If nhandles is not specified, 1 handle is
returned. (Note that if you specify nhandles, you must also specify a
poolname.) If not enough handles are available to fulfill the request,
it waits until they are available. You must request all the handles
you will need for a specific pool with one call to ns_db gethandle.
You must release all your database handles explicitly (with ns_db
releasehandle ) before acquiring more. If you request multiple handles
from the database, this function returns a Tcl list of database
handles (space delimited). In this case, each handle must be released
with a separate call to ns_db releasehandle.