indygreg / indygreg/PyOxidizer
Segfault loading Frozen Modules
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6.2k
- Forks
- 256
- PR merge metrics
- No merged PRs in 30d
Description
This may be too esoteric for you all to support, and I suspect the problem may be elsewhere but I'm not entirely sure so I figured I'd start here.
I'm attempting to use `pyembed` directly, with a self compiled CPython 3.11.4 which I am static linking (through Bazel), and whenever I turn on using the oxidized importer I get a segfault. Running under lldb I get this:
```
Process 2508996 launched: '/home/dstufft/projects/pypi/code/.bazel/bin/apps/demo/demo' (x86_64)
Process 2508996 stopped
* thread #1, name = 'demo', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x0000555557784a9c demo`oxidized_importer::python_resources::PythonResourcesState$LT$u8$GT$::index_interpreter_frozen_modules::hd1bedcc40b6742b4(self=0x00007fffffff95e8) at python_resources.rs:577:25
```
It appears that means that ``PyImport_FrozenModules`` is an empty array, so the unsafe code that is fetching items from it is crashing.
What's confusing to me is the program works fine without oxidized importer, which suggests that Python has the frozen modules it needs to start up, but when I turn on oxidized importer it seg faults trying to read them.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the crash in the Bazel-built demo using the statically linked CPython 3.11.4 with the oxidized importer enabled. Start at python_resources.rs:577:25 and use lldb to inspect the frozen-module loading path; done means the demo starts without a segmentation fault when the importer is enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100