If one request successfully writes out the agrcache variable while another request is trying to set the same variable with the same file in it, the value of the file gets turned into an array by array_merge_recursive(). Take the example here:
$a = array(
'dcbf43e6462bd3457745969ce70a77aed363228644780f0457f992212126f91b' => 'public://js/js_xcPFtQGZ355MfHOMBpub2dvRzpcGLjku_Cr0w3wLtwU.js',
'1e77d096f760f8e00283f36bdce62d2c6210a872b0fc03505396c33d0fe4c04c' => 'public://js/js_x6kTdqbY_yj4pGofJJKAIw1d6so4lTKH5eEZfib4Jec.js'
);
$b = array(
'35c289ea3bff928ee87ad0ff6f798e68a77cdb67a07d8fbd3cdfded2cde0fc96' => 'public://js/js_v4Kx_zj247divDgyI-9uO91P4Roag8yzWe-1_8c6LWU.js',
'1e77d096f760f8e00283f36bdce62d2c6210a872b0fc03505396c33d0fe4c04c' => 'public://js/js_x6kTdqbY_yj4pGofJJKAIw1d6so4lTKH5eEZfib4Jec.js'
);
$c = array_merge_recursive($a, $b);
print_r($c);
This will output:
Array
(
[dcbf43e6462bd3457745969ce70a77aed363228644780f0457f992212126f91b] => public://js/js_xcPFtQGZ355MfHOMBpub2dvRzpcGLjku_Cr0w3wLtwU.js
[1e77d096f760f8e00283f36bdce62d2c6210a872b0fc03505396c33d0fe4c04c] => Array
(
[0] => public://js/js_x6kTdqbY_yj4pGofJJKAIw1d6so4lTKH5eEZfib4Jec.js
[1] => public://js/js_x6kTdqbY_yj4pGofJJKAIw1d6so4lTKH5eEZfib4Jec.js
)
[35c289ea3bff928ee87ad0ff6f798e68a77cdb67a07d8fbd3cdfded2cde0fc96] => public://js/js_v4Kx_zj247divDgyI-9uO91P4Roag8yzWe-1_8c6LWU.js
)
The file gets turned into an array, which fails to be served. I found this bug during a load test and I was only able to recreate it with a high level of concurrency after clearing the variables out.
Attached patch fixes this by just using array_merge on each element which should produce the desired result.
Comments
Comment #1
msonnabaum commentedIgnore the last patch.
Comment #2
catchThanks! Committed and pushed.
Comment #3
msonnabaum commentedI apologize, that patch wasn't as well tested as I thought :)
This one works.
Comment #4
catchCommitted this one too :)
Comment #5
rickvug commentedThe latest code in master fixed this problem for us but only after we deleted the variables, which already contained the wrong values. I think we need an upgrade path here for anyone who may already have this problem. Simple patch attached.
Comment #6
rickvug commentedFor some reason git was complaining that the last patch was corrupt. Here's the same changes freshly applied to a clean checkout of master.
Comment #7
catchThanks rickvug, committed/pushed to 7.x-1.x.
Comment #9
kalabroJust a note.
This issue is related to these errors in 7.x-1.1 version (and fixed in dev):
Came from here: #1837292: CSS aggregation on: Warning: mb_substr() expects parameter 1 to be string : rawurlencode() expects parameter 1 to be string.