From dev-return-1657-archive-asf-public=cust-asf.ponee.io@openwhisk.apache.org Fri Mar 9 12:47:44 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 2D0D718064A for ; Fri, 9 Mar 2018 12:47:44 +0100 (CET) Received: (qmail 14648 invoked by uid 500); 9 Mar 2018 11:47:43 -0000 Mailing-List: contact dev-help@openwhisk.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openwhisk.apache.org Delivered-To: mailing list dev@openwhisk.apache.org Received: (qmail 14632 invoked by uid 99); 9 Mar 2018 11:47:42 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Mar 2018 11:47:42 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 0DDBBC2324 for ; Fri, 9 Mar 2018 11:47:42 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.001 X-Spam-Level: X-Spam-Status: No, score=-0.001 tagged_above=-999 required=6.31 tests=[SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id jS5trv-c6Qzm for ; Fri, 9 Mar 2018 11:47:40 +0000 (UTC) Received: from mail.inspired-networks.co.uk (pt.may.be [54.38.39.66]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 935745F3CE for ; Fri, 9 Mar 2018 11:47:39 +0000 (UTC) Received: from [10.20.30.15] (HELO mx.might.be) by mail.inspired-networks.co.uk (CommuniGate Pro SMTP 5.1.12) with ESMTPS id 47639528 for dev@openwhisk.apache.org; Fri, 09 Mar 2018 11:47:32 +0000 Received: from host81-141-81-159.in-addr.btcentralplus.com [81.141.81.159] (EHLO [192.168.1.17]) by mail.19ft.com with ESMTPSA id QF9pVMIZChds (authenticated user: akrabat@akrabat.com) for dev@openwhisk.apache.org; Fri Mar 09 2018 11:47:32 GMT+0000 (GMT) X-Proxy: smtp-proxy (trusted) version 3.4.3 on mail.19ft.com with TLS From: Rob Allen Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: [LONG] Discussing my implementation of Go actions Date: Fri, 9 Mar 2018 11:47:31 +0000 References: <1520594005.1059955.1297179240.0E81AC97@webmail.messagingengine.com> To: dev@openwhisk.apache.org In-Reply-To: <1520594005.1059955.1297179240.0E81AC97@webmail.messagingengine.com> Message-Id: X-Mailer: Apple Mail (2.3445.5.20) Hey Michele, Great to see your work become a PR.=20 > On 9 Mar 2018, at 11:13, Michele Sciabarra = wrote: >=20 > 1) =E2=80=8Bremove the header {"openwhisk":1} >=20 > Actually initially it was not there. But I decided to add this = requirements because the action need to speak a protocol ANYWAY.=20 >=20 > Most important, I explain why I require it starts with "{"openwhisk: = 1}". >=20 > The main reason is: I start the child process at init time, and I = wanted to detect when it does not behave properly. >=20 > The simplest problem happens when the action crashes immediately. For = example, a common reason for this problem is uploading a binary using = some dynamic libraries not available in the runtime. For example a = swift action. By defaults it load a lot of different libraries, it = crashes immediately but I cannot detect it until I try to read its = stdin. >=20 > I can remove this requirement if someone can show me the go code to = check that cmd.Start("true") or cmd.Start("pwd") exited =F0=9F=98=83 >=20 > If it is not doable, and I skip the handshake, even if the command = crashed, I will not detect the problem until a /run is executed and the = action times out... >=20 > Carlos say it is fine. It is ok for me but I still think an early = problem detection would be better. Also James recommended me to provide = as much as error detection to the user as early as possible. Kinda of = conflicting directives here... >=20 > Suggestions? I would prefer it not be there, but can see the convenience of detecting = that an app has immediately crashed. If we can find another way to do = that via process inspection, that would be better in my view. > 2) more checks at init time >=20 > I added some sanity checks. Probably too many. I tried to detect the = error at deployment time, not at invocation time. >=20 > This is different from what currently for example dockerskeleton does. >=20 > If I upload for example something wrong, like a non-zip, a non-elf = executable, my init returns {"error": "description"}, while currently = the dockerskeleton returns always OK. >=20 > Recommendations here? Personally, I'm in favour of detecting early when possible. I think most = of the language specific runtimes do sanity checking in /init. > 3) output to another channel the result >=20 > Currently I require logs goes to stderr, and stdout is for interacting = with the parent process. >=20 > Rodric suggested to output to a separate channel (channel 3?) and use = stdout and stderr for logs.=20 >=20 > While doable, I need to provision another pipe, and the implementation = should probably do some syscalls to retrieve file descriptor 3. It would = complicate implementation, while currently it is straightforward for any = language that does not have a library available. For swift, even to = flush stdout I needed to write "linux specific" code... I do not dare to = think what I need to do to write in fd3... >=20 > My opinion is that using stdout for I/O and stderr for logs is a = better choice than opening another file descriptor.=20 In my view, stdout for the response and stderr for any logs is easy = enough to understand. Writing to a third pipe would increase the = complexity for people writing an `exec` app. =20 Ideally, you'd take the last line of stdout only for the response so = that any app that print outs a welcome banner to stdout would work. I = appreciate this is hard to determine when in a loop though! Regards, Rob...