Skip to content

[BUG]: Segmentation Fault (Core Dump) in ORM findFirst during high-iteration loops #16955

@dz3n

Description

@dz3n

Describe the bug
Running a high-iteration loop using the ORM (findFirst) results in a hard Segmentation Fault (Core Dump) rather than a standard PHP userland memory exhaustion error.

Provide minimal script to reproduce the issue

for ($i = 1; $i <= 5000000; $i++) {
    Business::findFirst($i);
}

Result

#34  0x61b367ba910c [/usr/local/bin/php(execute_ex+0x785c) [0x61b367ba910c]]
#35  0x61b367ba00d3 [/usr/local/bin/php(zend_execute+0x143) [0x61b367ba00d3]]
#36  0x61b367c08d80 [/usr/local/bin/php(zend_execute_script+0x50) [0x61b367c08d80]]
#37  0x61b367a9fab5 [/usr/local/bin/php(php_execute_script_ex+0x165) [0x61b367a9fab5]]
#38  0x61b367c0ae0b [/usr/local/bin/php(+0x80ae0b) [0x61b367c0ae0b]]
#39  0x61b367653b29 [/usr/local/bin/php(+0x253b29) [0x61b367653b29]]
#40  0x7b7826fef24a [/lib/x86_64-linux-gnu/libc.so.6(+0x2724a) [0x7b7826fef24a]]
#41  0x7b7826fef305 [/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x7b7826fef305]]
#42  0x61b367654da1 [/usr/local/bin/php(_start+0x21) [0x61b367654da1]]

Expected behavior
The script should eventually run out of memory and throw a standard PHP Fatal error: Allowed memory size exhausted. It should not trigger a Segmentation Fault at the C level.

Details

  • Phalcon version: 5.12.0
  • PHP Version: 8.5

Metadata

Metadata

Assignees

Labels

5.0The issues we want to solve in the 5.0 releasebugA bug reportstatus: highHigh

Type

No fields configured for Bug.

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions