Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19453 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45892 invoked by uid 1010); 6 Oct 2005 18:32:58 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 45876 invoked from network); 6 Oct 2005 18:32:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Oct 2005 18:32:58 -0000 X-Host-Fingerprint: 64.207.49.98 cbit-98.bullseye9.com Windows 2000 SP4, XP SP1 Received: from ([64.207.49.98:29221] helo=pearl.hq.booyahnetworks.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id BA/FB-54476-9DD65434 for ; Thu, 06 Oct 2005 14:32:57 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Thu, 6 Oct 2005 12:31:45 -0600 Message-ID: <4E0C5C8E5F8C994F90134920DD66E93F01129371@pearl.hq.booyahnetworks.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] Re: CLI in PHP6 thread-index: AcXKn6QLr07Vy4mDQFuuxcr8HfCGKgAAwngA To: "Sara Golemon" Cc: Subject: RE: [PHP-DEV] Re: CLI in PHP6 From: adove@booyahnetworks.com ("J. Allen Dove") This "fast-and-loose" behavior was what we figured would happen with resources in PHP, especially if you do things in a lower scope that do not get passed back/referenced to a higher scope. Since the concept of scope gets a little gray in PHP we explicitly close the resource in the "scope" it was opened and it still seems that we have the strange "leak", which honestly surprised me. We even explicitly unset the vars but that doesn't guarantee the GC kicks off for them near-time?=20 As a total aside, and being a paranoid C++ guy, I would love a "free" method that I could call that frees what I tell it to exactly when I tell it to... :-) In any case, we'll apply the steps you outlined to debug the situations and report back what we find.=20 Thanks. - AD -----Original Message----- From: Sara Golemon [mailto:pollita@php.net]=20 Sent: Thursday, October 06, 2005 11:58 AM To: "Ron Korving" Cc: internals@lists.php.net Subject: [PHP-DEV] Re: CLI in PHP6 > There was once (can't remember when exactly, so it must be a long time > ago) > here on PHP CLI scripts in which it came forward that one should not rely=20 > on > such a script to run forever. And it's true; the scripts sometimes=20 > magically > and suddenly die. Now I have no clue where this instability (for lack of a > better word) comes from, but could it be possible for this to be resolved > for PHP6 so that PHP becomes an extremely viable solution for CLI daemon > scripts? > The short answer is that PHP plays a little "fast-and-loose" with the data=20 it tracks because it has no idea what you plan on doing with that data. In=20 *theory* allocated resources get cleaned up within a request the minute they=20 no longer have any possible relevance (i.e. A database connection is created=20 within a function, then that function leaves making the variable it was=20 placed in no longer accessible from anywhere). In 99% of the engine/core/exts this happens seemlessly, however there *may*=20 be (and most likely is) a lingering leak somewhere because a file descriptor=20 wasn't closed, or a couple bytes of memory wern't freed. In a "normal" webserver environment these resources get forcibly cleaned up by the=20 end-of-request garbage collection process so they don't get noticed by the=20 bulk of PHP users out there. In a long-running daemon process this GC phase=20 never triggers and those piccune leaks pile up.