-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Commit 7869af6
Fix GH-18417: Windows SHM reattachment fails when increasing memory_consumption or jit_buffer_size
When a first PHP process launches, Opcache creates a shared file mapping
to use as a shm region. The size of this mapping is set by
opcache.memory_consumption.
When a new PHP process launches while the old one is still running,
Opcache tries to reattach to the shm.
When reattaching it tries to map the requested size (i.e. set by
opcache.memory_consumption). However, if the new requested size is
larger than the size used in the original file mapping, then the call
to VirtualProtect() will fail and the new PHP process will fail to
launch.
It's not possible to resize the virtual region on Windows, unless
relying on undocumented APIs like `NtExtendSection` but then we would
sitll need to communicate that to the first process.
This issue is the root cause of Psalm end-to-end tests failing in
GH-18417: Psalm estimates the required memory sizes and relaunches itself
with more memory requested, if its estimate is below the currently allocated
shared memory. This causes a crash on startup and the tests fail.
To solve this, we need to make the mappings unique per requested size.
There are two ideas:
1. Include in zend_system_id. However, this also affects other things
and may be too overkill.
2. Include it in the filename, this is an easy local change.
I went with this option.
Closes GH-18443.1 parent a16b2c5 commit 7869af6
3 files changed
+54
-6
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 | + | ||
14 | + | ||
15 | + | ||
16 | + | ||
13 | 17 |
| |
14 | 18 |
| |
15 | 19 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
69 | 69 |
| |
70 | 70 |
| |
71 | 71 |
| |
72 | - | ||
72 | + | ||
73 | 73 |
| |
74 | - | ||
74 | + | ||
75 | 75 |
| |
76 | 76 |
| |
77 | 77 |
| |
| |||
82 | 82 |
| |
83 | 83 |
| |
84 | 84 |
| |
85 | - | ||
85 | + | ||
86 | + | ||
87 | + | ||
88 | + | ||
89 | + | ||
86 | 90 |
| |
87 | 91 |
| |
88 | 92 |
| |
89 | 93 |
| |
90 | 94 |
| |
91 | 95 |
| |
92 | 96 |
| |
93 | - | ||
97 | + | ||
94 | 98 |
| |
95 | 99 |
| |
96 | 100 |
| |
| |||
224 | 228 |
| |
225 | 229 |
| |
226 | 230 |
| |
227 | - | ||
231 | + | ||
228 | 232 |
| |
229 | 233 |
| |
230 | 234 |
| |
| |||
269 | 273 |
| |
270 | 274 |
| |
271 | 275 |
| |
272 | - | ||
276 | + | ||
273 | 277 |
| |
274 | 278 |
| |
275 | 279 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | + | ||
2 | + | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | + | ||
8 | + | ||
9 | + | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + |
0 commit comments