Yikes, I didn't know about this issue.

To others who don't know what this is about, this thread has some
information:

https://github.com/guzzle/guzzle/issues/1927

TL;DR Linux has a default limit of 1024 open file handles at the OS level.

Okay, but...

This can't become a choice between an incomplete model or a model that
can't scale. Both are unacceptable.

The only sensible recourse I can think of, is we need special TempStream
implementation that doesn't open an actual file handle until you write to
it.

I think we could put this as a recommendation in the PSR? It's an easy work
around.

Another possible work around is a custom stream implementation that uses a
simple string as buffer.

Of course, this approach only works up to a certain file size, but you
could further optimize by switching to a temp-stream when the buffer hits a
certain size limit or somebody tries to detach the resource handle.

Yet another option is to lazy initialize in getBody() ...

So there are ways to work around this.

I don't think returning an incomplete, unusable model an acceptable
solution.

For one, the type-hint of getBody() is StreamInterface, it's not
StreamInterface|null
- so you have to return an instance or you're not complying with the
original spec in the first place.

This is a lot of information to put in an amendment though 🤔

On Tue, Jan 29, 2019, 04:42 Lcfvs <[email protected] wrote:

> Le lundi 28 janvier 2019 12:57:49 UTC+1, Rasmus Schultz a écrit :
>>
>> "Implementations of this interface MUST initialize the body stream with
>> an empty temp-stream in read/write mode, e.g. fopen('php://temp', 'rw+')"
>>
>
>  Like I already said on this group, open a stream, by default, for
> everything like this increases the risk to reach the "Fatal Error - Too
> many open files".
>
> I strongly disagree that, please don't make it a
> requirement/recommandation!
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "PHP Framework Interoperability Group" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/php-fig/mv9-MWDVVBM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/php-fig/7123beae-3ac4-4062-b4dc-bb29effa90fa%40googlegroups.com
> <https://groups.google.com/d/msgid/php-fig/7123beae-3ac4-4062-b4dc-bb29effa90fa%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/CADqTB_itM-Q%2Bhxmx--NXi1gDZNqkM_wims5jCj5JUVek2ROhfA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to