zend-http icon indicating copy to clipboard operation
zend-http copied to clipboard

Unwanted behaviour on Zend\Http\Client eq not thread safe

Open muhammedeminakbulut opened this issue 10 years ago • 3 comments

Hi,

We are using our application with around 25 workers (with beanstalkd and 25 listening proccesses). Most of the time we use the Client object to retrieve external content. And we do mime type checks which uses the headers.

Some of the use cases have setStream used.

And some times it will occur that the stream which is set by Client is the same filename used by another proccesses Client object. So we get a json mime type for an xml file by example.

It seems to go wrong on line 691 in \Zend\Http\Client object where tempnam is used. And as we can read from the documentation it is not really save to use.

http://php.net/manual/en/function.tempnam.php#98232

I suppose we should be using setStream with an own unique filename for each process to be safe. But that would be a workaround on the issue.

Thanks!

muhammedeminakbulut avatar Nov 10 '15 09:11 muhammedeminakbulut

You could define a different config streamtmpdir for each process

Maks3w avatar Nov 10 '15 09:11 Maks3w

We've tried that just now. But we keep getting an content type thats not correct.

muhammedeminakbulut avatar Nov 10 '15 10:11 muhammedeminakbulut

This repository has been closed and moved to laminas/laminas-http; a new issue has been opened at https://github.com/laminas/laminas-http/issues/23.

weierophinney avatar Dec 31 '19 22:12 weierophinney