[Asterisk-code-review] taskprocessor: Warn on unused result from pushing task. (asterisk[master])

Richard Mudgett asteriskteam at digium.com
Tue Oct 16 18:19:13 CDT 2018


Richard Mudgett has posted comments on this change. ( https://gerrit.asterisk.org/10486 )

Change subject: taskprocessor: Warn on unused result from pushing task.
......................................................................


Patch Set 1: Code-Review-1

(6 comments)

https://gerrit.asterisk.org/#/c/10486/1/apps/app_confbridge.c
File apps/app_confbridge.c:

https://gerrit.asterisk.org/#/c/10486/1/apps/app_confbridge.c@1115
PS1, Line 1115: 			/* BUGBUG: how should we handle ast_taskprocess_push failure here? */
I don't think there is anything we can do other than not hanging up the playback channel.


https://gerrit.asterisk.org/#/c/10486/1/main/stasis.c
File main/stasis.c:

https://gerrit.asterisk.org/#/c/10486/1/main/stasis.c@565
PS1, Line 565: 			/* BUGBUG: how do we handle this? */
I do not think there is anything we can do that is not likely to cause a crash.


https://gerrit.asterisk.org/#/c/10486/1/main/taskprocessor.c
File main/taskprocessor.c:

https://gerrit.asterisk.org/#/c/10486/1/main/taskprocessor.c@238
PS1, Line 238: 	if (ast_taskprocessor_push(listener->tps, default_listener_die, pvt)) {
             : 		/* BUGBUG: what do we do here? */
             : 	}
On failure I think we can just:

default_listener_die(pvt);

This will cause the thread to exit early and not complete the tasks already in the queue.

Another way to handle this is to take the pthread_detach() path below.

I think making the thread exit early is the better of the bad choices.  At least the taskprocessor will clean up.


https://gerrit.asterisk.org/#/c/10486/1/main/threadpool.c
File main/threadpool.c:

https://gerrit.asterisk.org/#/c/10486/1/main/threadpool.c@661
PS1, Line 661: 		if (ast_taskprocessor_push(pool->control_tps, queued_emptied, pool)) {
             : 			ast_log(LOG_ERROR, "Failed to push call, leaks may occur.\n");
             : 		}
We don't need to do anything on failure as the callback isn't currently used by anything.


https://gerrit.asterisk.org/#/c/10486/1/tests/test_threadpool.c
File tests/test_threadpool.c:

https://gerrit.asterisk.org/#/c/10486/1/tests/test_threadpool.c@333
PS1, Line 333: 	ast_free(std);
Heh.  std isn't destroyed right.  We need to destroy the lock and cond initialized by simple_task_data_alloc().

This is true for all cleanups of std in the tests in this file.


https://gerrit.asterisk.org/#/c/10486/1/tests/test_threadpool.c@1434
PS1, Line 1434: 	ctd1 = complex_task_data_alloc();
              : 	ctd2 = complex_task_data_alloc();
ctd1 and ctd2 are not cleaned up properly.  Just like for simple_task_data_alloc() the lock and conds initialized are not destroyed.

This is true for tests in this file that have them.



-- 
To view, visit https://gerrit.asterisk.org/10486
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I7e4079bd7b21cfe52fb431ea79e41314520c3f6d
Gerrit-Change-Number: 10486
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2 (1000185)
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Tue, 16 Oct 2018 23:19:13 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181016/89b8f20f/attachment-0001.html>


More information about the asterisk-code-review mailing list