|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73606 accel_find_interned_string not have read lock
Submitted: 2016-11-25 11:09 UTC Modified: -
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: 804368954 at qq dot com Assigned:
Status: Open Package: opcache
PHP Version: 7.0Git-2016-11-25 (Git) OS: CentOS Linux release 6.2 (Final)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: 804368954 at qq dot com
New email:
PHP Version: OS:


 [2016-11-25 11:09 UTC] 804368954 at qq dot com
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!


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Jun 20 23:01:23 2021 UTC