Date: Thu, 17 Sep 2020 23:39:01 +0000 From: bugzilla-noreply@freebsd.org To: ports-bugs@FreeBSD.org Subject: [Bug 249412] devel/json-c: Avoid use of newlocale(3) that results in increasing memory usage Message-ID: <bug-249412-7788@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D249412 Bug ID: 249412 Summary: devel/json-c: Avoid use of newlocale(3) that results in increasing memory usage Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: Individual Port(s) Assignee: sunpoet@FreeBSD.org Reporter: leres@freebsd.org Flags: maintainer-feedback?(sunpoet@FreeBSD.org) Assignee: sunpoet@FreeBSD.org Starting with github hash bf29aa0 and in between the 0.13.1 and 0.14 releas= es, json-c uses newlocale(3) which appears to cause increased memory usage on e= ach call when base is supplied. We have a persistent daemon that repeatedly parses some trivial json from a piece of network equipment. This software was developed while the FreeBSD devel/json-c port was at 0.13.1 (or older). The json-c port was updated to = 0.14 in May 2020 and to 0.15 in mid August. After the 0.15 update the daemon was rebuilt/installed and after ~12 hours of operation would crash due to memory exhaustion. Eventually we determined that downgrading to 0.13.1 solved the memory growth. I wrote a test program that calls json_tokener_parse() followed by json_object_put() in a loop; rss slowly increases for every loop. I opened this upstream ticket: https://github.com/json-c/json-c/issues/668 Eric Hawicz responded, suggesting that FreeBSD's implementation of newlocal= e() might be causing the issue. His helpful test program confirms this. Looking at the first version of json-c to has the issue: https://github.com/json-c/json-c/commit/bf29aa0 HAVE_USELOCALE is defined when locale.h is present. This results in a diffe= rent codepath in json_tokener.c where newlocale() is used instead of setlocale(). I'll submit a seperate PR for the newlocale() issue. The attached patch comments out HAVE_USELOCALE in post-configure to avoid t= he use of newlocale(). Also attached is a json-c test program which uses sysct= l() to automatically track and report changes to rss and vsz and clearly shows = the issue. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-249412-7788>