From rjk at terraraq.uk Thu Aug 7 17:42:18 2025 From: rjk at terraraq.uk (Richard Kettlewell) Date: Thu, 7 Aug 2025 18:42:18 +0100 Subject: msync - can someone shed some light please? In-Reply-To: <148b7fed-2e20-4861-8cc0-9468a6fb2650@terraraq.uk> References: <6a3ce1a5-286a-4599-a987-817309a6467d@trigofacile.com> <148b7fed-2e20-4861-8cc0-9468a6fb2650@terraraq.uk> Message-ID: <078d0355-615a-4906-918f-28562b3ec3a8@terraraq.uk> On 13/06/2025 22:55, Richard Kettlewell wrote: > Julien ?LIE wrote: >> Hi Chris, >> >>> When adding groups (ctlinnd newgroup?), the following occurs: >>> >>> 2025-06-12T14:14:57.572314+02:00 nntpspool innd: SERVER msync >>> failed / var/lib/news/active 0x0x7f3f46800000 5062656 Cannot allocate >>> memory [...] > Assuming the page size is 4096 bytes: > * p = 0x7f3f46800000 is already page-aligned so start = p > * length = 5062656 is a multiple of 4096, > ? so we will get end = p + length + 4096, > ? given end-start = length+4096. > > The effect is that INN will attempt to msync 4096 bytes beyond the end > of the mapping. > > In https://man7.org/linux/man-pages/man2/msync.2.html doing this is > documented as being an error. The error code is consistent with the log > message: > > ?????? ENOMEM The indicated memory (or part of it) was not mapped. > > If length % 4096 > 0 then the effect would just be to round up to an > exact number of pages, avoiding the error. So we'd expect to see the > error in 1/4096 (about 0.025%) of possible active files sizes. As luck would have it I am now seeing the same error on one of my servers, and indeed: -rw-rw-r-- 1 news news 1499136 Aug 7 04:15 /var/lib/news/active ...which is a multiple of 4096. I have deleted a couple of groups I don't care about l-) ttfn/rjk From julien at trigofacile.com Thu Aug 7 20:01:36 2025 From: julien at trigofacile.com (=?UTF-8?Q?Julien_=C3=89LIE?=) Date: Thu, 7 Aug 2025 22:01:36 +0200 Subject: msync - can someone shed some light please? In-Reply-To: <078d0355-615a-4906-918f-28562b3ec3a8@terraraq.uk> References: <6a3ce1a5-286a-4599-a987-817309a6467d@trigofacile.com> <148b7fed-2e20-4861-8cc0-9468a6fb2650@terraraq.uk> <078d0355-615a-4906-918f-28562b3ec3a8@terraraq.uk> Message-ID: Hi Richard, >> If length % 4096 > 0 then the effect would just be to round up to an >> exact number of pages, avoiding the error. So we'd expect to see the >> error in 1/4096 (about 0.025%) of possible active files sizes. > > As luck would have it I am now seeing the same error on one of my > servers, and indeed: > > -rw-rw-r-- 1 news news 1499136 Aug? 7 04:15 /var/lib/news/active > > ...which is a multiple of 4096. Oh, what a coincidence! Thanks for confirming the origin of the bug, and therefore that the fix is the right one. I committed it in June; it will be shipped with the next 2.7.4 release: https://github.com/InterNetNews/inn/commit/a219d093447d20c8c73c2df70d8b27c955bfdf23 -- Julien ?LIE ??I think it's a new feature. Don't tell anyone it was an accident.?? (Larry Wall)