我的PHP文件有问题,执行时间超过30秒.
搜索之后,我set_time_limit(0);在代码开头添加了cbut,文件仍然500 error在30秒后超时.
log: PHP Fatal error: Maximum execution time of 30 seconds exceeded in /xxx/xx/xxx.php
safe-mode : off
Run Code Online (Sandbox Code Playgroud) 我有一个非常简单的问题.我正在使用HTTP POST将文件上传到服务器.问题是我需要专门处理连接超时并在发生超时后添加一些等待算法来重新启动服务器.
我的代码非常简单:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("SomeURI");
request.Method = "POST";
request.ContentType = "application/octet-stream";
request.KeepAlive = true;
request.Accept = "*/*";
request.Timeout = 300000;
request.AllowWriteStreamBuffering = false;
try
{
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
WebHeaderCollection headers = response.Headers;
using (Stream Answer = response.GetResponseStream())
{
// Handle.
}
}
}
catch (WebException e)
{
if (Timeout_exception)
{
//Handle timeout exception
}
}
Run Code Online (Sandbox Code Playgroud)
我省略了文件读取代码,因为它不是我们关注的问题.现在我需要确保一旦抛出WebException,我会过滤异常以查看它是否确实是超时异常.我想与异常消息进行比较但我不确定这是否是正确的方法,因为有问题的应用程序是商业应用程序,我担心消息在不同语言之间有所不同.我应该寻找什么信息.
有什么建议?
我想以特定间隔(10秒)显示div并显示下一个div并继续并重复相同的操作.
**
序列 :
**在第10秒显示div1,隐藏其他div,
5秒
后间隔显示div 2并隐藏其他div,
5秒后间隔显示div 3并隐藏其他div,
并每10秒重复一次.
代码遵循:
<div id='div1' style="display:none;">
<!-- content -->
</div>
<div id='div2' style="display:none;">
<!-- content -->
</div>
<div id='div3' style="display:none;">
<!-- content -->
</div>
Run Code Online (Sandbox Code Playgroud) 我想知道在哪里可以为到达我的servlet(或我所有的servlet)的所有请求配置请求超时?那是我认为的容器财产吗?另外,这对不同的浏览器有何影响?它们都符合容器规定的参数吗?或者请求超时时间甚至不是我可以控制的,每个浏览器自己决定这个?(为了清楚我不是在谈论会话超时)
我有一个MVC 2应用程序,其中超时设置为2880(我理解它的分钟,但即使它是几秒钟就有问题):
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
Run Code Online (Sandbox Code Playgroud)
现在这应该意味着48小时,或至少48分钟(如果值是秒).但用户只需几分钟的不活动即可退出...
这是为什么?任何帮助赞赏!
我有一个测试需要工作超过1分钟(VS2008,MSTest,从VisualStudio启动测试):
const int TestTimeout = 1;
[TestMethod]
[Timeout(10*60*1000)] // 10 minutes
public void Login_ExpirationFail_Test()
{
IAuthenticationParameters parameters = new AuthenticationParameters(...);
LdapAuthentication auth1 = new LdapAuthentication();
IAuthenticationLoginResult res = auth1.Login(parameters);
Assert.IsNotNull(res);
Assert.IsFalse(string.IsNullOrEmpty(res.SessionId));
const int AdditionalMilisecodns = 400;
System.Threading.Thread.Sleep((TestTimeout * 1000 + AdditionalMilisecodns) * 60);
LdapAuthentication auth2 = new LdapAuthentication();
auth2.CheckTicket(res.SessionId);
}
Run Code Online (Sandbox Code Playgroud)
此测试在"运行"模式下完成,"测试'Login_ExpirationFail_Test'超出执行超时期限." 错误消息,在"调试" - 它工作正常.
我看到几个与从命令行启动测试相关的类似问题.
如何在"运行"模式下使我的测试可行?
谢谢.
我有一个简单的iOS本机应用程序,可以加载单个UIWebView.如果应用程序没有完全在20秒内完成在webView中加载初始页面,我希望webView显示错误消息.
我在这里加载了我的webView viewDidLoad(简化):
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.example.com"] cachePolicy:NSURLCacheStorageAllowed timeoutInterval:20.0]];
Run Code Online (Sandbox Code Playgroud)
该timeoutInterval代码在上述范围内实际上并没有"做"什么,因为苹果有它在操作系统中设置为不实际超时240秒.
我设置了自己的webView didFailLoadWithError操作,但如果用户有网络连接,则永远不会调用它.webView继续尝试使用我的networkActivityIndicator旋转加载.
有没有办法为webView设置超时?
我正在使用自托管GitLab CI server(社区版v8.9.5)和gitlab-ci-multi-runner1.2.0来构建项目.我的一个管道阶段(测试)需要一段时间才能运行,我得到以下erm:
Run Code Online (Sandbox Code Playgroud)ERROR: Build failed: execution took longer than 3600 seconds
我在哪里放置超时的覆盖?我可以将它应用于测试管道阶段吗?
我使用以下命令运行子进程:
p = subprocess.Popen("subprocess",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE)
Run Code Online (Sandbox Code Playgroud)
此子进程可以立即退出stderr上的错误,也可以继续运行.我想检测这些条件中的任何一个 - 后者等待几秒钟.
我试过这个:
SECONDS_TO_WAIT = 10
select.select([],
[p.stdout, p.stderr],
[p.stdout, p.stderr],
SECONDS_TO_WAIT)
Run Code Online (Sandbox Code Playgroud)
但它只是返回:
([],[],[])
Run Code Online (Sandbox Code Playgroud)
无论哪种条件.我能做什么?
在使用py.test时,我有一些测试可以正常运行SQLite但在我切换到Postgresql时静默挂起.我该如何调试这样的东西?是否有"详细"模式我可以运行我的测试,或设置断点?更一般地说,当pytest无声地停止时,标准的攻击计划是什么?我已经尝试使用pytest-timeout,并使用$ py.test --timeout = 300运行测试,但测试仍然挂起,屏幕上没有任何活动
timeout ×10
.net ×1
.net-3.5 ×1
asp.net ×1
c# ×1
containers ×1
css ×1
exception ×1
execution ×1
gitlab-ci ×1
hang ×1
html ×1
httprequest ×1
ios5 ×1
java ×1
javascript ×1
jquery ×1
loading ×1
mstest ×1
php ×1
popen ×1
postgresql ×1
pytest ×1
python ×1
select ×1
servlets ×1
sqlite ×1
subprocess ×1
tdd ×1
uiwebview ×1
unit-testing ×1
xcode ×1