Bug #71144 [Fbk->Opn]: Sementation fault when using cURL with ZTS

From: Date: Thu, 17 Dec 2015 07:05:36 +0000
Subject: Bug #71144 [Fbk->Opn]: Sementation fault when using cURL with ZTS
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197959@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71144&edit=1

 ID:                 71144
 User updated by:    maroszek at gmx dot net
 Reported by:        maroszek at gmx dot net
 Summary:            Sementation fault when using cURL with ZTS
-Status:             Feedback
+Status:             Open
 Type:               Bug
 Package:            cURL related
 Operating System:   Any
 PHP Version:        7.0.0
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[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)

« previous php.bugs (#197959) next »