Date: Sat, 6 Apr 2002 22:45:26 -0400 (AST) From: "Marc G. Fournier" <scrappy@hub.org> To: freebsd-stable@freebsd.org Cc: jkoshy@freebsd.org, <freebsd-ports@freebsd.org>, <mab@red-bean.com> Subject: Re: Upgraded libraries breaks aolserver port? Message-ID: <20020406223214.L86558-100000@mail1.hub.org> In-Reply-To: <20020406184751.Q86558-100000@mail1.hub.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 6 Apr 2002, Marc G. Fournier wrote:
>
> Just recently upgraded my machine, and aolserver no longer starts, with an
> error of:
>
> nsthread(20981) error: pthread_cond_timedwait failed in Ns_CondTimedWait: Invalid argument
>
> OS is:
>
> 4.5-STABLE FreeBSD 4.5-STABLE #6: Mon Mar 25 21:01:05 CST 2002
>
> Has anyone else seen this?
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-stable" in the body of the message
>
As a followup to this, the 'offending' function is in thread/pthread.cpp
... does anything look "wrong" with the function that would cause the
above error in the latest FreeBSD?
int
Ns_CondTimedWait(Ns_Cond *condPtr, Ns_Mutex *mutexPtr, Ns_Time *timePtr)
{
pthread_cond_t *cond;
pthread_mutex_t *lockPtr;
Thread *ownerPtr;
Mutex *mPtr;
int err, status;
struct timespec ts;
if (timePtr == NULL) {
Ns_CondWait(condPtr, mutexPtr);
return NS_OK;
}
cond = GETCOND(condPtr);
mPtr = GETMUTEX(mutexPtr);
lockPtr = mPtr->lock;
ownerPtr = mPtr->ownerPtr;
mPtr->ownerPtr = NULL;
/*
* Convert the microsecond-based Ns_Time to a nanosecond-based
* struct timespec.
*/
ts.tv_sec = timePtr->sec;
ts.tv_nsec = timePtr->usec * 1000;
/*
* As documented on Linux, pthread_cond_timedwait may return
* EINTR if a signal arrives. We have noticed that
* EINTR can be returned on Solaris as well although this
* is not documented (perhaps, as above, it's possible it
* bubbles up from _lwp_cond_timedwait???). Anyway, unlike
* the ETIME case above, we'll assume the wakeup is truely
* spurious and simply restart the wait knowing that the
* ts structure has not been modified.
*/
do {
err = pthread_cond_timedwait(cond, lockPtr, &ts);
} while (err == EINTR);
#ifdef HAVE_ETIME_BUG
/*
* See comments above and note that here ETIME is still considered
* a spurious wakeup, not an indication of timeout because we're
* not making any assumptions about the nature or this bug.
* While we're less certain, this should still be ok as properly
* written condition code should tolerate the wakeup.
*/
if (err == ETIME) {
err = 0;
}
#endif
if (ERRTIMEDOUT(err)) {
status = NS_TIMEOUT;
} else if (err != 0) {
NsThreadFatal("Ns_CondTimedWait", "pthread_cond_timedwait", err);
} else {
status = NS_OK;
}
mPtr->ownerPtr = ownerPtr;
++mPtr->nlock;
return status;
}
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020406223214.L86558-100000>
