Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7652 > unrolled thread

file being saved causes fatal error.

Started byrodeored <info1@reenie.org>
First post2012-11-27 18:28 -0800
Last post2012-12-03 10:20 +0100
Articles 8 — 6 participants

Back to article view | Back to comp.lang.php


Contents

  file being saved causes fatal error. rodeored <info1@reenie.org> - 2012-11-27 18:28 -0800
    Re: file being saved causes fatal error. Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-27 22:42 -0500
      Re: file being saved causes fatal error. rodeored <info1@reenie.org> - 2012-11-28 07:57 -0800
        Re: file being saved causes fatal error. Robert Heller <heller@deepsoft.com> - 2012-11-28 11:30 -0600
        Re: file being saved causes fatal error. Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-28 12:52 -0500
        Re: file being saved causes fatal error. The Natural Philosopher <tnp@invalid.invalid> - 2012-11-28 19:02 +0000
        Re: file being saved causes fatal error. Anders Wegge Keller <wegge@wegge.dk> - 2012-11-28 20:15 +0100
    Re: file being saved causes fatal error. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-12-03 10:20 +0100

#7652 — file being saved causes fatal error.

Fromrodeored <info1@reenie.org>
Date2012-11-27 18:28 -0800
Subjectfile being saved causes fatal error.
Message-ID<5df82eb2-79d5-48c6-aae5-ac0d333b816b@googlegroups.com>
If a website user if trying to access a class file at the same time it is being saved, this causes a fatal error. Is there anyway to save the file without causing it to be unavailable for any amount of time? 

[toc] | [next] | [standalone]


#7653

FromJerry Stuckle <jstucklex@attglobal.net>
Date2012-11-27 22:42 -0500
Message-ID<k94176$pmo$1@dont-email.me>
In reply to#7652
On 11/27/2012 9:28 PM, rodeored wrote:
> If a website user if trying to access a class file at the same time it is being saved, this causes a fatal error. Is there anyway to save the file without causing it to be unavailable for any amount of time?
>

No.  It's not PHP causing the problem - it's the OS.  While the file is 
being saved, a good OS will prevent any other process from reading the 
file.  Otherwise the other process may get part new, part old.

Before changing ANY files on a live system you should first take the 
system offline, then make you changes, and bring the system back online.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#7655

Fromrodeored <info1@reenie.org>
Date2012-11-28 07:57 -0800
Message-ID<94285c5e-7ab8-49aa-afc7-bd6491ab0048@googlegroups.com>
In reply to#7653
On Tuesday, November 27, 2012 10:42:27 PM UTC-5, Jerry Stuckle wrote:
> 
> No.  It's not PHP causing the problem - it's the OS.  While the file is 
> 
> being saved, a good OS will prevent any other process from reading the 
> 
> file.  Otherwise the other process may get part new, part old.
> 
> 
> 
> Before changing ANY files on a live system you should first take the 
> 
> system offline, then make you changes, and bring the system back online.
> 
> 
Thank you for your response. What is the system or mechanism for preventing other process from reading a file being saved called? This is on a Linux operating system on an Amazon server. 
If a good OS will prevent any other process from reading the file, then why does the system have to be taken off line? 

[toc] | [prev] | [next] | [standalone]


#7656

FromRobert Heller <heller@deepsoft.com>
Date2012-11-28 11:30 -0600
Message-ID<t8ydnd2jatSq1yvNnZ2dnUVZ_oSdnZ2d@giganews.com>
In reply to#7655
At Wed, 28 Nov 2012 07:57:23 -0800 (PST) rodeored <info1@reenie.org> wrote:

> 
> On Tuesday, November 27, 2012 10:42:27 PM UTC-5, Jerry Stuckle wrote:
> > 
> > No.  It's not PHP causing the problem - it's the OS.  While the file is 
> > 
> > being saved, a good OS will prevent any other process from reading the 
> > 
> > file.  Otherwise the other process may get part new, part old.
> > 
> > 
> > 
> > Before changing ANY files on a live system you should first take the 
> > 
> > system offline, then make you changes, and bring the system back online.
> > 
> > 
> Thank you for your response. What is the system or mechanism for preventing other process from reading a file being saved called? This is on a Linux operating system on an Amazon server. 
> If a good OS will prevent any other process from reading the file, then why does the system have to be taken off line? 

Not the whole O/S, but generally when a CMS system (eg WordPress) is
updating itself, it puts the site in 'maintainence mode', presenting a
'This site is currently offline for maintainence' type of page. 
Typically, this only lasts for a short time (maybe a couple of minutes
or so) while the php files for the update are downloaded, unpacked, and
the things like the database updated as needed.  You generally don't
want people visiting your web site while the code (php files) that
implement it are 'in flux' (being updated).

>                                                                                 

-- 
Robert Heller             -- 978-544-6933 / heller@deepsoft.com
Deepwoods Software        -- http://www.deepsoft.com/
()  ascii ribbon campaign -- against html e-mail
/\  www.asciiribbon.org   -- against proprietary attachments


                              

[toc] | [prev] | [next] | [standalone]


#7657

FromJerry Stuckle <jstucklex@attglobal.net>
Date2012-11-28 12:52 -0500
Message-ID<k95j1h$tfm$1@dont-email.me>
In reply to#7655
On 11/28/2012 10:57 AM, rodeored wrote:
> On Tuesday, November 27, 2012 10:42:27 PM UTC-5, Jerry Stuckle wrote:
>>
>> No.  It's not PHP causing the problem - it's the OS.  While the file is
>>
>> being saved, a good OS will prevent any other process from reading the
>>
>> file.  Otherwise the other process may get part new, part old.
>>
>>
>>
>> Before changing ANY files on a live system you should first take the
>>
>> system offline, then make you changes, and bring the system back online.
>>
>>
> Thank you for your response. What is the system or mechanism for preventing other process from reading a file being saved called? This is on a Linux operating system on an Amazon server.
> If a good OS will prevent any other process from reading the file, then why does the system have to be taken off line?
>

When a file is being updated, the file will generally be locked by the 
OS.  Attempts to access it by other processes will return a lock error.

So you need to take other processes which may access the file (the 
website, in this case) down while the update is being performed, or get 
an error if someone tries to access it.

This has nothing to do with PHP.  It's the OS doing it.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#7658

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2012-11-28 19:02 +0000
Message-ID<k95n4e$rqv$7@news.albasani.net>
In reply to#7655
On 28/11/12 15:57, rodeored wrote:
> On Tuesday, November 27, 2012 10:42:27 PM UTC-5, Jerry Stuckle
> wrote:
>>
>> No.  It's not PHP causing the problem - it's the OS.  While the
>> file is
>>
>> being saved, a good OS will prevent any other process from reading
>> the
>>
>> file.  Otherwise the other process may get part new, part old.
>>
>>
>>
>> Before changing ANY files on a live system you should first take
>> the
>>
>> system offline, then make you changes, and bring the system back
>> online.
>>
>>
> Thank you for your response. What is the system or mechanism for
> preventing other process from reading a file being saved called? This
> is on a Linux operating system on an Amazon server. If a good OS will
> prevent any other process from reading the file, then why does the
> system have to be taken off line?
>
Its jerry talking, therefore its bollocks.


-- 
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.

[toc] | [prev] | [next] | [standalone]


#7659

FromAnders Wegge Keller <wegge@wegge.dk>
Date2012-11-28 20:15 +0100
Message-ID<87ip8py1xl.fsf@huddi.jernurt.dk>
In reply to#7655
rodeored <info1@reenie.org> writes:

> If a good OS will prevent any other process from reading the file,
> then why does the system have to be taken off line?

 You don't *have* to do, but it's complicated to upgrade a live
system. Most filesystems nowadays are able to make an atomic upgrade
of a file, or even a complete directory hierachy, but the details
about that is outside the scope of this group.

-- 
/Wegge

Leder efter redundant peering af dk.*,linux.debian.*

[toc] | [prev] | [next] | [standalone]


#7677

From"M. Strobel" <sorry_no_mail_here@nowhere.dee>
Date2012-12-03 10:20 +0100
Message-ID<ai396rFt65oU1@mid.uni-berlin.de>
In reply to#7652
Am 28.11.2012 03:28, schrieb rodeored:
> If a website user if trying to access a class file at the same time it is being saved, this causes a fatal error. Is there anyway to save the file without causing it to be unavailable for any amount of time? 
> 

Just think about your case:

the file is being updated. That means it is not complete.

Depending on how the update software works, you can either read a file of zero
length, or an incomplete file.

What will happen if PHP reads/executes a class file of zero lenght? The class
definition is missing, fatal.

What will happen, if PHP reads/executes an incomplete file? A syntax error, fatal.

What you must do:
- make sure the class file is not read/executed during update.

What you can do:
- speed up the upgrade process (upload to some other file and copy locally, ...)

/Str.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web