Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Exception handler for connection timeout #39

Closed
s-kk opened this issue Apr 18, 2020 · 3 comments
Closed

[Feature Request] Exception handler for connection timeout #39

s-kk opened this issue Apr 18, 2020 · 3 comments
Labels
enhancement New feature or request stale
Milestone

Comments

@s-kk
Copy link

s-kk commented Apr 18, 2020

During testing, I've encountered a exception on HTTP connection timeout and then the thread crashed. Here's the console output.

发送GET请求出现异常!java.net.SocketTimeoutException: connect timed out                                 
java.net.SocketTimeoutException: connect timed out
        at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)                              
        at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)       
        at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
        at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)         
        at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)                         
        at java.base/java.net.Socket.connect(Socket.java:609)                                           
        at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:285)                     
        at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177)                            
        at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)                        
        at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)                        
        at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:265)                
        at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:372)                   
        at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Abst$
actDelegateHttpsURLConnection.java:191)                                                                 
        at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:11$
7)
        at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:108$
)
        at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDeleg$
teHttpsURLConnection.java:177)
        at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.ja$
a:168)
        at nicelee.bilibili.util.HttpRequestUtil.getContent(HttpRequestUtil.java:294)                   
        at nicelee.bilibili.live.impl.RoomDealerBilibili.getRoomInfo(RoomDealerBilibili.java:32)        
        at nicelee.bilibili.Main.getRoomInfo(Main.java:173)                                             
        at nicelee.bilibili.threads.ThRecord.run(ThRecord.java:71)                                      
org.json.JSONException: A JSONObject text must begin with '{' at 0 [character 1 line 1]                 
        at org.json.JSONTokener.syntaxError(JSONTokener.java:507)                                       
        at org.json.JSONObject.<init>(JSONObject.java:222)                                              
        at org.json.JSONObject.<init>(JSONObject.java:406)                                              
        at nicelee.bilibili.live.impl.RoomDealerBilibili.getRoomInfo(RoomDealerBilibili.java:35)        
        at nicelee.bilibili.Main.getRoomInfo(Main.java:173)                                             
        at nicelee.bilibili.threads.ThRecord.run(ThRecord.java:71) 

Is it possible to add a exception handler for this? Thanks a lot!

@nICEnnnnnnnLee
Copy link
Owner

ANY network exception during a long-time recording is understandable, but timeout error in a short query sounds like the network condition somehow is not in the mood for a record.

@nICEnnnnnnnLee
Copy link
Owner

I'm considering to raise the threshold of connection timeout, and/or regard the timeout query as a offline query

@github-actions
Copy link

由于长期没有状态更新,该问题自动关闭。如有需要可重新打开。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests

2 participants