- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我在使用下面的 php 函数时遇到了一个奇怪的问题。不幸的是,这是那些特殊的“仅限生产”案例之一。
function requestPost($url, $data)
{
set_time_limit(60);
$output = array();
$curlSession = curl_init();
if($curlSession == false)
syslog(LOG_INFO,"Falied to create a curl sessions");
// Set the URL
curl_setopt ($curlSession, CURLOPT_URL, $url);
// No headers, please
curl_setopt ($curlSession, CURLOPT_HEADER, 0);
// It's a POST request
curl_setopt ($curlSession, CURLOPT_POST, 1);
// Set the fields for the POST
curl_setopt ($curlSession, CURLOPT_POSTFIELDS, $data);
// Return it direct, don't print it out
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER,1);
// This connection will timeout in 30 seconds
curl_setopt($curlSession, CURLOPT_TIMEOUT,30);
//The next two lines must be present for the kit to work with newer version of cURL
//You should remove them if you have any problems in earlier versions of cURL
curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 1);
//Send the request and store the result in an array
syslog(LOG_INFO,"base.php::requestPost() : BEFORE SENDING CURL ");
$rawresponse = curl_exec($curlSession);
}
PHP 5.3.6 (cli) (built: Mar 17 2011 21:19:28)
curl Version : 7.20.1
NSS Version : 3.12.9
apr Version : 1.4.5
Php Version : 5.3.6
这似乎随机卡在 curl_exec。我不是 php 开发人员,所以我不知道从哪里开始。
我注意到当 curl 请求“挂起”时,在停止 httpd 守护进程时它会尝试发送这些请求,因此看起来它们可能正在缓冲或卡在 httpd 服务器中。任何指针将不胜感激。
编辑:我设法从 Web 服务器中获取堆栈跟踪信息。
(gdb) where
#0 0x00c15416 in __kernel_vsyscall ()
#1 0x002f522c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2 0x00a73a9d in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libc.so.6
#3 0x00b9b869 in PR_WaitCondVar () from /lib/libnspr4.so
#4 0x00809c0f in NSSRWLock_LockWrite_Util () from /usr/lib/libnssutil3.so
#5 0x05e9ae0e in ?? () from /usr/lib/libnss3.so
#6 0x05ebd014 in ?? () from /usr/lib/libnss3.so
#7 0x05ebd60d in ?? () from /usr/lib/libnss3.so
#8 0x05eb0506 in SECMOD_LoadModule () from /usr/lib/libnss3.so
#9 0x05eb047f in SECMOD_LoadModule () from /usr/lib/libnss3.so
#10 0x05e7c007 in ?? () from /usr/lib/libnss3.so
#11 0x05e7c95e in NSS_Initialize () from /usr/lib/libnss3.so
#12 0x008e8609 in ?? () from /usr/lib/libcurl.so.4
#13 0x008e9215 in Curl_nss_connect () from /usr/lib/libcurl.so.4
#14 0x008df9a3 in Curl_ssl_connect () from /usr/lib/libcurl.so.4
#15 0x008bc1fa in Curl_http_connect () from /usr/lib/libcurl.so.4
#16 0x008c44c6 in Curl_protocol_connect () from /usr/lib/libcurl.so.4
#17 0x008c5075 in ?? () from /usr/lib/libcurl.so.4
#18 0x008c58cf in Curl_async_resolved () from /usr/lib/libcurl.so.4
#19 0x008d1b2f in Curl_perform () from /usr/lib/libcurl.so.4
#20 0x008d2a74 in curl_easy_perform () from /usr/lib/libcurl.so.4
#21 0x006b4693 in ?? () from /usr/lib/php/modules/curl.so
#22 0x056e4ac9 in ?? () from /etc/httpd/modules/libphp5.so
#23 0x056bb87e in execute () from /etc/httpd/modules/libphp5.so
#24 0x05693a66 in zend_execute_scripts () from /etc/httpd/modules/libphp5.so
#25 0x05639cb6 in php_execute_script () from /etc/httpd/modules/libphp5.so
#26 0x057236b3 in ?? () from /etc/httpd/modules/libphp5.so
#27 0x00dc6421 in ap_run_handler ()
#28 0x00dca166 in ap_invoke_handler ()
#29 0x00dd6fa8 in ap_process_request ()
#30 0x00dd39e8 in ?? ()
#31 0x00dcec71 in ap_run_process_connection ()
#32 0x00ddc44a in ?? ()
#33 0x00ddc7ee in ?? ()
#34 0x00ddd793 in ap_mpm_run ()
#35 0x00db0ab2 in main ()
它似乎卡在 pthread_condition 等待状态。有人有线索吗 ?同样的请求每次都通过命令行成功;所以它确实指向图书馆。
编辑:
以下是它永远不会发出的调用。
* About to connect() to live.sagepay.com port 443 (#0)
* Trying x.x.x.x... * connected
* Connected to live.sagepay.com (x.x.x.x) port 443 (#0)
* warning: ignoring unsupported value (1) of ssl.verifyhost
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using SSL_RSA_WITH_RC4_128_MD5
* Server certificate:
* subject: CN=live.sagepay.com,OU="Member, VeriSign Trust Network",OU=Authenticated by VeriSign,OU=Terms of use at www.verisign.co.uk/rpa (c)05,OU=Sage,O=Sage (UK) Limited,L=Newcastle Upon Tyne,ST=TYNE AND WEAR,C=GB,serialNumber=x.x.x,OID.x.x.x=Private Organization,OID.x.x.x.x=GB
* start date: Mar 05 00:00:00 2011 GMT
* expire date: Mar 04 23:59:59 2013 GMT
* common name: live.sagepay.com
* issuer: CN=VeriSign Class 3 Extended Validation SSL SGC CA,OU=Terms of use at https://www.verisign.com/rpa (c)06,OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US
> POST /gateway/service/vspserver-register.vsp HTTP/1.1^M
Host: live.sagepay.com^M
Accept: */*^M
Content-Length: 664^M
Content-Type: application/x-www-form-urlencoded^M
^M
< HTTP/1.1 200 OK^M
< Date: Wed, 15 Jun 2011 16:11:43 GMT^M
< Server: Microsoft-IIS/6.0^M
< X-Powered-By: ASP.NET^M
< Content-Language: en-GB^M
< Content-Length: 276^M
< Set-Cookie: NSC_wjq-tbhfqbz-dpn-ofx=xxxx;expires=Wed, 15-Jun-2011 16:48:26 GMT;path=/;secure;httponly^M
< ^M
* Connection #0 to host live.sagepay.com left intact
编辑:问题出在 NSS 上,使用 OpenSSL 重新编译了 curl 和更多的依赖项(libssh2),到目前为止它似乎工作正常。
干杯!
最佳答案
在脚本末尾添加以下内容以获取失败原因
if( $rawresponse === false )
syslog( LOG_INFO , "base.php::requestPost() : ".curl_error($curlSession) );
编辑 1
这可能是 curl 的内部问题。在所有检查之前,所有服务器运行时都是最新的(至少是 php、php-curl 和 apache)。检查他们所有的日志.......然后我会建议比较几个生产环境或开发/测试环境之间的结果。
最后尝试缩小可以重现您的问题的最小测试用例并发布测试用例的完整代码。
关于PHP - curl_exec 挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6308842/
我有一个应用程序,当通过 eclipse 运行时,它会导致 eclipse 本身挂起。如果我将此应用程序导出为 jar 并运行它,它工作正常。但是,如果我运行(或调试)它,应用程序将显示为启动(根据
我正在将项目从 Rails2 切换到 Rails3。我跑: rails server 服务器启动没有错误: => Booting WEBrick => Rails 3.0.7 application
当我尝试使用 XCode 打开特定项目时,它挂起。当它挂起时,它显示以下屏幕: 其他项目可以正常打开,虽然挂起的项目也打开了,意味着我什么也做不了。我的 CPU 全速运行(风扇开始运转),我必须退出多
我正在使用 BNHtmlPdfKit 将 Html 呈现为 PDF。它工作得很好,但在 iOS8 中它只是挂起 [renderer drawPageAtIndex:i inRect:renderer.
我一直在尝试在 eclipse 中创建一个项目,并且有一个名为 InitRemoteEditJob 的工作正在阻止一切。它甚至没有被取消。 请建议怎么办? 最佳答案 这个错误有很多原因。 你可以试试这
我使用这个函数来发出 cURL 请求: function curl_request($options) //single custom cURL request. { $ch = curl_i
当我尝试归档某个项目时,Xcode 无法响应。如果让他一个人呆着,他会在很长一段时间后设法打开管理器。文件在那里。如果从 library/developer/xcode/archives 中手动删除,
有时我的 Eclipse 挂起,我需要猛烈地杀死它。但是,我一直无法正确地做到这一点。似乎 kill -9 实际上并没有以正确的方式关闭它,因为我仍然可以看到挂起的窗口。什么命令序列会正确杀死我的 E
我有一个JavaFX 8应用,它有时会挂起/冻结。我觉得我已经排除了造成此问题的许多原因,但它仍在发生。 不幸的是,我无法按需复制冻结/挂起。实际上,这仅发生在(到目前为止)我同事的计算机上。它可能在
我正在尝试学习网络基础知识,并且已经从this教程构建了回显服务器。我用telnet检查了服务器,它工作正常。 现在,当我使用Internet上的许多客户端示例中的一些示例时: // Create a
我正在尝试使用 SwiftUI 实现使用 Apple 登录,但在我输入正确的密码后它挂起。 我正在使用真实用户和模拟器以及 XCode 12.0 Beta。不幸的是,我现在没有可供测试的设备。我也尝试
我包括此简单的错误处理功能来格式化错误: date_default_timezone_set('America/New_York'); // Create the error handler. fun
我正在尝试为 VisualVM 安装一些插件,但它一直卡在下面的屏幕上 - 告诉我“请等待安装程序发现插件依赖项”。我运行的是 Ubuntu 12.04。当我尝试从“可用插件”列表中安装它们时,以及当
如果堆分配/取消分配/重新分配在另一个线程中进行,DbgHelp 库的 MiniDumpWriteDump() 将挂起。这是调用堆栈:DbgHelp 暂停其他线程,然后无限期地等待这些线程获得的互斥量
我正在尝试在 Eclipse C++ 版本中安装新软件。 帮助 -> 安装新软件。当我去安装新软件时,它会挂起或需要几个小时才能移动百分比。 我读到这是 JRE7 中的一个已知错误,我假设我在安装它后
这个问题已经有答案了: process.waitFor() never returns (12 个回答) 已关闭 3 年前。 我使用以下代码运行命令: open class AppRunner {
我正在尝试为 VisualVM 安装一些插件,但它一直卡在下面的屏幕上 - 告诉我“请等待安装程序发现插件依赖项”。我正在运行 Ubuntu 12.04。当我尝试从“可用插件”列表安装它们时,以及当我
如果堆分配/取消分配/重新分配在另一个线程中进行,DbgHelp 库的 MiniDumpWriteDump() 将挂起。这是调用堆栈:DbgHelp 暂停其他线程,然后无限期地等待这些线程获得的互斥量
尝试调试竞争条件,其中我们的应用程序的轮询器线程之一永远不会返回,导致 future 的轮询器永远不会被调度。用抽象术语来说,在捕获问题时隐藏我们的业务逻辑,这就是我们的代码路径。 我们必须更新远程服
我在程序完成时遇到 Java 的 ExecutorCompletionService 问题。 我需要使用 ExecutorCompletionService 而不是 ExecutorService 因
我是一名优秀的程序员,十分优秀!