From owner-freebsd-questions@freebsd.org Fri Oct 18 22:50:53 2019 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51F2E15C887 for ; Fri, 18 Oct 2019 22:50:53 +0000 (UTC) (envelope-from mafsys1234@gmail.com) Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46w1Tm33cSz47Vr for ; Fri, 18 Oct 2019 22:50:52 +0000 (UTC) (envelope-from mafsys1234@gmail.com) Received: by mail-pg1-x543.google.com with SMTP id t3so4119084pga.8 for ; Fri, 18 Oct 2019 15:50:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=X81dG5hxkTuFZYTpu+xvgRGjVb8RTF/KLiQLJEvjdfQ=; b=Q5x6o5qsT6lzKVP6H72R1vmWxKYIILrrJHxkTbp8aX8MpUXsanUOm4xzX1j1r+08Xa lHqfK8TxJOXfUUFoPwkvkJMEN6PWiUiMikHfJE9el0Fy34Rwo6c6npX8jW7EyqCoWPPr +0/VdN5S6ArZlCIftd3lgyZfH5RhVbwpAMFGTTQQNBiAxQ2BbHYp0PBjbZEfLJ2u6d3H 502TZGXEuKCZ0dTm9IpTYRuxysQpfpngqutG6TUiDyn55iWuK+GE+tEaxcHqAmHbPPch Smk4N7JYm+6vuq8SFUeRauru1FIXc635vm3PQDQHLKcOPe13jf+PILsgVXm/bPMT3lC9 yBnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=X81dG5hxkTuFZYTpu+xvgRGjVb8RTF/KLiQLJEvjdfQ=; b=AtmqjcWBLPBizTbr3WuxELaP24G1SvxFaK/oe3vzAM2xjdXsvjnTq+rDL5TelVO0pn iCmjDeg++mEsZz/E4VEvZx50KhofPJ/J5IoU4yLjxQDh1SBMnNizGjVcz7O6PqdxgR/Z AI8Zesv1wtjmFbN8EJO+9lJwlr0Eo5RKNV9Ia79MPz3NQcU//XcGz8x/Z1NAkkGAAeYR UVdAgk2FMe5caiEbpOrnwZumQxh3h0GKEX1WByAPE4lmn2pfUDb1gJdNwDedm6KmvPTJ /YGWlfs9WMs5QBZicA6MiFyUvm0t9Rs6QOP+SHaGTg0Ly2HZvm77p/9NSfcnTALS/7RF x1kw== X-Gm-Message-State: APjAAAVPTYvUwkIyvsGH/0HgvlBFX8lWWj7BqrBVZe7YwBN8HXoRQrgj +z/3/OtoSmHXE2/k8Ouf73p7yAKo X-Google-Smtp-Source: APXvYqzdZmo9B4DxhER1sBST2wMk9MpqgC3Z+R7zz+yRQWIYmeLMQnHw2yEwSjgZ0KKCrGoIJ1mwaA== X-Received: by 2002:a63:3044:: with SMTP id w65mr12205245pgw.384.1571439049468; Fri, 18 Oct 2019 15:50:49 -0700 (PDT) Received: from [192.168.1.10] (C-59-101-161-221.mel.connect.net.au. [59.101.161.221]) by smtp.gmail.com with ESMTPSA id z18sm7565848pgv.90.2019.10.18.15.50.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Oct 2019 15:50:49 -0700 (PDT) Subject: Re: Avoiding LibreOffice DOS To: Andrea Venturoli , freebsd-questions@freebsd.org References: <62d45c64-ac95-43a7-5e39-9a94d26d323c@netfence.it> <96a4c0a3-9b48-3cf4-27a6-8d3753b42d87@gmail.com> From: MJ Message-ID: Date: Sat, 19 Oct 2019 09:50:18 +1100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Rspamd-Queue-Id: 46w1Tm33cSz47Vr X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=Q5x6o5qs; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mafsys1234@gmail.com designates 2607:f8b0:4864:20::543 as permitted sender) smtp.mailfrom=mafsys1234@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RECEIVED_SPAMHAUS_PBL(0.00)[221.161.101.59.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[3.4.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; IP_SCORE(0.00)[ip: (-0.83), ipnet: 2607:f8b0::/32(-2.46), asn: 15169(-2.09), country: US(-0.05)]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 22:50:53 -0000 On 18/10/2019 11:31 pm, Andrea Venturoli wrote: > On 2019-10-17 23:59, MJ wrote: > >>> As I said, I think it's a problem with memory. >> >> Oh did you? I saw you mention "vmemoryuse" but didn't understand whether you meant this was the cause or just an attempt to fix one cause. > > Sorry, maybe I should have made this clearer. > Yes, because I was under the impression this was about debugging a user program. It's no problem, just took a while to get to your specific issue. > > >> If it is memory related, perhaps you need to create a larger swap space. It might just get you over the hump of exhausting memory enough for Libreoffice to complete whatever it is it's trying to do. > > My guess is that it will use as much as it's available. > Of course, but if your goal was to debug the problem, this may have given you more time to trace it using dtrace or truss or your tool of choice. > > >> Conjecture? There's a tight loop. Possibly/likely a bug in libreoffice? > > Possibly, but, as I said, I'm trying to approach this from an OS perspective as a general case. > This time it was LibreOffice, but I was also able to reproduce this with different applications (e.g. remove swap, fire up a couple of VirtualBox VMs to eat most memory, open several pages in FireFox). > > So, what you're effectively attempting to achieve is debugging the kernel and how it handles memory reclamation/caching etc. In this case, you need to concentrate on not per-user but system wide. You need to begin to learn and experiment with things like vm.v_free_/*/  and all the various tweaks while using vmstat. In the extreme, you may need to look at setrlimit(2) and writing a test harness around a rogue memory-using program (I'm not sure of your level - if any - of programming knowledge). Apart from all that, it's just going to be you experimenting, setting limits, trying, re-trying etc. In which case, you would be mad not to do this in a virtual environment as I suggested. Regards Mark