Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems with APC on publish

Tags:

php

apc

We've recently enabled APC on our servers, and occasionally when we publish new code or changes we discover that the source files that were changed start throwing errors that aren't reflected in the code, usually parse errors describing a token that doesn't exist. We have verified this by running php -l on the files the error logs say are affected. Usually a republish fixes the problem. We're using PHP 5.2.0 and APC 3.01.9. My question is, has anyone else experienced this problem, or does anyone recognize what our problem is? If so, how did you fix it or how could we fix it?

Edit: I should probably add in some details about our publishing process. The content is being pushed to the production servers via rsync from a staging server. We enabled apc.stat_ctime because it said this helps things run smoother with rsync. apc.write_lock is on by default and we haven't disabled it. Ditto for apc.file_update_protection.

like image 658
Jeremy DeGroot Avatar asked May 04 '09 14:05

Jeremy DeGroot


People also ask

What are the biggest problems in academic publishing?

The current publishing system involves challenges with cost, where many universities are forced to cancel journal subscriptions for economic reasons, as well as access, as scholars and the public alike often lack access to research published in paywalled subscription journals.

What are APCs in publishing?

Article Processing Charges (APCs) are charged to authors of scholarly articles during the publication process. APCs are used by open access journals in lieu of subscription fees that libraries and readers traditionally have paid to gain access to research articles.

What ethical dilemma is in predatory journals?

Predatory journals misrepresent who they are and what services they offer, including not providing peer review, editing and indexing services.


1 Answers

Sounds like a part-published file is being read and cached as broken. apc.file_update_protection is designed to help stop this.

in php.ini: apc.file_update_protection integer

apc.file_update_protection setting puts a delay on caching brand new files. The default is 2 seconds which means that if the modification timestamp (mtime) on a file shows that it is less than 2 seconds old when it is accessed, it will not be cached. The unfortunate person who accessed this half-written file will still see weirdness, but at least it won't persist.

Following the question being edited: One reason I don't see these kinds of problems is that I push a whole new copy of the site (with SVN export). Only after that is fully completed does it become visable to Apache/Mod_php (see my answer How to get started deploying PHP applications from a subversion repository? )

The other thing that may happen of course, is that if you are updating in place, you may be updating files that depend on others that have not yet been uploaded. Rsync can only guarantee atomic updates for individual files, not the entire collection that is being changed/uploaded. Another reason I think to upload the site en-mass, and only then put into use.

like image 152
Alister Bulman Avatar answered Oct 12 '22 23:10

Alister Bulman