|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32919 Curl/Openssl: random crashes with fsockopen("ssl://.."..) under heavy load
Submitted: 2005-05-03 00:00 UTC Modified: 2006-01-06 05:05 UTC
Avg. Score:4.7 ± 0.7
Reproduced:12 of 13 (92.3%)
Same Version:6 (50.0%)
Same OS:11 (91.7%)
From: justincouto at msn dot com Assigned:
Status: Wont fix Package: IIS related
PHP Version: 5.0.4 OS: Windows 2003 Server
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-05-03 00:00 UTC] justincouto at msn dot com
I am running PHP5 on 3 Windows 2003 servers using IIS 6.0.  All of these servers randomly get PHP Access Violation errors like this:

"PHP has encountered an Access Violation at 7C84E9AF"

I am not sure what causes this.  I have seen lots of posts where other are experiencing the exact same thing, however, there are no answers.  I have seen several other bugs that report this and they state that it has been fixed in the latest version.  I have tried several versions and the latest cvs.  All of them will have this problem.  The poroblem seem to occur when updating a MySQL database.  After you esperience the problem, a few moments later it will go away.

I have tried the Zend Win Enabler, however, it is not compatible with PHP5.  I hope someone can help me.  

Reproduce code:
It seems to happen with lots of different code when server gets heavily loaded


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-11 03:28 UTC] justincouto at msn dot com
I have done more work on trying to figure out the source of this bug.  I realized that it seemed to be happening in in all the places that we were using the Curl module for Posting to web services.  As a result, I wrote a php socket class to replace curl.  The new class eliminated the problem in all places except where it needs to use the OpenSSL module.  It seems as if both Curl and the Openssl module have issues.  I can reproduce the problem.  It occurs with using a socket as follows:

$handle = fsockopen($this->host, $this->port, $errno, $errstr, $timeout = 30);

I have deffinately narrowed the issue to this line of code.  The host and port are set as follows

$this->host = "ssl://";
$this->port = 443;

The reason I know it is the ssl part of the connection is becuse I can use the class to connect to non ssl connection at the same time the access violation is happening.  

The access violation only occurs on a heavly load (when lots of requests through a secure fsockopen)

It seems if it could have something to do with the openssl threading.  I also think this because the CLI or CGI version won't reporduce this issue.

Please advise.  If you know of any other way to do a secure socket connection that doesn't use openssl or curl, it would be helpful for me to get a qucik fix.

 [2005-06-03 15:30 UTC]
This sounds like a threading related crash; we don't have the resources to debug it, so if the latest snapshots don't solve the problem for you, you should go with fastcgi.

The fastcgi core of the WinEnabler *is* compatible with PHP 5, and that's the part you need.  Hopefully the Zend folks will guide you through setting it up with PHP 5.

 [2005-06-03 18:00 UTC] justincouto at msn dot com
I have already been working with the Zend people, and I helped them discover a bug in the Win Enabler for PHP5.  Consequently, they removed support for PHP5 in the WinEnabler until they have time to fix the bug, which apparetly won't be anytime soon.  This problem is deffinately a threading issue with Curl and OpenSSl.  I came up with a work-around that allowed me to drop-out the OpenSSL module.  I do this by connection to a local ASP.NET script and let it hanlde the requests.  It works perfect now and is stable.  I do use the MySQLi module and it handles threading just fine.  Those of you running windows and php, you will not be able to use Curl or Open SSL.
 [2005-06-22 10:31 UTC]
Curl and openssl work just fine, as long as you don't use IIS..

 [2006-01-06 05:05 UTC] justincouto at msn dot com
Curl does work fine, just not with a multi-threaded webserver.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 01 07:03:34 2021 UTC