Bug #71144 [Opn->Csd]: Sementation fault when using cURL with ZTS
Edit report at https://bugs.php.net/bug.php?id=71144&edit=1
ID: 71144
Updated by: laruence@php.net
Reported by: maroszek at gmx dot net
Summary: Sementation fault when using cURL with ZTS
-Status: Open
+Status: Closed
Type: Bug
Package: cURL related
Operating System: Any
PHP Version: 7.0.0
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8f9af36da35eef78728a46890ba5f1f114d7a0b0
Log: Fixed bug #71144 (Sementation fault when using cURL with ZTS)
Previous Comments:
------------------------------------------------------------------------
[2015-12-17 07:05:35] maroszek at gmx dot net
Using an option that is actually declared not thread safe should not be allowed in the ZTS version
even if it *might* work.
@pajoye: Yes, that would definitly be the best solution. For the moment, disabling the global dns
cache would solve the problem, though.
@laruence: Yes, i have seen crashes in gdb (Raspbian) and Visual Studio (Win64) with a backtrace
like this one:
https://www.dropbox.com/s/w82aydt03s35r2m/curl.png?dl=0
------------------------------------------------------------------------
[2015-12-17 05:42:03] pajoye@php.net
More importantly we should replace it with the share api
http://curl.haxx.se/libcurl/c/CURLOPT_DNS_USE_GLOBAL_CACHE.html
------------------------------------------------------------------------
[2015-12-17 05:26:20] laruence@php.net
Hmm, but dns should be result in the same value . and it must store in a cache line sieze. so I
don't think this could be a problem.
do you have see any issue of this?
------------------------------------------------------------------------
[2015-12-16 22:25:40] maroszek at gmx dot net
Description:
------------
As stated here: http://curl.haxx.se/libcurl/c/CURLOPT_DNS_USE_GLOBAL_CACHE.html
and here: http://php.net/manual/en/function.curl-setopt.php
CURLOPT_DNS_USE_GLOBAL_CACHE is not thread safe.
This option should not get enabled by default when ZTS is enabled.
And we should not allow the user to set this option, when ZTS is enabled.
I attached a patch which fixes both things.
Test script:
---------------
Just make a lot of random requests in a lot of threads to different domains.
After a while the crash will happen.
Expected result:
----------------
No crash
Actual result:
--------------
Crash.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71144&edit=1
Thread (6 messages)