DPDK patches and discussions
 help / color / mirror / Atom feed
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [Bug 1030] rte_malloc() and rte_free() get stuck when used with signal handler
Date: Thu, 09 Jun 2022 12:47:43 +0000	[thread overview]
Message-ID: <bug-1030-3@http.bugs.dpdk.org/> (raw)

https://bugs.dpdk.org/show_bug.cgi?id=1030

            Bug ID: 1030
           Summary: rte_malloc() and rte_free() get stuck when used with
                    signal handler
           Product: DPDK
           Version: 22.03
          Hardware: All
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: core
          Assignee: dev@dpdk.org
          Reporter: sarosh.arif@emumba.com
  Target Milestone: ---

Created attachment 205
  --> https://bugs.dpdk.org/attachment.cgi?id=205&action=edit
calls rte_malloc and rte_free in the handler and main code

I have a dpdk based application which uses rte_malloc() and rte_free()
frequently in it's main code. The general method to close the application is
though sending SIGINT. The application has a signal handler written for cleanup
purposes before closing the application. The handler also uses rte_free() to
release some of the memory during cleanup. The application gets stuck in a
deadlock.


Upon investigation I found out that both rte_free() and rte_malloc() use
rte_spinlock_lock() function to place a lock on heap. While this lock is placed
and the application receives SIGINT, it goes into the handler without releasing
the lock. Since the handler itself calls rte_free() which tries to acquire the
lock it gets stuck. 


I have attached a sample application to reproduce this problem.


Steps to reproduce this problem: 

1. compile the code provided in attachment with any version of dpdk 
2. run the compiled binary
3. press ctrl+c till the prints stop 

Actual Results: 
The application gets stuck in either rte_free() or rte_malloc()

Expected Results: 
Application should allocate and free the memory without getting stuck

-- 
You are receiving this mail because:
You are the assignee for the bug.

             reply	other threads:[~2022-06-09 12:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 12:47 bugzilla [this message]
2022-06-09 15:25 ` Stephen Hemminger
2022-06-10  6:04   ` Sarosh Arif
2022-06-11 16:25     ` Mattias Rönnblom
2022-06-13  9:48       ` Sarosh Arif
2022-10-05 17:30         ` Stephen Hemminger
2022-11-16  9:37 ` bugzilla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-1030-3@http.bugs.dpdk.org/ \
    --to=bugzilla@dpdk.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).