|
1 | 1 | """big_100 / 303 -- functools.lru_cache C list+dict under cross-hub eviction churn. |
2 | 2 |
|
| 3 | +SKIPPED FOR NOW -- the currsize<=maxsize bound this program asserts is violated by a |
| 4 | +KNOWN UPSTREAM CPython free-threading bug, NOT a runloom defect: |
| 5 | + https://github.com/python/cpython/issues/148180 |
| 6 | + "functools.lru_cache critical section locks self but _LockHeld dict APIs assert |
| 7 | + self->cache is locked" (open, type-crash, topic-free-threading) |
| 8 | +Reproduced with PLAIN threading.Thread (no runloom) on arm64 3.13t: the cache dict |
| 9 | +exceeds maxsize (currsize=129 for maxsize=128); GIL-on and x86-64 stay clean, so it |
| 10 | +is an arm64 weak-memory window on the wrapper's wrong-object critical section. The |
| 11 | +program skips via setup()'s note_scale_limit until CPython fixes it; re-enable then. |
| 12 | +
|
3 | 13 | No existing program touches functools at all -- and `functools.lru_cache`'s |
4 | 14 | internals are exactly the kind of MUTATING shared C container that the M:N model |
5 | 15 | stresses in a new way. The C `_lru_cache_wrapper` keeps three coupled pieces of |
@@ -145,21 +155,34 @@ def worker(H, wid, rng, state): |
145 | 155 | H.task_done(wid) |
146 | 156 |
|
147 | 157 |
|
| 158 | +SKIP_REASON = ( |
| 159 | + "lru_cache maxsize over-grow is UPSTREAM CPython gh-148180 " |
| 160 | + "(https://github.com/python/cpython/issues/148180 -- functools.lru_cache " |
| 161 | + "critical section locks self, not self->cache); reproduced with PLAIN threads " |
| 162 | + "on arm64 3.13t (currsize=129 > maxsize=128; GIL-on + x86 clean) -- NOT a " |
| 163 | + "runloom bug. Skipped for now; re-enable when CPython fixes it.") |
| 164 | + |
| 165 | + |
148 | 166 | def setup(H): |
149 | | - f_bounded, f_unbounded = make_caches() |
150 | | - # A handful of clearers: enough to race clear-vs-lookup hard, but a small |
151 | | - # minority so the steady-state is eviction churn, not a perpetually empty |
152 | | - # cache. >= 2 even for tiny --funcs smoke runs. |
153 | | - nclear = min(8, max(2, H.funcs // 200)) |
154 | | - H.state = {"f_bounded": f_bounded, "f_unbounded": f_unbounded, |
155 | | - "nclear": nclear} |
| 167 | + # KNOWN UPSTREAM CPython bug -- skip for now (see module docstring + gh-148180). |
| 168 | + H.note_scale_limit(SKIP_REASON) |
| 169 | + H.state = None |
| 170 | + # When gh-148180 is fixed, delete the two lines above and restore: |
| 171 | + # f_bounded, f_unbounded = make_caches() |
| 172 | + # H.state = {"f_bounded": f_bounded, "f_unbounded": f_unbounded, |
| 173 | + # "nclear": min(8, max(2, H.funcs // 200))} |
156 | 174 |
|
157 | 175 |
|
158 | 176 | def body(H): |
| 177 | + if H.state is None: |
| 178 | + return # skipped in setup (upstream CPython gh-148180) |
159 | 179 | H.run_pool(H.funcs, worker, H.state) |
160 | 180 |
|
161 | 181 |
|
162 | 182 | def post(H): |
| 183 | + if H.state is None: |
| 184 | + H.log("SKIPPED: " + (H.scale_limit_reason or "upstream CPython gh-148180")) |
| 185 | + return |
163 | 186 | f_bounded = H.state["f_bounded"] |
164 | 187 | f_unbounded = H.state["f_unbounded"] |
165 | 188 | bi = f_bounded.cache_info() |
|