Skip to content

A potential error due to the unreleased lock #1266

@ycaibb

Description

@ycaibb

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,

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions