mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-26 20:48:21 +00:00
FS-5332 --resolve
This commit is contained in:
parent
6e8b5428c1
commit
f0dd0ef7b1
@ -947,12 +947,9 @@ int main(int argc, char *argv[])
|
|||||||
char buf[1024] = "";
|
char buf[1024] = "";
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
fprintf(stderr, "Error: stacksize %d is not optimal: run ulimit -s %d from your shell before starting the application.\nauto-adjusting stack size for optimal performance...\n",
|
|
||||||
(int) (rlp.rlim_cur / 1024), SWITCH_THREAD_STACKSIZE / 1024);
|
|
||||||
|
|
||||||
memset(&rlp, 0, sizeof(rlp));
|
memset(&rlp, 0, sizeof(rlp));
|
||||||
rlp.rlim_cur = SWITCH_THREAD_STACKSIZE;
|
rlp.rlim_cur = SWITCH_THREAD_STACKSIZE;
|
||||||
rlp.rlim_max = SWITCH_THREAD_STACKSIZE;
|
rlp.rlim_max = SWITCH_SYSTEM_THREAD_STACKSIZE;
|
||||||
setrlimit(RLIMIT_STACK, &rlp);
|
setrlimit(RLIMIT_STACK, &rlp);
|
||||||
|
|
||||||
apr_terminate();
|
apr_terminate();
|
||||||
|
@ -2650,16 +2650,20 @@ static void *SWITCH_THREAD_FUNC system_thread(switch_thread_t *thread, void *obj
|
|||||||
{
|
{
|
||||||
struct system_thread_handle *sth = (struct system_thread_handle *) obj;
|
struct system_thread_handle *sth = (struct system_thread_handle *) obj;
|
||||||
|
|
||||||
#if 0 // if we are a luser we can never turn this back down, didn't we already set the stack size?
|
|
||||||
#if defined(HAVE_SETRLIMIT) && !defined(__FreeBSD__)
|
#if defined(HAVE_SETRLIMIT) && !defined(__FreeBSD__)
|
||||||
struct rlimit rlim;
|
struct rlimit rlim;
|
||||||
|
struct rlimit rlim_save;
|
||||||
|
|
||||||
rlim.rlim_cur = SWITCH_SYSTEM_THREAD_STACKSIZE;
|
memset(&rlim, 0, sizeof(rlim));
|
||||||
rlim.rlim_max = SWITCH_SYSTEM_THREAD_STACKSIZE;
|
getrlimit(RLIMIT_STACK, &rlim);
|
||||||
|
|
||||||
|
memset(&rlim_save, 0, sizeof(rlim_save));
|
||||||
|
getrlimit(RLIMIT_STACK, &rlim_save);
|
||||||
|
|
||||||
|
rlim.rlim_cur = rlim.rlim_max;
|
||||||
if (setrlimit(RLIMIT_STACK, &rlim) < 0) {
|
if (setrlimit(RLIMIT_STACK, &rlim) < 0) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Setting stack size failed! (%s)\n", strerror(errno));
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Setting stack size failed! (%s)\n", strerror(errno));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (sth->fds) {
|
if (sth->fds) {
|
||||||
@ -2668,14 +2672,10 @@ static void *SWITCH_THREAD_FUNC system_thread(switch_thread_t *thread, void *obj
|
|||||||
|
|
||||||
sth->ret = system(sth->cmd);
|
sth->ret = system(sth->cmd);
|
||||||
|
|
||||||
#if 0
|
|
||||||
#if defined(HAVE_SETRLIMIT) && !defined(__FreeBSD__)
|
#if defined(HAVE_SETRLIMIT) && !defined(__FreeBSD__)
|
||||||
rlim.rlim_cur = SWITCH_THREAD_STACKSIZE;
|
if (setrlimit(RLIMIT_STACK, &rlim_save) < 0) {
|
||||||
rlim.rlim_max = SWITCH_SYSTEM_THREAD_STACKSIZE;
|
|
||||||
if (setrlimit(RLIMIT_STACK, &rlim) < 0) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Setting stack size failed! (%s)\n", strerror(errno));
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Setting stack size failed! (%s)\n", strerror(errno));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch_mutex_lock(sth->mutex);
|
switch_mutex_lock(sth->mutex);
|
||||||
@ -2798,6 +2798,10 @@ static int switch_system_fork(const char *cmd, switch_bool_t wait)
|
|||||||
{
|
{
|
||||||
int pid;
|
int pid;
|
||||||
char *dcmd = strdup(cmd);
|
char *dcmd = strdup(cmd);
|
||||||
|
#if defined(HAVE_SETRLIMIT) && !defined(__FreeBSD__)
|
||||||
|
struct rlimit rlim;
|
||||||
|
struct rlimit rlim_save;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch_core_set_signal_handlers();
|
switch_core_set_signal_handlers();
|
||||||
|
|
||||||
@ -2811,6 +2815,19 @@ static int switch_system_fork(const char *cmd, switch_bool_t wait)
|
|||||||
} else {
|
} else {
|
||||||
switch_close_extra_files(NULL, 0);
|
switch_close_extra_files(NULL, 0);
|
||||||
|
|
||||||
|
#if defined(HAVE_SETRLIMIT) && !defined(__FreeBSD__)
|
||||||
|
memset(&rlim, 0, sizeof(rlim));
|
||||||
|
getrlimit(RLIMIT_STACK, &rlim);
|
||||||
|
|
||||||
|
memset(&rlim_save, 0, sizeof(rlim_save));
|
||||||
|
getrlimit(RLIMIT_STACK, &rlim_save);
|
||||||
|
|
||||||
|
rlim.rlim_cur = rlim.rlim_max;
|
||||||
|
if (setrlimit(RLIMIT_STACK, &rlim) < 0) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Setting stack size failed! (%s)\n", strerror(errno));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (system(dcmd) == -1) {
|
if (system(dcmd) == -1) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to execute because of a command error : %s\n", dcmd);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to execute because of a command error : %s\n", dcmd);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user