Skip to content

Readfile started throwing out-of-memory exceptions in Sentry #602

Open
@rvanlaak

Description

@rvanlaak

Since the NewRelic logging was improved in our codebase, the PHP Agent is causing out of memory issues to occur on PHP's readfile method.

Description

The out of memory errors result in that Sentry is catching a weird sort of Sentry-specific error.

The issue already was described earlier by other NewRelic users in this issue: getsentry/sentry-php#1156

Steps to Reproduce

Serve big file (750MB in our example) via streamed response with readfile in callback.

image

Expected Behavior

No exception

Relevant Logs / Console output

Your Environment

  • PHP 8.1.14
  • Sentry SDK 4.4
  • NewRelic PHP Agent 10.5.0

Additional context

The weird part is that PHP's documentation is extremely clear about PHP's readfile method to not cause OOM errors.

readfile() will not present any memory issues, even when sending large files, on its own. If you encounter an out of memory error ensure that output buffering is off with ob_get_level().

https://www.php.net/manual/en/function.readfile.php#refsect1-function.readfile-notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions