|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-06-18 13:54 UTC] david at dfoerster dot de
Description: ------------ I tried using APC on a site providing counters, guestbooks and similar services. When reloading a guestbook script very often, once in while a javascript code belonging to a counter would be returned alltough the logs clearly indicate that the guestbook script was executed. I'll gladly provide any further information or try suggested fixes. The affected system is a virtual linux server and the site makes heavy use of Apache's mod_rewrite (allthough the problem persists when using the script's URLs directly and no rewriting takes place). Just in case that helps. Reproduce code: --------------- Enter the URL of a script in the browser and reload the page very often. Expected result: ---------------- The output of that script. Actual result: -------------- Sometimes the output of another script is shown. (I cannot reproduce the problem on my local machine. It might only be triggered under heavy load.) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 09:00:01 2025 UTC |
This is the function in the Apache2 handler sapi that is getting called: static struct stat* php_apache_sapi_get_stat(TSRMLS_D) { php_struct *ctx = SG(server_context); ctx->finfo.st_uid = ctx->r->finfo.user; ctx->finfo.st_gid = ctx->r->finfo.group; ctx->finfo.st_dev = ctx->r->finfo.device; ctx->finfo.st_ino = ctx->r->finfo.inode; #if defined(NETWARE) && defined(CLIB_STAT_PATCH) ctx->finfo.st_atime.tv_sec = apr_time_sec(ctx->r->finfo.atime); ctx->finfo.st_mtime.tv_sec = apr_time_sec(ctx->r->finfo.mtime); ctx->finfo.st_ctime.tv_sec = apr_time_sec(ctx->r->finfo.ctime); #else ctx->finfo.st_atime = apr_time_sec(ctx->r->finfo.atime); ctx->finfo.st_mtime = apr_time_sec(ctx->r->finfo.mtime); ctx->finfo.st_ctime = apr_time_sec(ctx->r->finfo.ctime); #endif ctx->finfo.st_size = ctx->r->finfo.size; ctx->finfo.st_nlink = ctx->r->finfo.nlink; return &ctx->finfo; } Since you aren't on Netware it is the: ctx->finfo.st_mtime = apr_time_sec(ctx->r->finfo.mtime); line we are interested in. So somehow this is 0? Any chance you get set a gdb breakpoint on that to check out whether ctx->r->finfo.mtime is 0 going in? If that is the case, we need to trace down into Apache2 to see why the current request context is not getting populated like it should.I have hit upon similar behavior as well on a fresh machine, but it did not occur on the old machine I migrated away from. Site uses a lot of include/require and have many thousand small files (site is from before I knew how to use databases properly). Seems the first file of a certain base name to be loaded will result in that file's data being passed along to other requests for files of the same name, despite them being in other folders. Old working Fedora Core 3 (kernel 2.6.12-1.1381_FC3): Apache 2.0.54 PHP 5.2.0 APC 3.0.12p2 New broken Fedora 7 (kernel 2.6.21-1.3228.fc7): Apache 2.2.4 (with mpm_itk) PHP 5.2.3 APC 3.0.14 Config is: apc.num_files_hint = 6000 apc.ttl = 600 apc.gc_ttl = 600 apc.shm_size = 96 apc.shm_segments = 1 apc.include_once_override = 0 apc.write_lock = 1 apc.localcache = 1 apc.localcache.size = 4000 Tried using APC 3.0.12p2 with the new machine, but no such luck. No cigar with latest APC from cvs either. apc.stat_ctime likewise has no effect. Added some debug code to catch stat values, and none of the logged ones were 0. Log code: FILE *_cf = fopen("/tmp/php-debug.log", "ab"); fprintf(_cf, "R:%u %u %u S:%u %u %u\n", ctx->r->finfo.atime, ctx->r->finfo.mtime, ctx->r->finfo.ctime, ctx->finfo.st_atime, ctx->finfo.st_mtime, ctx->finfo.st_ctime); fflush(_cf); fclose(_cf); Log output snippet: R:963085184 275871 4007653184 S:270996 1695543040 275885 R:979085184 275871 3486408832 S:274933 1696543040 275885 R:220117888 275872 4007653184 S:270996 1715543040 275885 R:2428052480 275870 3947692160 S:264790 1779543040 275885 R:3243052480 275870 3013364992 S:274473 1778543040 275885 R:3253052480 275870 629533760 S:252065 1784543040 275885 Since I still enjoy the SHM facility of APC, I've resorted to turning off apc.cache_by_default for the affected site for now.