标签: timeoutexception

执行过期异常崩溃Ruby线程,但处理Timeout :: Error

任何人都可以解释为什么我可能会看到这个堆栈(由HTTParty :: post请求引起)当方法的调用如下所示:

begin
  response = HTTParty::post(url, options)
rescue
  logger.warn("Could not post to #{url}")      
rescue Timeout::Error
  logger.warn("Could not post to #{url}: timeout")      
end
Run Code Online (Sandbox Code Playgroud)

堆栈:

/usr/local/lib/ruby/1.8/timeout.rb:64:in `timeout'
/usr/local/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
/usr/local/lib/ruby/1.8/net/protocol.rb:104:in `read_all'
/usr/local/lib/ruby/1.8/net/http.rb:2228:in `read_body_0'
/usr/local/lib/ruby/1.8/net/http.rb:2181:in `read_body'
/usr/local/lib/ruby/1.8/net/http.rb:2206:in `body'
/usr/local/lib/ruby/1.8/net/http.rb:2145:in `reading_body'
/usr/local/lib/ruby/1.8/net/http.rb:1053:in `request_without_newrelic_trace'
[GEM_ROOT]/gems/newrelic_rpm-3.1.1/lib/new_relic/agent/instrumentation/net.rb:20:in `request'
[GEM_ROOT]/gems/newrelic_rpm-3.1.1/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
[GEM_ROOT]/gems/newrelic_rpm-3.1.1/lib/new_relic/agent/instrumentation/net.rb:19:in `request'
/usr/local/lib/ruby/1.8/net/http.rb:1037:in `request_without_newrelic_trace'
/usr/local/lib/ruby/1.8/net/http.rb:543:in `start'
/usr/local/lib/ruby/1.8/net/http.rb:1035:in `request_without_newrelic_trace'
[GEM_ROOT]/gems/newrelic_rpm-3.1.1/lib/new_relic/agent/instrumentation/net.rb:20:in `request'
[GEM_ROOT]/gems/newrelic_rpm-3.1.1/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
[GEM_ROOT]/gems/newrelic_rpm-3.1.1/lib/new_relic/agent/instrumentation/net.rb:19:in `request'
[GEM_ROOT]/gems/httparty-0.7.8/lib/httparty/request.rb:69:in `perform'
[GEM_ROOT]/gems/httparty-0.7.8/lib/httparty.rb:390:in `perform_request'
[GEM_ROOT]/gems/httparty-0.7.8/lib/httparty.rb:358:in `post'
[GEM_ROOT]/gems/httparty-0.7.8/lib/httparty.rb:426:in `post'
Run Code Online (Sandbox Code Playgroud)

如您所见,我正在处理Timeout :: Error异常.这是在Ruby 1.8.7中.我很清楚在Ruby 1.8.7中,StandardException和TimeoutException有不同的继承树,所以我处理两者,但它似乎没有什么区别.

ruby exception-handling timeoutexception httparty

6
推荐指数
1
解决办法
4919
查看次数

在python、selenium中,如何设置等待的错误消息?

我有以下代码:

WebDriverWait(self.driver, 20).until(expected_conditions.element_to_be_clickable(click))
Run Code Online (Sandbox Code Playgroud)

现在这有时会失败,我知道为什么会失败。但错误给了我

TimeoutException: Message: 
Run Code Online (Sandbox Code Playgroud)

这是没用的。我可以设置这个消息吗?

python selenium timeoutexception

6
推荐指数
2
解决办法
6226
查看次数

如何解决TimeoutException: com.android.internal.os.BinderInternal$GcWatcher.finalize() 10秒后超时?

我在错误报告中看到了这个问题:

   Fatal Exception: java.util.concurrent.TimeoutException: com.android.internal.os.BinderInternal$GcWatcher.finalize() timed out after 10 seconds
   at java.lang.Daemons$Daemon.isRunning(Unknown Source)
   at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:219)
   at java.lang.Daemons$Daemon.run(Daemons.java:103)
   at java.lang.Thread.run(Thread.java:764)
Run Code Online (Sandbox Code Playgroud)

该错误仅发生在 Android 8 设备中。有什么建议吗?

在此输入图像描述

android timeoutexception android-8.0-oreo

6
推荐指数
0
解决办法
1080
查看次数

通过 Selenium 和 Python 使用带有预期条件的 WebDriverWait 时出现 selenium.common.exceptions.TimeoutException 错误

