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

A potential error due to the unreleased lock #1266

Open
ycaibb opened this issue Aug 28, 2021 · 0 comments
Open

A potential error due to the unreleased lock #1266

ycaibb opened this issue Aug 28, 2021 · 0 comments
Assignees
Labels

Comments

@ycaibb
Copy link
Contributor

ycaibb commented Aug 28, 2021

Dear developers: thank you for your checking. It seems there is a lock resource leak on the lock thread->starting_lock. I think the lock should be released at the end of thread_routine?

#ifdef HAVE_PTHREAD
static NORETURN void *
thread_routine (void *data)
{
	cherokee_thread_t *thread = THREAD(data);

	...;
	CHEROKEE_MUTEX_LOCK (&thread->starting_lock); // the lock is not released

	thread_update_bogo_now (thread);

	while (likely (thread->exit == false)) {
		cherokee_thread_step_MULTI_THREAD (thread, false);
	}

	thread->ended = true;
	pthread_detach (thread->thread);
	pthread_exit (NULL);
}
#endif

ret_t
cherokee_thread_new  (cherokee_thread_t      **thd,
                      void                   *server,
                      cherokee_thread_type_t  type,
                      cherokee_poll_type_t    fdpoll_type,
                      cint_t                  system_fd_num,
                      cint_t                  fd_num,
                      cint_t                  conns_max,
                      cint_t                  keepalive_max)
{
re = pthread_create (&n->thread, &attr, thread_routine, n);
}

Best,

@skinkie skinkie self-assigned this Aug 28, 2021
@skinkie skinkie added the t:bug label Aug 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants