Message ID | 20191208122844.11642-4-sbabic@denx.de |
---|---|
State | Accepted |
Headers | show
Return-Path: <swupdate+bncBCXPLOXJ6IKRBCOZWPXQKGQEHZ2PU5Q@googlegroups.com> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::43f; helo=mail-wr1-x43f.google.com; envelope-from=swupdate+bncbcxploxj6ikrbcozwpxqkgqehz2pu5q@googlegroups.com; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="DF9Nzt5w"; dkim-atps=neutral Received: from mail-wr1-x43f.google.com (mail-wr1-x43f.google.com [IPv6:2a00:1450:4864:20::43f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47W5Gh2cNhz9sPK for <incoming@patchwork.ozlabs.org>; Sun, 8 Dec 2019 23:29:00 +1100 (AEDT) Received: by mail-wr1-x43f.google.com with SMTP id h30sf5919163wrh.5 for <incoming@patchwork.ozlabs.org>; Sun, 08 Dec 2019 04:29:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1575808138; cv=pass; d=google.com; s=arc-20160816; b=rgfcIfmOrMIUQeLmCMqog5Vep9qZScTtlpFPlwVCn2aGQ4sHAxK05THpAD1UNJXE1M WtIa2Sv5TwJOzyRIC2bna/6hfBt3kJ1kTgY/atLX0SjQT4qdenNv/N5ocYWgn2T8b8cm J8RXNOqrkOLkGd4DRYGBp+qrP3zEFrCFruVMOEF0mUQ0mXywaznFrWpOXWKqbUcMTakt wRA+vlv6sjlmXjDpnQfTcaDCPyIL467IG1GUBQnFuX6KZR2uHCLVpFv0OO0Bnl0Evw4t mE5VH087E+9jMeDNVhPzJGzbEMdRrD4ZaPM2DWDA5bfwjdKENApeTLF83DOZi41D1V0N ypXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:mime-version:sender:dkim-signature; bh=pcLYn/2UAzRnfsg20q21X4ZgVpF+jghlOIQQRTIOJ9c=; b=Wye4cnNog4hQiRs4Ml1/oAfQJ0gEDvlOuWIbMutNZ9xks7He10xWqZAg93qpQODoJ0 qpjQn+Z9aNujLwilZCvN18goctpr4JDAE2Xjno6bhmFWg8VHvcugo5WezyC+XevDg+PW 1AIZMMD8CaUxDRxl0TO/Z8AOL/pc/n5r20UHhztIs2A5XTedYWKa4RUIy00PtYcdiOsl AwPjqZRIQ2iDXMTxikDiJBnFk8vgwvXHXd8Sc+dFp5b+kWaNiMJApu7ZKW3fUktZ5pwB YZak4H/evR8yY9U8JLQGzJZ3S5tBkE2eU8bRxV8y2mT4HFS1mnSjMFZAIBuHRmhfQ6pB ytxA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=pcLYn/2UAzRnfsg20q21X4ZgVpF+jghlOIQQRTIOJ9c=; b=DF9Nzt5wwMYpoGQITBkQyXpqosWqTAyWeH9stPvWOoYA412XJ0mixfhKiHscAWln87 CDow4pmjj2AAFnX6/7bDfM/HOpxAaxuL69V0B9vimuJkwvotqmLFPJzdXXfsUz99IS2C /7xQ1B5US7BcTYglThnFut/6budOpunoY1XPpB/WSJt1glT1L3Ftiba/eRolxUX16GaA lRPcm85kyeJOa9ksO8zTgKhE3YoUUdFEKqJushlkMsS8F1omD7LVDZH0n3/Hg3sMt+Gg SDcJWj2GvuNS4qwVZui8Jm5SPhLQevG4EpnjRMyAh/Qkt07IsiJUVSZYaLvPt+3oSCwC u98w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=pcLYn/2UAzRnfsg20q21X4ZgVpF+jghlOIQQRTIOJ9c=; b=NwQlouWO6Vjrkt/gBhc/qq6bL2I+f2y/3rZ+GQiVS0sm2L2TTcpIZiA9mihfBSuXfZ pC08ZjZeZlh8laG34irOxrTZKvSXXnyW2p9W9Q7QlhUoAhypy4KWU5Tajs38OmpU1TOe kn26zbVGGMD5h2vUjbsIdayr0KZehc8I6R9DTMhdhu+l+6L9+TpZMG0CTNxdyqqHEd/o 0TONYoRDlotlajFjudkAEWK3k/iCZFBtWbPSkwdmE435HrzU6e8+jEWx3DiFz++b+5HF m+wSdqk/CcQKIqpLpWzUCpH0o5BSms/qH0b4cWi0A1SQgOGH7ETLZpyFy6TeQ/P4y2gw DV2Q== Sender: swupdate@googlegroups.com X-Gm-Message-State: APjAAAVIN0COiuDxgxxrZ1d4H5SPOw2B5ihH9Fg3Rf++7VlaUHNC+4Bo /Se1bBFhCfuRbE033XdAcTk= X-Google-Smtp-Source: APXvYqz5Qx+7CpIO0DJJud9ixcCr47W7piYZE4eFfP7jbjjlQTvEHLzwjhjoH6ZFYxTbJ25UhPUswg== X-Received: by 2002:a7b:c24c:: with SMTP id b12mr19861533wmj.16.1575808138026; Sun, 08 Dec 2019 04:28:58 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a5d:6912:: with SMTP id t18ls4318875wru.7.gmail; Sun, 08 Dec 2019 04:28:57 -0800 (PST) X-Received: by 2002:a5d:4d8d:: with SMTP id b13mr27097930wru.6.1575808137489; Sun, 08 Dec 2019 04:28:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575808137; cv=none; d=google.com; s=arc-20160816; b=1E6wIhuhODNPwPECen82Wqt7Gbr/eAG3u7HJiIutq/b5lnmHNzUPmtjImDwQXiJBNq k9Hqmm70kSqI1rj00KAEWwe4On7Rhm9dF86qx6j0Y1d7J8Ytg3kJjA9ZiU+9JVvzugcN HZLhYlk1NAMvruSEbJEaDEmGsFJtWDU79Gqv8ONM1yjdFAAKDixexpdIJtIvQVFATA3J G2M2H6iE7DGufsuOL7/Mjp7uERT8M48z7PGRHVfs7rAKd4JMBxT98nEXSF2Oi4sTxR0o tY22l34qmP2R+63BgWJvRoQeopufWSvMTRPSoKegYEtKEBH5pQvuwMzmMFrtQ3kErXHT PvkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=1fX7UIppH7CWGXD/BWUvObdCfmZecH6FMkGHLhOO5tY=; b=ZOKXuhNVwSMEfwVokofVIqflUaRh/lvqEQYTCzYZidkS4jLqv+me/eclMv97UN3d45 ZNyZ8G/oeJHEikObxf0eqDBWuK+J0NIIuZzIB7QITk0xnGOR9ajipZioQSAOXBxHucNr EE4dtDizENPZ7dMYmESoN0onf4PVRn4mg2Bg8wFzCNJqvgSEtb3qcGmjD3KCHsiUDSyG N0TE3yHZXsRK1r12WNCjR6d6Ez9AVtcXLqBldt2ONGQQ5oiml2eIFq1TTAeItAMlSDsm 2DuoGEo5fT+JILhk3dfOq5EYbPmO4x5JKuIwLubxGagEM2Y86OBy3oL/tvNUUubZRift A69w== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.10]) by gmr-mx.google.com with ESMTPS id j65si477495wmj.2.2019.12.08.04.28.57 for <swupdate@googlegroups.com> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Dec 2019 04:28:57 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.10; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 47W5Gd2MvLz1rQBD; Sun, 8 Dec 2019 13:28:57 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 47W5Gd28Dqz1rYb3; Sun, 8 Dec 2019 13:28:57 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id zk0ayPPuD66S; Sun, 8 Dec 2019 13:28:56 +0100 (CET) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Sun, 8 Dec 2019 13:28:56 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 4979545404F9; Sun, 8 Dec 2019 13:28:56 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([IPv6:::1]) by localhost (mail.babic.homelinux.org [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 73o0DOM-j7Pi; Sun, 8 Dec 2019 13:28:53 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 5C84A4540508; Sun, 8 Dec 2019 13:28:46 +0100 (CET) From: Stefano Babic <sbabic@denx.de> To: swupdate@googlegroups.com Cc: Stefano Babic <sbabic@denx.de> Subject: [swupdate] [PATCH 4/6] mongoose: set receive limit to 256KB Date: Sun, 8 Dec 2019 13:28:42 +0100 Message-Id: <20191208122844.11642-4-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191208122844.11642-1-sbabic@denx.de> References: <20191208122844.11642-1-sbabic@denx.de> X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: <swupdate.googlegroups.com> X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: <https://groups.google.com/group/swupdate/post>, <mailto:swupdate@googlegroups.com> List-Help: <https://groups.google.com/support/>, <mailto:swupdate+help@googlegroups.com> List-Archive: <https://groups.google.com/group/swupdate List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>, <mailto:swupdate+subscribe@googlegroups.com> List-Unsubscribe: <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>, <https://groups.google.com/group/swupdate/subscribe> |
Series | [1/6] Updated mongoose to 6.16 | expand |
diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c index a4253b4..3296bc3 100644 --- a/mongoose/mongoose_interface.c +++ b/mongoose/mongoose_interface.c @@ -586,6 +586,15 @@ int start_mongoose(const char *cfgfname, int argc, char *argv[]) exit(EXIT_FAILURE); } + /* + * The Event Handler in Webserver will read from socket until there is data. + * This does not guarantes a flow control because data are forwarded + * to SWUpdate internal IPC. If this is not called in blocking mode, + * the Webserver should just read from socket to fill the IPC, but without + * filling all memory. + */ + nc->recv_mbuf_limit = 256 * 1024; + mg_set_protocol_http_websocket(nc); mg_register_http_endpoint(nc, "/restart", restart_handler); mg_register_http_endpoint(nc, "/upload", MG_CB(upload_handler, NULL));
After 6.132, mongoose introduces with commit 93286836f944cf71c0f344eab8c1b0a29666f82a that all data are read from socket during receive poll. This can exhaust memory and cause a deadlock, because the transfer to IPC is much slower. Avoid to read full data and sync the receive with IPC by setting a limit for the incoming data to be quite the same as the size of the UDS in the IPC. Signed-off-by: Stefano Babic <sbabic@denx.de> --- mongoose/mongoose_interface.c | 9 +++++++++ 1 file changed, 9 insertions(+)