Summary: | ASTERISK-00388: Unable to create thread from manager using originate | ||
Reporter: | jshugart (jshugart) | Labels: | |
Date Opened: | 2003-10-15 16:28:23 | Date Closed: | 2008-01-15 14:36:29.000-0600 |
Priority: | Blocker | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) pbx.c.diff | |
Description: | The originate function (async) creates attached threads. After 120+ Action:Originate messages to a manager session asterisk is unable to create more threads. I have made the small changes to pbx.c to create the threads detached. This change was recently made to pbx_spool.c. I have included the patch. ****** ADDITIONAL INFORMATION ****** --- pbx.c 6 Oct 2003 00:41:43 -0000 1.59 +++ pbx.c 15 Oct 2003 21:42:41 -0000 @@ -3790,6 +3790,7 @@ int res = -1; char *var, *tmp; struct outgoing_helper oh; + pthread_attr_t attr; if (sync) { LOAD_OH(oh); chan = __ast_request_and_dial(type, format, data, timeout, reason, callerid, &oh); @@ -3854,7 +3855,9 @@ strncpy(as->exten, exten, sizeof(as->exten) - 1); as->priority = priority; as->timeout = timeout; - if (pthread_create(&as->p, NULL, async_wait, as)) { + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + if (pthread_create(&as->p, &attr, async_wait, as)) { ast_log(LOG_WARNING, "Failed to start async wait\n"); free(as); ast_hangup(chan); @@ -3895,6 +3898,7 @@ struct app_tmp *tmp; char *var, *vartmp; int res = -1; + pthread_attr_t attr; if (!app || !strlen(app)) return -1; if (sync) { @@ -3949,7 +3953,9 @@ if (appdata) strncpy(as->appdata, appdata, sizeof(as->appdata) - 1); as->timeout = timeout; - if (pthread_create(&as->p, NULL, async_wait, as)) { + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + if (pthread_create(&as->p, &attr, async_wait, as)) { ast_log(LOG_WARNING, "Failed to start async wait\n"); free(as); ast_hangup(chan); | ||
Comments: | By: Brian West (bkw918) 2003-10-15 17:40:35 can you attach a diff please... diff -u By: Mark Spencer (markster) 2003-10-16 05:09:34 Yes, please attach a diff By: Mark Spencer (markster) 2003-10-22 22:29:56 Fixed in CVS By: Digium Subversion (svnbot) 2008-01-15 14:36:29.000-0600 Repository: asterisk Revision: 1661 U trunk/pbx.c ------------------------------------------------------------------------ r1661 | markster | 2008-01-15 14:36:29 -0600 (Tue, 15 Jan 2008) | 2 lines Create outgoing threads detached (bug ASTERISK-388) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=1661 |