]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_corosync: Change thread stack size
authorJan Friesse <jfriesse@redhat.com>
Thu, 30 Mar 2017 14:33:51 +0000 (16:33 +0200)
committerJan Friesse <jfriesse@redhat.com>
Fri, 16 Jun 2017 12:44:34 +0000 (14:44 +0200)
commit005a4afa6b0e710e11b47b11cfc152b028c596fc
tree72ce6f80073decd8c7c7b9648a7fb6f353b6dfb2
parent37bc343b58914bee30455ffa70009e20ac9e909c
res_corosync: Change thread stack size

In Corosync 2.x libraries were changed to use LibQB IPC.
Sadly LibQB IPC doesn't support copy-free access to received buffer, so
Corosync libraries were rewritten to use stack as buffer. Mostly the
needed stack size is quite small, but for all *_dispatch functions, 1MiB
is needed.

Asterisk function ast_pthread_create_background set stack size for new
thread to much smaller AST_BACKGROUND_STACKSIZE (~500KiB).

This results in Asterisk crash when running with Corosync 2.x.

Patch solves this issue by creating it's own version of
ast_pthread_create_background which sets stack size to much higher value
(actually it's AST_BACKGROUND_STACKSIZE + 3MiB).

Another problem may appear when "corosync show members" netconsole
command is executed. It is also executed in thread and also has only
500KiB stack size. Sadly it calls corosync_cfg_get_node_addrs which
again needs at least 1MiB stack.

Solution is to use HAVE_COROSYNC_CFG_STATE_TRACK as a discriminator
between Corosync 1.x and 2.x. If 1.x is found, nothing changes. If 2.x
is found, NodeID is displayed instead of IP address.

ASTERISK-25370 #close
Reported by: mdu113

Change-Id: Id95b0d21ab6e708e7d74ad8786c587211676fa08
res/res_corosync.c