From patchwork Wed Mar 28 15:02:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bugzilla-daemon@bugs.linaro.org X-Patchwork-Id: 132533 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp582240ljb; Wed, 28 Mar 2018 08:02:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+4n8L1n2ULKCnUFccbyL9KmTBntaDg7AZlOvCS0rCl9bA63G+W1YA+3pvqrifODEmTFAMC X-Received: by 10.129.226.65 with SMTP id z1mr2383157ywl.333.1522249351573; Wed, 28 Mar 2018 08:02:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522249351; cv=none; d=google.com; s=arc-20160816; b=wMEwC6BIG0jndCBA7MgUbxrBoGFh3Lph2wozNiPjCc/5WNggHT+WfN8OchKubqxJq3 TVI/IkqgGwJ/AZAvKRgOU8RJ1RAZGss7teHxA8YyK83o63RrAO0AIvwqgX4bZfk64qMR 6w1dha38eeK8eWCewPAJ8bBV5XnHtqUL6UJLIfwDZ9KT9tweXU9w4m1lWTf1Br6kyJM+ /88uIUXs2xdfFxKRbOoyB1/ZJz2aU/TgnVlPLqQZ1+JwWrq+vWWFGZzzgwznLgxNyDP/ SGUjrSy3NmbY789XOwWtLeQXp2lTzRFxKF9JV+sk5cJKg5pBjJ28rPvp6Qld3XfP88Fl lLdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:feedback-id:mime-version:auto-submitted :message-id:date:to:from:delivered-to:arc-authentication-results; bh=XdROTthXTzevqW6KBfxxpi8r5B8wf85Rq4ugt3XQYCE=; b=RtbI5D64Ky1i52r8evBWeknULKPCDwCLiv8jrSH6TWCmhojzkMa26gUtLq75gGXp90 ztyeZrmuODNmXfjBbi+i6ZXsBkQoxoEgJUXyAcxSt1h6IqMgscCYOfoE+LvsstP0bW9S LnEc/o3lWEmPGwWWzVcFp0ICevBqQDd7ImwF5MdmcEUML7tjML4UBKFW7T6021qzT5L1 X81FEu4eaA78Wkq3aWyKTuJzc4pV8CQb6Ha+EEODiGywWhc8Rir2+LJMeALACB54kfLh i70qHm2gLNZTCDfBPZnZ3GmKD+nfVIRgGcFAUagF5+dYZHbiaatw7YNliml86AQaI1iB RnFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id g205-v6si770932ybg.300.2018.03.28.08.02.30; Wed, 28 Mar 2018 08:02:31 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 73D9263C7B; Wed, 28 Mar 2018 15:02:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 341C762801; Wed, 28 Mar 2018 15:02:19 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 48FB162801; Wed, 28 Mar 2018 15:02:12 +0000 (UTC) Received: from a8-128.smtp-out.amazonses.com (a8-128.smtp-out.amazonses.com [54.240.8.128]) by lists.linaro.org (Postfix) with ESMTPS id 59AF96176F for ; Wed, 28 Mar 2018 15:02:06 +0000 (UTC) From: bugzilla-daemon@bugs.linaro.org To: lng-odp@lists.linaro.org Date: Wed, 28 Mar 2018 15:02:05 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: OpenDataPlane - linux- generic reference X-Bugzilla-Component: Shared Memory X-Bugzilla-Version: master X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: janne.peltonen@nokia.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: christophe.milard@linaro.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: <010001626d215bf8-93dc4a72-2500-4337-96f5-7f4b824c5498-000000@email.amazonses.com> X-Bugzilla-URL: https://bugs.linaro.org/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SES-Outgoing: 2018.03.28-54.240.8.128 Feedback-ID: 1.us-east-1.Y2eXJruXwxqfBntQfC4/6O4zDrCY0XKEghZ/yI2DADM=:AmazonSES X-Content-Filtered-By: Mailman/MimeDel 2.1.16 Subject: [lng-odp] [Bug 3690] New: fdserver process interferes with signal handling X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" https://bugs.linaro.org/show_bug.cgi?id=3690 Bug ID: 3690 Summary: fdserver process interferes with signal handling Product: OpenDataPlane - linux- generic reference Version: master Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: --- Component: Shared Memory Assignee: christophe.milard@linaro.org Reporter: janne.peltonen@nokia.com CC: lng-odp@lists.linaro.org Target Milestone: --- The SHM implementation forks a child process that will stay in the same process group as the parent and will thus receive the signals sent to the group. One situation where this happens is when an ODP application is run in a shell and ctrl-C is pressed. An application may set a signal handler to handle ctrl-C presses in some controlled way, but now there are two problems caused by the fdserver: 1) The signal handler set by the application runs also in the context of the fdserver process. The handler may misbehave because the environment in the fdserver process can be different than in the application controlled processes. 2) Even if the signal handler runs correctly in the fdserver process context, the main loop of fdserver is not prepared to have its accept() call interrupted by a signal, causing fdserver to exit. I bumped into this when wondering about annoying error messages that I got when stopping the fpm example application of OFP. Problem 1) caused the signal handler to segfault and if that is fixed in fpm (by doing less in the handler) then problem 2) would still cause the same error messages. I am not sure what the right fix would be. Maybe fdserver should do setsid() to detach itself from the parent's process group, or maybe not because then it could not output its error messages to the terminal anymore. Or maybe it should just mask a bunch a signals. I think fdserver should at least handle EINTR errors so that an application like fpm can try to handle the rest. This would suffice (some indentation fixes included): -- You are receiving this mail because: You are on the CC list for the bug. diff --git a/platform/linux-generic/_fdserver.c b/platform/linux-generic/_fdserver.c index 065736f0..af9ca4a0 100644 --- a/platform/linux-generic/_fdserver.c +++ b/platform/linux-generic/_fdserver.c @@ -559,8 +559,11 @@ static void wait_requests(int sock) addr_sz = sizeof(remote); c_socket = accept(sock, (struct sockaddr *)&remote, &addr_sz); if (c_socket == -1) { - ODP_ERR("wait_requests: %s\n", strerror(errno)); - return; + if (errno == EINTR) + continue; + + ODP_ERR("wait_requests: %s\n", strerror(errno)); + return; }