Skip to content

Conversation

RoYalGamr
Copy link

Add new context option that automatically disables core file generation when enabled. This sets RLIMIT_CORE to (0, -1) to prevent core dump creation, which is particularly useful for brute-force scenarios and repeated segfault crashes where core files consume excessive disk space.

  • Add disable_corefiles context variable with boolean type.
  • Add @_validator decorator for disable_corefiles context variable
  • Default value is False to maintain existing behavior.

Fixes #2566

Add new context option that automatically disables core file generation
when enabled. This sets RLIMIT_CORE to (0, -1) to prevent core dump creation,
which is particularly useful for brute-force scenarios and repeated segfault
crashes where core files consume excessive disk space.

- Add disable_corefiles context variable with boolean type.
- Add @_validator decorator for disable_corefiles context variable
- Default value is False to maintain existing behavior.

Fixes Gallopsled#2566
@peace-maker
Copy link
Member

Cool, thank you! Can you add a test to the Corefile class demonstrating that there's no Corefile created when setting that option please?

We use doctest to run the code in our documentation as tests. Check out corefile.py around line 490 on how it's done.

@RoYalGamr RoYalGamr force-pushed the dev branch 3 times, most recently from 6075500 to 1ab053d Compare October 16, 2025 19:21
@peace-maker
Copy link
Member

Could you add a comment about disable_corefiles to the docs of process.corefile too please?

Added doctest for `disable_corefiles` in corefile.py
Added doc for `disable_corefiles` in process.py
When `context.corefiles` is enabled:
For crashed process, `io.corefile` will return None.
For running process, gdb still dumps the corefile.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A way to disable corefile

2 participants