Traceback (most recent call last):
  File "Inventorytest.py", line 88, in <module>
    j.go_to_application()
  File "Inventorytest.py", line 65, in go_to_application
    EC.element_to_be_clickable((By.ID, 'FavoriteApp_ITEM'))
  File "/home/naroladev/Mercury_Back-End/mercuryenv/lib/python3.6/site-packages/selenium/webdriver/support/wait.py", line 80, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: 
Run Code Online (Sandbox Code Playgroud)

我在 EC2 服务器实例上遇到了上述异常。我的脚本在 Ubuntu 和 Mac 操作系统以及本地系统上任何版本的 firefox 和 geckodriver 上都可以正常工作。但是 EC2 ubuntu 18.04.01 版本出现上述错误,在此我也尝试升级和降级 firefox 和 geckodriver 版本,但仍然无法正常工作。谁能帮我提供建议和解决方案。

python selenium timeoutexception webdriverwait expected-condition

6
推荐指数
1
解决办法
2万
查看次数

iOS 5 Safari JavaScript执行超时超时

我正在开发一个主要是自包含的移动网络应用程序,仅在必要时与服务器通信.目前,使用的库是:

  • jQuery 1.6.4
  • jQuery UI 1.8.3
  • jQTouch的修改/修补版本

直到iOS 5发布之前,我们还使用了touchscroll.js,但不再需要它,因为Safari现在支持位置:固定和本机滚动.

自iOS 5发布以来,似乎随机出现了这个异常:

JavaScript: Error undefined JavaScript execution exceeded timeout
Run Code Online (Sandbox Code Playgroud)

一旦它被引发,Safari将执行运行时间超过短时间(比如1ms)的JS代码.刷新页面,转到新页面或转到新域名无效.任何和所有JS代码,甚至是简单的东西

for(var i = 0; i < 30; i++) ;
Run Code Online (Sandbox Code Playgroud)

在没有引发异常的情况下,浏览器不会执行.解决这个问题的唯一方法是强行杀死Safari并重启它.我想也可以在window.setTimeout(...,1)中将任何远程"重型"代码包装在应用程序中,或者利用Web Workers获取除UI更新之外的所有内容,但这看起来不是很好很好的解决方案,因为应用程序相当大,需要大量重写.

有没有人遇到过这个问题?你会如何调试这样的事情,因为似乎没有任何一段代码似乎将Safari置于这种破碎的状态,它似乎随机发生?

我试图通过执行以下操作来弄清楚移动Safari中JS引擎的超时:

var start, end;
start = new Date();

try {
   while(true);
} catch (ex) {
  alert('test');
}

end = new Date();
console.log(Number(end) - Number(start) + 'ms');
Run Code Online (Sandbox Code Playgroud)

不幸的是,这个超时异常似乎不是JS异常,所以它不能在try/catch块中捕获; 但是,最大超时时间似乎在几秒的范围内.我们的应用程序中的代码都没有锁定浏览器/ JS引擎那么久(因为它会提供一个糟糕的用户体验),大多数(如果不是全部)可能有300毫秒的执行时间(包括任何"重负荷").

javascript safari mobile-safari timeoutexception ios5

5
推荐指数
1
解决办法
3013
查看次数

Koush Ion Library - 使用进度条、TimeoutException 上传多部分/表单数据

