From owner-freebsd-net@freebsd.org Mon Dec 4 10:46:36 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 3E2EEDF803F for ; Mon, 4 Dec 2017 10:46:36 +0000 (UTC) (envelope-from balint.martina@gmail.com) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 177BA3112 for ; Mon, 4 Dec 2017 10:46:36 +0000 (UTC) (envelope-from balint.martina@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 13F7ADF803C; Mon, 4 Dec 2017 10:46:36 +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 13653DF803B; Mon, 4 Dec 2017 10:46:36 +0000 (UTC) (envelope-from balint.martina@gmail.com) Received: from mail-pg0-x231.google.com (mail-pg0-x231.google.com [IPv6:2607:f8b0:400e:c05::231]) (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 D562A3111; Mon, 4 Dec 2017 10:46:35 +0000 (UTC) (envelope-from balint.martina@gmail.com) Received: by mail-pg0-x231.google.com with SMTP id m25so7900433pgv.12; Mon, 04 Dec 2017 02:46:35 -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=frGWheOLA9WDdJ1XU/6NvLoMolmdPxDdaCCJT2PQlIo=; b=L6mCeyxbe89rgRKXfQMrUujmMDveAzvRekdPxL2CWna/ItBIsBb+AW+H7tIDRFyFCp Br2QBPXARtJz9rIo3izp13poTzf1SDUoMspKexxKFAsPYMnB16kdtGgf8CaZaUuPLGP8 IRdGgaw3aBtKgWkiAv8UmzNqcAMzAYO7OfnSV9DAojXSkKjaepCsK+Uzu6O8GIDY62HS Gcg32Xx4UsSwgJbGa42Tv3K5k4miV1rVT/89aJo7/JIaNET7U1YwwhVteqeGbURr0Zx4 H2gX7BI63F82nTd+ratC/EY32GCuFXLu/oorJfzigdIm2OxBBZiSnnL0ecev9h2MUg44 h29g== 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=frGWheOLA9WDdJ1XU/6NvLoMolmdPxDdaCCJT2PQlIo=; b=ftAUyqBJt4PTbkpOX+J2pyLlEPZkCt0bo/l+Ip4M2bDzmc51SirY6WxG+Fuc53HrZD 9X36VFkoibF9Dvo1+8YKFTOSWJUuY+IEH+nt0zhTfPTq/Ur/iZKiiMg5JYlpWuWaKl35 y15RqIo36FfI45Rbw8QaEtNtubS1DphWGsU+yrAZ0VeQY1tpAhW/EJJlabobzJ5Cmjjt r8H3uiMfzYuPhZS69VTpNLlA1pVoAluBb3jk7tRYWOUCfs13zJYsQjQL327reHlK2NYd a+GB/Pe1RRyk/vY4H52nHMXMVkURgshAYl0kU5p6bqyjmwzlg8IRZEIoruaM4IM4dHA5 g9UQ== X-Gm-Message-State: AJaThX5RIiZDw0kDLpPJNlgvCgtjM9B+moLfTqnhvqaKXEyrG28lSK24 N1VitankUmyOz/cn0zphMSn9juCKyR69i8hTl8Q= X-Google-Smtp-Source: AGs4zMbJ6KVhHvSQHt7enjRWNLlqQlmFT4i5hdMd5qDjq0Uee56ibk4XlJPk9eu1tQ26QULo42gLUb7Z/lAFdFAzH00= X-Received: by 10.99.54.70 with SMTP id d67mr13851639pga.52.1512384395362; Mon, 04 Dec 2017 02:46:35 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.167.142 with HTTP; Mon, 4 Dec 2017 02:46:34 -0800 (PST) Received: by 10.236.167.142 with HTTP; Mon, 4 Dec 2017 02:46:34 -0800 (PST) In-Reply-To: References: From: Martina Balintova Date: Mon, 4 Dec 2017 10:46:34 +0000 Message-ID: Subject: Re: Netmap ouch double free To: Vincenzo Maffione Cc: freebsd-net@freebsd.org, net@freebsd.org, g.lettieri@iet.unipi.it 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: Mon, 04 Dec 2017 10:46:36 -0000 Hi Vincenzo, Thank you for pointing me in right direction. Yes indeed, those were overflow buffers that did the trick. I did not point them back before closing. (I am using linux). Martina On Dec 3, 2017 08:56, "Vincenzo Maffione" wrote: > 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 >