Skip to content

Awesome library, but it keeps files open #283

Closed

Description

@dionmes

Hi,

I love this library. However it seems to keep files open after a curl request. I cannot seem to find where exactly but it varies between 2-6 files after a request.

(It looks like it is something in the CURL call).

Activity

  1. oscarotero commented on Jul 17, 2018

    @oscarotero
    Collaborator

    I cannot detect this. All curl request should be closed, as you can see here: https://github.com/oscarotero/Embed/blob/master/src/Http/CurlDispatcher.php#L157
    and here: https://github.com/oscarotero/Embed/blob/master/src/Http/CurlDispatcher.php#L253

    Can you provide more information?
    Thanks.

  2. dionmes commented on Jul 17, 2018

    @dionmes
    Author

    I call the embed object from a self written Laravel console command, for a couple of hundred urls to populate a db. This didn’t go well, when I checked the open files, they increase after each call to the object.

  3. dionmes commented on Jul 17, 2018

    @dionmes
    Author

    Ok, I have narrowed it down to the curl_exec function in CurlDispatcher\exec . It might be a curl specific thing (I don't know the curl object), will look into that. (curl_close does not seem to free the file handlers).

  4. dionmes commented on Jul 18, 2018

    @dionmes
    Author

    Can not seem to find what curl is doing to keep the file open, given up. As far as I see now it only causes problems in a script which runs the object a lot of times. I expect a web call to close it after every request but I haven't checked.

  5. geoffoliver commented on Jan 1, 2020

    @geoffoliver

    FWIW, setting these options to true in the CurlDispatcher config seems to solve the problem...

    CURLOPT_FORBID_REUSE
    CURLOPT_FRESH_CONNECT

  6. Vitorinox commented on Oct 31, 2026

    @Vitorinox
    Collaborator

    Hi @dionmes, PR #589 should fix this: there was a curl handle leak on PHP 8. In our test with 40 requests the open descriptors went from 10 to 170, and with the fix they stay at 6.

    You can test it with composer require embed/embed:dev-fix/4.5.5. We will leave the PR open for a few days before releasing 4.5.5, so any feedback is very welcome!

  7. dionmes commented on Nov 1, 2026

    @dionmes
    Author

    @Vitorinox thank you. Project is currently deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions