From owner-freebsd-net@freebsd.org Sun Dec 3 08:56:49 2017 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD65ADF4A5D for ; Sun, 3 Dec 2017 08:56:49 +0000 (UTC) (envelope-from v.maffione@gmail.com) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id A8223713FB for ; Sun, 3 Dec 2017 08:56:49 +0000 (UTC) (envelope-from v.maffione@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id A7577DF4A5C; Sun, 3 Dec 2017 08:56:49 +0000 (UTC) Delivered-To: net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6CA2DF4A5B for ; Sun, 3 Dec 2017 08:56:49 +0000 (UTC) (envelope-from v.maffione@gmail.com) Received: from mail-qt0-x229.google.com (mail-qt0-x229.google.com [IPv6:2607:f8b0:400d:c0d::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5E227713FA for ; Sun, 3 Dec 2017 08:56:49 +0000 (UTC) (envelope-from v.maffione@gmail.com) Received: by mail-qt0-x229.google.com with SMTP id w10so17869548qtb.10 for ; Sun, 03 Dec 2017 00:56:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=5HQbplQTpJ8AMNWXyl9jaini5wN23aEc9pxOIPoyjIw=; b=I4hUxAcr6q7nJbKedH+YqII8X04ThvHTaJVLCtYN66izxvQ4jnLpNOdaZY10wbEZkj M3NC+zwvkK6MApEIYCENwqOCHB/FHjlB9aYRyhPGln+9+5IlgUa/d0U4SHgsvCqIca+s /1zh2erD4W6/98ESpVLyomy/YISFAZ3/LEok3ujMpblIt/PMq/gfUg4bWgoV6fyf3OyO yCIFAR5WHItWh5ppvBxUVIbUvCe2nT1ROJZjb6Z57kTF4QE1c+bqQsQhFg0DlcgV/CZI B8r3SZ48HTlXFChZpSJwbvRGsZBIOEWvetm1GqmK9XpAKPtsVVSCteJxQWw4nV/DFNkU UgpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=5HQbplQTpJ8AMNWXyl9jaini5wN23aEc9pxOIPoyjIw=; b=dn+5BpFOWttNGo5Oap3t6STAdf+G1jl/XSt9AiDRtVqttyuL1ytUdbxH5kbRd4Z/ti qorZRaXtzMxDi+i/7RgnrBSGKXpQ9JJPCLQaxaCCxG9SprKiTm3iWpsrqZwKJlBhNsrL kktjCCkEL4Wk3TIZz0e1kEPUqXD/y6cNu2+fRTLrkLq4Etf8IeozsTf5egunLLxn41f7 rckNq4f1ckLszZMhup4srl6L26QfxsA5uiLrEqFtQFHGvG6THytQX86y5iFhK96VvTO9 JdpU9haqDP91ZJ2grBPSvJYPjsL2h5jR9pL2cJ/o8lTpEyteByGP3/Ie21aZKjydLNP+ arvg== X-Gm-Message-State: AKGB3mLf5wHsAWRXoyjt4bdl3JCBQBALoFeeC8RYch72Hspu8EYLUH86 hy7EM+HAuVYC7gygJRnbdTY3lxtXyHLQZwCxNnM= X-Google-Smtp-Source: AGs4zMYTSsNjyIKmXOdFPp7R0vGN0YGVL3GhDgSxm4BEadqWi6OzOd+gyOitfe4Lkav4Re62B1ZXryxdJdUUB4CvncA= X-Received: by 10.200.2.150 with SMTP id p22mr16750425qtg.328.1512291408289; Sun, 03 Dec 2017 00:56:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.174.5 with HTTP; Sun, 3 Dec 2017 00:56:47 -0800 (PST) In-Reply-To: References: From: Vincenzo Maffione Date: Sun, 3 Dec 2017 09:56:47 +0100 Message-ID: Subject: Re: Netmap ouch double free To: Martina Balintova Cc: "freebsd-net@freebsd.org" , Giuseppe Lettieri Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Dec 2017 08:56:49 -0000 Hi, It may be related to the "extra buffers feature" of netmap, that lb uses. When the netmap port is opened, some additional buffers (not bound to any netmap ring) are allocated to be used by the application for slot swapping. They are provided through the ni_bufs_head field as a linked list (see updated netmap manual https://github.com/luigirizzo/netmap/blob/master/share/man/man4/netmap.4 ). To free them, the free list must be returned when closing the netmap file descriptor, using the same ni_bufs_head field. To check if this is true you could make sure that you are using "-B 0" option, which means no extra buffers are used. Are you using the latest netmap code from github? Are you using FreeBSD or Linux? Cheers, Vincenzo 2017-12-01 15:21 GMT+01:00 Martina Balintova : > Hi, > I am currently playing with lb app in netmap. Every time I kill/close it, > the app hangs for some time and does not end immediately. In syslogs I am > getting: > ' > Netmap_do_unregif deleting last instance for myapp{1 > Netmap_do_deref active=5 > Netnap_obj_free ouch, double free on buffer 27777 > Netmap_extra_free freed 0 buffers > ' > > This happens when I have some consumer on the pipe and at some point during > whole lb lifetime, it did not consume all packets (resulting in oq being > filled or packets being dropped). If the pipe did not ever have a consumer, > then it will not end up in the double free. > I am finding it quite hard to debug in gdb, as this is happening at the > shutdown. > Could someone pls point me to reason? > > I am running lb with one interface and 2 groups, different numb of pipes > per group and this happens even with no extra buffers. > > Martina > _______________________________________________ > freebsd-net@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > -- Vincenzo Maffione