[Tarantool-patches] [PATCH] replication: stop pushing TimedOut error to the replica

Serge Petrenko sergepetrenko at tarantool.org
Fri Jul 9 11:30:20 MSK 2021



09.07.2021 10:59, Cyrill Gorcunov пишет:
> On Fri, Jul 09, 2021 at 10:40:48AM +0300, Serge Petrenko wrote:
>> @@ -549,6 +550,12 @@ iproto_write_error(int fd, const struct error *e, uint32_t schema_version,
>>   
>>   	size_t region_svp = region_used(region);
>>   	mpstream_iproto_encode_error(&stream, e);
>> +	struct errinj *inj = errinj(ERRINJ_IPROTO_WRITE_ERROR_LARGE,
>> +				    ERRINJ_INT);
>> +	if (inj != NULL && inj->iparam > 0) {
>> +		char garbage[inj->iparam];
> Serge, I didn't read the patch yet but this moment is very dubious.
> While standart allows to allocate dynamic stack here it may lead
> to unpredicted effects. I would suggest to use malloc if this
> won't cause significant rework, hm? Surely this can be done on
> top of the patch (actually you did a huge amount of great work
> investigating this issue, thanks!!!)

Thanks! No problem, will rework.
It might be better to not allocate any string at all.
I can simply allocate the needed buffer on the region (where the msgpack 
will be encoded),
and encode the string header, and leave the buffer with whatever 
contents it has
(it'll probably be filled with 0x50 bytes, it's the slab poison symbol).

-- 
Serge Petrenko



More information about the Tarantool-patches mailing list