Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible locking issues (e.g., deadlocks) #751

Open
ryancaicse opened this issue Mar 28, 2022 · 3 comments
Open

Possible locking issues (e.g., deadlocks) #751

ryancaicse opened this issue Mar 28, 2022 · 3 comments

Comments

@ryancaicse
Copy link

Hi, it seems lock l_conf is not released before Line 1234.

util_mutex_lock(l_conf);
if(!conf_main_file)
return FALSE;
retval = !access(conf_main_file,W_OK);
util_mutex_unlock(l_conf);

@ryancaicse
Copy link
Author

it seems lock ltc_ecc_fp_lock is not released before Line 1436.

LTC_MUTEX_LOCK(&ltc_ecc_fp_lock);
/*
* build the list;
Cache DEFINITIONS ::=
BEGIN
CacheDump ::= SEQUENCE {
numEntries SHORTINTEGER,
maxEntries SHORTINTEGER,
numLUT SHORTINTEGER,
cache SEQUENCE OF INTEGER
}
END
*
*/
/*
* The cache itself is a point (3 INTEGERS),
* the LUT as pairs of INTEGERS (2 * 1<<FP_LUT),
* and the mu INTEGER
*/
cache_entry = XCALLOC(FP_ENTRIES*(2*(1U<<FP_LUT)+4)+3, sizeof(ltc_asn1_list));
if (cache_entry == NULL)
return CRYPT_MEM;

@ryancaicse
Copy link
Author

lock s->mutex is not released before Line 608.

pthread_mutex_lock(&s->mutex);
do {
avail = av_fifo_size(s->fifo);
if (avail) { // >=size) {
uint8_t tmp[4];
av_fifo_generic_read(s->fifo, tmp, 4, NULL);
avail= AV_RL32(tmp);
if(avail > size){
av_log(h, AV_LOG_WARNING, "Part of datagram lost due to insufficient buffer size\n");
avail= size;
}
av_fifo_generic_read(s->fifo, buf, avail, NULL);
av_fifo_drain(s->fifo, AV_RL32(tmp) - avail);
pthread_mutex_unlock(&s->mutex);
return avail;
} else if(s->circular_buffer_error){
int err = s->circular_buffer_error;
pthread_mutex_unlock(&s->mutex);
return err;
} else if(nonblock) {
pthread_mutex_unlock(&s->mutex);
return AVERROR(EAGAIN);
}
else {
/* FIXME: using the monotonic clock would be better,
but it does not exist on all supported platforms. */
int64_t t = av_gettime() + 100000;
struct timespec tv = { .tv_sec = t / 1000000,
.tv_nsec = (t % 1000000) * 1000 };
if (pthread_cond_timedwait(&s->cond, &s->mutex, &tv) < 0)
return AVERROR(errno == ETIMEDOUT ? EAGAIN : errno);

@ryancaicse
Copy link
Author

@andy-padavan Could you take a look? thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant