# UEFN 42.20: Python cleanup crashes and confirmed native callable size mismatch

**URL:** <https://forums.unrealengine.com/t/uefn-42-20-python-cleanup-crashes-and-confirmed-native-callable-size-mismatch/2833673>\
**Category:** Issues and Bug Reporting\
**Tags:** open, fortnite-creative, unreal-editor-for-fortnite, fortnite\
**Created:** [September 23, 2026, 4:53pm UTC](https://forums.unrealengine.com/t/uefn-42-20-python-cleanup-crashes-and-confirmed-native-callable-size-mismatch/2833673 "2026-09-23T16:53:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![QuidXQuid](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@QuidXQuid](https://forums.unrealengine.com/u/QuidXQuid)\
**Post date:** [September 23, 2026, 4:53pm UTC](https://forums.unrealengine.com/t/uefn-42-20-python-cleanup-crashes-and-confirmed-native-callable-size-mismatch/2833673/1 "2026-09-23T16:53:08Z")

</div>

### Summary

UEFN crashed twice during editor automation with Python Editor Scripting and UEFN MCP Toolsets enabled. Both crash traces point to Python’s weak-reference cleanup.

A separate read-only check found a concrete defect in Unreal’s native Python callable type: it declares 40 bytes of storage, although its inherited base requires 56 bytes. Its weak-reference pointer is positioned outside the declared storage.

The layout defect is confirmed. Its connection to the crashes is strongly supported, but the exact object responsible for either crash has not been identified.

Epic Launcher Verify completed successfully without changing the affected build or sampled components. Please identify a supported UEFN correction; a patch for a separately compiled Unreal Engine build cannot be applied directly to this installation.

### Please select what you are reporting on:

Unreal Editor for Fortnite

### What Type of Bug are you experiencing?

Stability

### Steps to Reproduce

**This is a diagnostic for the measured layout defect, not a guaranteed crash reproducer.**

1. Use Win64 UEFN **42.20, CL58011042** , with Python Editor Scripting enabled. The affected workflows also had UEFN MCP Toolsets enabled.
2. In the editor Python environment, run this descriptor-only check:

```python
import unreal

for name, fn in (
    ("SystemLibrary.get_engine_version", unreal.SystemLibrary.get_engine_version),
    ("EditorAssetLibrary.does_asset_exist", unreal.EditorAssetLibrary.does_asset_exist),
):
    print(name)
    for cls in type(fn). __mro__ :
        print(
            cls. __name__ ,
            cls. __basicsize__ ,
            cls. __itemsize__ ,
            cls. __weakrefoffset__ ,
        )

```

1. Compare each closure type’s declared size and weak-reference offset with its builtin base. The observed values are listed below.

The check completed successfully. It calls neither sampled Unreal function, loads no assets, scans no world, creates no weak references, and neither forces collection nor changes GC settings. Ordinary Python allocations can still trigger automatic collection.

The two actual crashes occurred in separate editor automation workflows: a collision-metadata inspection and a read-only actor preflight. The second failed during script compilation, before the actor queries. A deterministic minimal crash reproducer has not been established.

### Expected Result

The native callable should reserve enough memory for its inherited fields, including weak-reference storage. Editor Python/MCP operations should complete without invalid memory reads during Python cleanup.

### Observed Result

Both `unreal.SystemLibrary.get_engine_version` and `unreal.EditorAssetLibrary.does_asset_exist` exposed the following layout:

| Type | Basic size | Item size | Weak-reference offset |
| --- | --- | --- | --- |
| `builtin_function_or_method_with_closure` | **40 bytes** | 0 | **40 bytes** |
| Its `builtin_function_or_method` base | **56 bytes** | 0 | 40 bytes |

On Win64, a pointer at offset 40 occupies bytes 40–47. Those bytes lie outside the closure type’s declared 40-byte basic allocation. The closure type flags were `20736`.

For comparison, ordinary `len`, `unreal.load_asset`, and `unreal.find_asset` reported the normal builtin type: basic size 56 and weak-reference offset 40.

Both recorded crashes resolve to weak-reference garbage collection. The second occurred during AST conversion/script compilation, so the last requested scene property is not established as the cause. The exact offending heap object and first corrupting operation remain unknown.

### Platform(s)

Windows / Win64  
UEFN: 42.20, CL58011042  
Engine: 6.0.0-58011042+++Fortnite+Release-42.20  
Embedded Python: CPython 3.11.8

### Additional Notes

#### Crash evidence

Both crashes occurred during editor automation, before editor shutdown.

**Crash A — invalid read at `0x000000000000000a`:**

```plaintext
python311+0xD8FE1 clear_weakref+0x1D
python311+0xD8B16 handle_weakrefs+0x12E
python311+0x0CB2A gc_collect_main+0x13A
python311+0x0C795 gc_collect_with_callback+0x45
python311+0x0C725 gc_collect_generations+0x49

```

**Crash B — invalid read at `0x00007465736c6f18`:**

```plaintext
python311+0xD8B06 handle_weakrefs+0x11E
python311+0x0CB2A gc_collect_main+0x13A
python311+0x0C795 gc_collect_with_callback+0x45
python311+0x0C725 gc_collect_generations+0x49
python311+0x6798A _PyObject_GC_Link
python311+0x675A4 PyType_GenericAlloc

```

Lower frames in Crash B include `ast2obj_expr`, `ast2obj_stmt`, `ast2obj_list`, and `Py_CompileStringObject`.

**Symbol verification:** the traces were resolved offline using the [official Python 3.11.8 AMD64 PDB](https://www.python.org/ftp/python/3.11.8/amd64/core_pdb.msi). Its GUID exactly matches the dump module: `0a53b3b3-c6f6-4f54-b771-ad15efda80d8`, age 1.

- Both `handle_weakrefs` fault sites map to `Modules/gcmodule.c:813`.
- `clear_weakref` maps to `Objects/weakrefobject.c:60`.

#### Related report

A [September 15 UE 5.8.3 source-build report](https://forums.unrealengine.com/t/ue5-8-pythonscriptplugin-crash-during-gc-fpycfunctionwithclosureobject-layout-omits-weakref-vectorcall-fields/2776052) describes the same `FPyCFunctionWithClosureObject` / `PyMethodWithClosure` size mismatch and an author-tested source correction. This does **not** establish that a supported UEFN fix exists.

[UE-168225](https://issues.unrealengine.com/issue/UE-168225) concerns an older exit-time issue; it is not being claimed as this defect’s resolution.

#### Installation verification

Epic Games Launcher’s UEFN Verify operation completed successfully:

- Result: `AlertCode=[ok]`; `IncompleteInstall=0`.
- Installed build remained **42.20 / CL58011042**.
- All five sampled binaries were byte-for-byte unchanged, including the Engine DLL containing PythonScriptPlugin and both installed Python DLL copies.
- No fresh native layout probe was run after verification.

The integrity operation therefore did not apply a changed compiled binding. No binary patch, runtime type-memory modification, GC suppression, or custom engine-source patch was applied.

#### Requested resolution

Please confirm whether this native callable allocation/lifetime defect affects this UEFN build and identify an applicable **supported UEFN update or repair**. A generic Unreal Engine source patch cannot be deployed directly to the installed UEFN application.

Raw dumps and unsanitized logs are not attached. Reviewed, sanitized diagnostic excerpts can be provided through an authorized support channel if needed.

---

<div class="post-metadata">

**Author:** ![rhyan.smith](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rhyan.smith/32/1218554_2.png) [@rhyan.smith](https://forums.unrealengine.com/u/rhyan.smith)\
**Post date:** [September 24, 2026, 2:10pm UTC](https://forums.unrealengine.com/t/uefn-42-20-python-cleanup-crashes-and-confirmed-native-callable-size-mismatch/2833673/3 "2026-09-24T14:10:43Z")

</div>

Hi, thanks for reporting this to us.

Please could you provide us with your logs

How to get logs:

> [@How to get your Fortnite logs](https://forums.unrealengine.com/t/how-to-get-your-fortnite-logs/682382):
>
> At times, we will ask you to send us your logs when you’re having an issue in UEFN. Here is how to do that: UEFN Logs Exit Fortnite. Click on Start or press the Windows Key + R. Type \AppData\Local\UnrealEditorFortnite\Saved\Logs and press Enter. Zip your Logs folder and attach the zip file to your reply. To find UEFN Logs while working in UEFN: Click “Output Log” at the bottom of the window. Click on “Setting” at the top right of the window Click “Open Source Location” Zip your Logs folder…

Feel free to [privately message me](https://forums.unrealengine.com/new-message?username=rhyan.smith) the logs

---

<div class="post-metadata">

**Author:** ![Jamie\_Dale](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jamie_dale/32/1165413_2.png) [@Jamie\_Dale](https://forums.unrealengine.com/u/Jamie_Dale)\
**Post date:** [September 24, 2026, 3:56pm UTC](https://forums.unrealengine.com/t/uefn-42-20-python-cleanup-crashes-and-confirmed-native-callable-size-mismatch/2833673/5 "2026-09-24T15:56:00Z")

</div>

Thanks for the report. This size/layout mismatch has been corrected for 43.00.

---

<div class="post-metadata">

**Author:** ![Bug-Reporter](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bug-reporter/32/997076_2.png) [@Bug-Reporter](https://forums.unrealengine.com/u/Bug-Reporter)\
**Post date:** [September 24, 2026, 4:00pm UTC](https://forums.unrealengine.com/t/uefn-42-20-python-cleanup-crashes-and-confirmed-native-callable-size-mismatch/2833673/6 "2026-09-24T16:00:51Z")

</div>

FORT-1161329’s status has changed to ‘Ready for QA’. A member of the QA department is investigating the issue.

---

<div class="post-metadata">

**Author:** ![QuidXQuid](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@QuidXQuid](https://forums.unrealengine.com/u/QuidXQuid)\
**Post date:** [September 24, 2026, 4:35pm UTC](https://forums.unrealengine.com/t/uefn-42-20-python-cleanup-crashes-and-confirmed-native-callable-size-mismatch/2833673/7 "2026-09-24T16:35:17Z")

</div>

Thanks Jamie and Rhyan! I sent the sanitized logs from all three crash sessions to Rhyan by private message earlier today, in case they’re still useful for QA. Great news that the layout fix is in 43.00. We’ll re-test our editor automation when it ships.
