Bug #73606 [NEW]: accel_find_interned_string not have read lock
| From: | 804368954 at qq dot com | Date: | Fri, 25 Nov 2016 11:09:58 +0000 |
| Subject: | Bug #73606 [NEW]: accel_find_interned_string not have read lock | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-205630@lists.php.net to get a copy of this message | ||
From: 804368954 at qq dot com
Operating system: CentOS Linux release 6.2 (Final)
PHP version: 7.0Git-2016-11-25 (Git)
Package: opcache
Bug Type: Bug
Bug description:accel_find_interned_string not have read lock
Description:
------------
when exec "opcache_reset()" by cacheTool, We offen get Fatal
errorï¼[25-Nov-2016 14:07:07 Asia/Shanghai] PHP Fatal error: Unknown:
Failed opening required '/home/xxxx/index.php'
(include_path='.:/home/php7/lib/php') in Unknown on line 0(just on error
log,not warning), then I check ZendAccelerator.c, find this code:
static zend_string *accel_find_interned_string(zend_string *str)
{
/* for now interned strings are supported only for non-ZTS build */
zend_ulong h;
uint nIndex;
uint idx;
Bucket *arData, *p;
if (IS_ACCEL_INTERNED(str)) {
/* this is already an interned string */
return str;
}
if (!ZCG(counted)) {
if (accel_activate_add() == FAILURE) {
return str;
}
ZCG(counted) = 1;
}
h = zend_string_hash_val(str);
nIndex = h | ZCSG(interned_strings).nTableMask;
/* check for existing interned string */
idx = HT_HASH(&ZCSG(interned_strings), nIndex);
arData = ZCSG(interned_strings).arData;
while (idx != HT_INVALID_IDX) {
p = HT_HASH_TO_BUCKET_EX(arData, idx);
if ((p->h == h) && (ZSTR_LEN(p->key) == ZSTR_LEN(str))) {
if (!memcmp(ZSTR_VAL(p->key), ZSTR_VAL(str), ZSTR_LEN(str))) {
return p->key;
}
}
idx = Z_NEXT(p->val);
}
return NULL;
}
it read shared memory, but I don't find read lock in function, because
"opcache_rerest()" will execute "accel_interned_strings_restore_state()"
function, it will write shared memory. I'm not an expert, so need your
help,thanks!
--
Edit bug report at https://bugs.php.net/bug.php?id=73606&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73606&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73606&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73606&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73606&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73606&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73606&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73606&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73606&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73606&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73606&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73606&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73606&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73606&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73606&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73606&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73606&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73606&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73606&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73606&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73606&r=mysqlcfg