我将像这样使用 Ion 将文件上传到 REST API(基于 Koush 提供的示例代码)

        if (Upload != null && !Upload.isDone() && !Upload.isCancelled()){
            resetUploadReq();
            return;
        }

        String UploadUrl    = Constants.Video_Upload_URL+userToken;
        Upload              = Ion.with(UploadActivity.this).load(UploadUrl)
                              .uploadProgressHandler(new ProgressCallback() {

                                @Override
                                public void onProgress(long uploaded, long total) {
                                    int mProgress   = (int) (100*uploaded / total);
                                    mUploadBtn.setProgress(mProgress);
                                }
                            })
                              .setTimeout( 15 * 1000)
                              .setMultipartFile("file", new File(Path))
                              .asJsonObject()
                              .setCallback(new FutureCallback<JsonObject>() {

                                @Override
                                public void onCompleted(Exception ex, JsonObject result) {
                                    resetUploadReq();
                                    if (ex == null){
                                        JsonObject  ReturnJson  = result.getAsJsonObject();
                                        Status                  = ReturnJson.get("status").getAsBoolean();

                                        if (Status == …
Run Code Online (Sandbox Code Playgroud)

android file-upload multipartform-data timeoutexception android-ion

5
推荐指数
1
解决办法
2573
查看次数

改造 2 错误:java.net.SocketTimeoutException:10000 毫秒后无法连接到 /192.168.86.1(端口 8080)

我正在尝试使用 Retrofit 2 使我的应用程序连接到本地 Web 服务,但我总是收到此错误。我确定 Web 服务正在响应,因为我在 firefox 中使用了一个工具来发出 @GET 请求并且返回正常,返回正确的 JSON。

在android中它甚至没有连接。

这是我的主要活动:

public class MainActivity extends AppCompatActivity {

    private String API_BASE_URL="http://192.168.1.32:8080/economarket-restService/resources/androidTest/";           

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        OkHttpClient.Builder httpClient = new OkHttpClient.Builder();            

        Retrofit.Builder builder = new Retrofit.Builder()
                .baseUrl(API_BASE_URL)
                .addConverterFactory(GsonConverterFactory.create());

        Retrofit retrofit = builder.client(
                httpClient.build()
        ).build();

        ContatoService contato = retrofit.create(ContatoService.class); 

        Call<Contato> repos = contato.listRespos(); //EconomarketService                 

        repos.enqueue(new Callback<Contato>() {
            @Override
            public void onResponse(Call<Contato> call, Response<Contato> response) {
                Contato contato = response.body();
                Toast.makeText(getBaseContext(), "Return" + contato.getName(), Toast.LENGTH_LONG).show();
                Log.d("Retorno",response.toString()); …
Run Code Online (Sandbox Code Playgroud)

android timeoutexception retrofit2

5
推荐指数
1
解决办法
1万
查看次数

如何防止引发 asyncio.TimeoutError 并继续循环

我正在使用带有 limited_as_completed 方法的 aiohttp 来加速报废(大约 1 亿个静态网站页面)。但是,代码在几分钟后停止,并返回 TimeoutError。我尝试了几件事,但仍然无法阻止引发 asyncio.TimeoutError。请问我如何忽略错误并继续?

我正在运行的代码是:

N=123
import html
from lxml import etree
import requests
import asyncio 
import aiohttp
from aiohttp import ClientSession, TCPConnector
import pandas as pd
import re 
import csv 
import time
from itertools import islice
import sys
from contextlib import suppress

start = time.time()
data = {}
data['name'] = []
filename = "C:\\Users\\xxxx"+ str(N) + ".csv"

def limited_as_completed(coros, limit):
    futures = [
        asyncio.ensure_future(c)
        for c in islice(coros, 0, limit)
    ]
    async def first_to_finish(): …
Run Code Online (Sandbox Code Playgroud)

python exception-handling timeoutexception python-asyncio aiohttp

5
推荐指数
3
解决办法
9560
查看次数

硒测试有时会在天蓝色管道中失败并在本地通过

单击按钮后未找到链接或任何验证消息,测试用例就会失败。

我使用显式等待页面加载:

var waitForDocumentReady = new WebDriverWait(WebDriver, TimeSpan.FromSeconds(10));
            waitForDocumentReady.Until((wdriver) => (WebDriver as IJavaScriptExecutor).ExecuteScript("return document.readyState").Equals("complete"));
Run Code Online (Sandbox Code Playgroud)

对于等待验证消息的特定 div:

 WebDriverWait wait = new WebDriverWait(WebDriver, TimeSpan.FromSeconds(10));
            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementExists(By.ClassName("validationErrors")));
Run Code Online (Sandbox Code Playgroud)

但测试用例有时会通过管道,有时会失败。

selenium timeoutexception selenium-webdriver azure-devops azure-pipelines

5
推荐指数
1
解决办法
3981
查看次数

java 11 HTTP 客户端上的“java.io.IOException:连接超时”VS HttpTimeoutException

我正在使用 Java 11 http-client ( java.net.http)。

send()方法声明了这些异常:

@throws IOException
@throws InterruptedException
@throws IllegalArgumentException
@throws SecurityException
Run Code Online (Sandbox Code Playgroud)

我对捕获超时引起的异常感兴趣。我认为最好的方法是抓住 HttpTimeoutException(扩展IOException

但是,我有时会看到,当发生超时时,引发的异常是:

java.io.IOException: Connection timed out
Run Code Online (Sandbox Code Playgroud)

现在我想知道:

  1. 为什么会抛出更一般的异常?
  2. 应该如何编写 catch 以确保捕获所有可能的超时相关异常?

java timeoutexception java-http-client java-11

5
推荐指数
1
解决办法
1251
查看次数