Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91980 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9242 invoked from network); 28 Mar 2016 16:19:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Mar 2016 16:19:48 -0000 Authentication-Results: pb1.pair.com header.from=danack@basereality.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=danack@basereality.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain basereality.com from 209.85.220.182 cause and error) X-PHP-List-Original-Sender: danack@basereality.com X-Host-Fingerprint: 209.85.220.182 mail-qk0-f182.google.com Received: from [209.85.220.182] ([209.85.220.182:35609] helo=mail-qk0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 12/C1-26367-4A959F65 for ; Mon, 28 Mar 2016 11:19:48 -0500 Received: by mail-qk0-f182.google.com with SMTP id o6so118363800qkc.2 for ; Mon, 28 Mar 2016 09:19:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basereality-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-transfer-encoding; bh=kikzn77QiioOsikQmixMwZcWXFm+lHlKauZwPoEevtA=; b=g0rQ0Ee1iv6YYE29j1N3FaBW5SJ5OuAg+Mx/Ig8zR+0h2pI34xF9aTNEeOiiqtryKw JQyhfh6TM2dEdO/IpwTx+gm6OiQarPWwsHOjm0G9VVMYYiwd+SbuTR2dsmMk7ON3829R Hl8Unb8FaXlwB3cCVaD5VMPZVz8qTb2L+GGhJcR3Sf1oF9qT9B41bZ7N8/I32LbgmJE2 jNProLzYyb+UsudKpAC0Lu6NUjTfkhoISYncDY/CXBtO/v8RZNpuHQGEIzgz7iMijQQS 5bTae7L0gBdKP8byr1PsVaViE7lF/YYh4TYhLLlRAM/T3LGTJ9xCj60CJo7d5k93enW5 C2Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-transfer-encoding; bh=kikzn77QiioOsikQmixMwZcWXFm+lHlKauZwPoEevtA=; b=QUKK3nE66gp/TD1WRmQ3vevi4SoBCw2NrAvBaPRYkOj653B8zLTgiLXTAbXwVBVwLt JxiDm/2KIshucLcCDjGaZKrFFpg2oxCXoa6tYFwF6Hb+1nTYK9/n9ilnYhX/TlOqMhV+ 5X4bVoyfzT8FHNk9OtFOb8Q3JVzhTGzR8nre8cXYnOqOkv6a1SbIFjbTPphA2/tF5/qr h9nb3pPtJVqjDJBYRFAIp3xcm+8sy1aI5NG6X0Yua83W3eI+OCEF2IR4AEkSVd5dHbVX mX+2A5kT3DkTqKJtqJPrz1v4y5QiWQaVDGXjMLnH5SLd8Ma9J9x9Nei+T35RGwohFL8y zDNQ== X-Gm-Message-State: AD7BkJJcuUNE9FOGunzbcQ8lL97rYybw5jxWwQdMkJVOPaUhNPVtFIi+2yN+MMJI+quCREXsXGL9egny9b7iSQ== MIME-Version: 1.0 X-Received: by 10.13.192.5 with SMTP id b5mr13626198ywd.114.1459181985623; Mon, 28 Mar 2016 09:19:45 -0700 (PDT) Received: by 10.37.43.85 with HTTP; Mon, 28 Mar 2016 09:19:45 -0700 (PDT) X-Originating-IP: [2.99.228.121] In-Reply-To: References: Date: Mon, 28 Mar 2016 16:19:45 +0000 Message-ID: To: Grzegorz Zdanowski Cc: PHP internals list Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Handling "Bad file descriptor" during stream_select() From: danack@basereality.com (Dan Ackroyd) On 28 March 2016 at 02:57, Grzegorz Zdanowski wrote= : > Hello! > > by =E2=80=9Egone away=E2=80=9C > I mean some underlying error like forceful close of FD and not a > standard disconnection > of the client. What problem exactly are you trying to solve, and do you have a way of showing the problem that isn't just what looks like a programming mistake? e.g. The following code works fine. The file being closed doesn't affect the filehandle $fileHandle =3D fopen('foo.txt', 'r+'); unlink('foo.txt'); $data =3D fread($fileHandle, 20); The following code doesn't work fine. The filehandle being closed, surprisingly enough, makes it not usable any more: $fileHandle =3D fopen('foo.txt', 'r+'); fclose($fileHandle); $data =3D fread($fileHandle, 20); or, as the link you sent puts it: > If a connection is closed at client side, and you call select() on the se= rver side socket, FD_READ will be triggered and recv() will return zero, th= en you can close the socket at server side. > > The "bad file descriptor" error only happens when you call API on an alre= ady closed socket. So I don't understand what problem you're trying to analyze, other than closed file descriptors are closed. cheers Dan