mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 18:20:07 +01:00
MDEV-9733 Server crashes in lf_pinbox_real_free on replication slaves
don't allocate all the stack, leave some stack for function calls. To test I added the following line: alloca_size = available_stack_size() - X at X=4096 or less mysqld crashed, at 8192 mtr test passed.
This commit is contained in:
parent
0b9fb9aea9
commit
fc2c1e4385
1 changed files with 8 additions and 1 deletions
|
@ -103,6 +103,12 @@
|
||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
#include <lf.h>
|
#include <lf.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
when using alloca() leave at least that many bytes of the stack -
|
||||||
|
for functions we might be calling from within this stack frame
|
||||||
|
*/
|
||||||
|
#define ALLOCA_SAFETY_MARGIN 8192
|
||||||
|
|
||||||
#define LF_PINBOX_MAX_PINS 65536
|
#define LF_PINBOX_MAX_PINS 65536
|
||||||
|
|
||||||
static void _lf_pinbox_real_free(LF_PINS *pins);
|
static void _lf_pinbox_real_free(LF_PINS *pins);
|
||||||
|
@ -349,7 +355,8 @@ static void _lf_pinbox_real_free(LF_PINS *pins)
|
||||||
{
|
{
|
||||||
int alloca_size= sizeof(void *)*LF_PINBOX_PINS*npins;
|
int alloca_size= sizeof(void *)*LF_PINBOX_PINS*npins;
|
||||||
/* create a sorted list of pinned addresses, to speed up searches */
|
/* create a sorted list of pinned addresses, to speed up searches */
|
||||||
if (available_stack_size(&pinbox, *pins->stack_ends_here) > alloca_size)
|
if (available_stack_size(&pinbox, *pins->stack_ends_here) >
|
||||||
|
alloca_size + ALLOCA_SAFETY_MARGIN)
|
||||||
{
|
{
|
||||||
struct st_harvester hv;
|
struct st_harvester hv;
|
||||||
addr= (void **) alloca(alloca_size);
|
addr= (void **) alloca(alloca_size);
|
||||||
|
|
Loading…
Add table
Reference in a new issue