From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id A7ECE6EC5D; Mon, 5 Apr 2021 12:28:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A7ECE6EC5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617614933; bh=Wn827t0Zfh7D6Bm4N4E++ADA1yBT3E4hSaJY81p7BBE=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=UqJcaJe2D8Fer08kDLM4NMs1Ef2nan+QgQuw18K1ae0cV3SQxkJk+zIOghdbrx4fL UVj+pnj32Jsd6hw3mS2wg6e2vQDYMWL1X9t4bdNr09+eJZCbzg/nmcPs2JUxdahte8 hW4FeNXpcPo0HFec7miDxKqn5rp5At9tQrk/kf8E= Received: from smtp41.i.mail.ru (smtp41.i.mail.ru [94.100.177.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 1DD176EC5D for ; Mon, 5 Apr 2021 12:28:52 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1DD176EC5D Received: by smtp41.i.mail.ru with esmtpa (envelope-from ) id 1lTLXO-0006eP-SI; Mon, 05 Apr 2021 12:28:51 +0300 To: Cyrill Gorcunov , tml References: <20210402123420.885834-1-gorcunov@gmail.com> <20210402123420.885834-2-gorcunov@gmail.com> Message-ID: <01f1a611-8eb2-4d82-88f5-0f3912cbf6b0@tarantool.org> Date: Mon, 5 Apr 2021 12:28:50 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <20210402123420.885834-2-gorcunov@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E32947427BE79D20CABD4ABD7C98AF5DBFD37182A05F538085040CD4567B189885DE6E2D01C17E19DF4B7D707B40D8A8CAC43C17CDC854EBF48F5 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE78AC0750F3304E924EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063739E242D0556ED1DD8638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95C16EE06F5A270FE6AF1694BE67F761C7BC208A22DAB986A55A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE74601F13E4625331C9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C30D89974173551D4F117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CFDC273EBA2BDD0B15BA3038C0950A5D36C8A9BA7A39EFB766EC990983EF5C0329BA3038C0950A5D36D5E8D9A59859A8B6CEA38C397FF6A29276E601842F6C81A1F004C906525384307823802FF610243DF43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A3920E30A4C9C8E338DAA65EE29973F47D2F43847C11F186F3C59DAA53EE0834AAEE X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24A6D60772A99906F8E1CD14B953EB46DAD3D42735CF3BFE1355D89D7DBCDD132 X-C1DE0DAB: 0D63561A33F958A586FCB878337FA62C74F8F8B16E307F639775D7D55AFE79B1D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349320586B19AD2C722F989F758C6171F108DB6FA928E83CC42C36A76AFBBD9C8CE8EB75253ECFE5101D7E09C32AA3244C0903B8DB1FB900189218188129209C2081560E2432555DBB927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojM00ve/f+0omNgBPbV7oE+w== X-Mailru-Sender: 583F1D7ACE8F49BDD2846D59FC20E9F85DA50E75F52276B3D179C1406F8A7A2F286CA4C321A8DD1F424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v20 1/7] box/schema: make sure hashes are created X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Cc: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 02.04.2021 15:34, Cyrill Gorcunov пишет: > These are critical structures, strictly speaking > if malloc has failed we're likely under heavy memory > pressure and won't continue anyway but better to exit > explicitly. > > In-scope-of #4642 > > Signed-off-by: Cyrill Gorcunov > --- > src/box/schema.cc | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/src/box/schema.cc b/src/box/schema.cc > index 963278b19..89904e4d2 100644 > --- a/src/box/schema.cc > +++ b/src/box/schema.cc > @@ -372,6 +372,13 @@ schema_init(void) > funcs = mh_i32ptr_new(); > funcs_by_name = mh_strnptr_new(); > sequences = mh_i32ptr_new(); > + > + if (spaces == NULL || spaces_by_name == NULL || > + funcs == NULL || funcs_by_name == NULL || > + sequences == NULL) { > + panic("Can't allocate schema hashes"); > + } I've just noticed, all the mh_..._new methods will fail on a null dereference even before returning. So the check above doesn't make much sense. But I see that some other places have this check `if (smth = mh_smth_new() == NULL)` and set an error. Am I missing something? > + > /* > * Create surrogate space objects for the mandatory system > * spaces (the primal eggs from which we get all the -- Serge Petrenko