FS-4186 --resolve

This commit is contained in:
Anthony Minessale 2012-05-04 08:25:48 -05:00
parent fd9486f0ed
commit 5190bd0849
3 changed files with 10 additions and 4 deletions

View File

@ -337,7 +337,7 @@ typedef enum {
} TFLAGS; } TFLAGS;
#define SOFIA_MAX_MSG_QUEUE 64 #define SOFIA_MAX_MSG_QUEUE 64
#define SOFIA_MSG_QUEUE_SIZE 100 #define SOFIA_MSG_QUEUE_SIZE 250
struct mod_sofia_globals { struct mod_sofia_globals {
switch_memory_pool_t *pool; switch_memory_pool_t *pool;

View File

@ -744,6 +744,8 @@ SWITCH_DECLARE(int32_t) set_auto_priority(void)
runtime.cpu_count = sysinfo.dwNumberOfProcessors; runtime.cpu_count = sysinfo.dwNumberOfProcessors;
#endif #endif
if (!runtime.cpu_count) runtime.cpu_count = 1;
/* If we have more than 1 cpu, we should use realtime priority so we can have priority threads */ /* If we have more than 1 cpu, we should use realtime priority so we can have priority threads */
if (runtime.cpu_count > 1) { if (runtime.cpu_count > 1) {
return set_realtime_priority(); return set_realtime_priority();
@ -1421,6 +1423,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
} }
#endif #endif
if (!runtime.cpu_count) runtime.cpu_count = 1;
/* INIT APR and Create the pool context */ /* INIT APR and Create the pool context */
if (apr_initialize() != SWITCH_STATUS_SUCCESS) { if (apr_initialize() != SWITCH_STATUS_SUCCESS) {
*err = "FATAL ERROR! Could not initialize APR\n"; *err = "FATAL ERROR! Could not initialize APR\n";

View File

@ -35,7 +35,7 @@
#include <switch.h> #include <switch.h>
#include <switch_event.h> #include <switch_event.h>
//#define SWITCH_EVENT_RECYCLE //#define SWITCH_EVENT_RECYCLE
#define DISPATCH_QUEUE_LEN 10000 #define DISPATCH_QUEUE_LEN 1000
//#define DEBUG_DISPATCH_QUEUES //#define DEBUG_DISPATCH_QUEUES
/*! \brief A node to store binded events */ /*! \brief A node to store binded events */
@ -345,8 +345,9 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi
launch_dispatch_threads(SOFT_MAX_DISPATCH + 1, DISPATCH_QUEUE_LEN, RUNTIME_POOL); launch_dispatch_threads(SOFT_MAX_DISPATCH + 1, DISPATCH_QUEUE_LEN, RUNTIME_POOL);
switch_mutex_unlock(EVENT_QUEUE_MUTEX); switch_mutex_unlock(EVENT_QUEUE_MUTEX);
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Out of event dispatch threads! Resorting to a blocking push.... Look for laggy event consumers or event_socket connections!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Event Thread %d is blocking\n", my_id);
switch_queue_push(EVENT_DISPATCH_QUEUE[0], event); switch_queue_push(EVENT_DISPATCH_QUEUE[0], event);
event = NULL;
} }
} }
} }
@ -623,7 +624,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool)
*/ */
/* don't need any more dispatch threads than we have CPU's*/ /* don't need any more dispatch threads than we have CPU's*/
MAX_DISPATCH = switch_core_cpu_count(); MAX_DISPATCH = switch_core_cpu_count() + 1;
switch_assert(pool != NULL); switch_assert(pool != NULL);