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

Allow timeout to be specified to TwitterClient.stopFilteredStream() #393

Open
takeshitakenji opened this issue Sep 10, 2022 · 3 comments
Open

Comments

@takeshitakenji
Copy link
Contributor

I've been dealing with strange network timeouts during filtered streams recently, and while I was able to supply network timeouts to the HTTP layer by switching to Scribe's Apache HTTP client backend, twittered doesn't have a way to supply a timeout to TwitterClient.stopFilteredStream(). Below is a stack trace showing the cancellation taking 25 minutes when it should be much closer to the 1 minute timeout I specified to the HTTP layer. (TwitterProducer is my code and is what calls TwitterClient.stopFilteredStream() with the future as dictated in the twittered documentation.)

2022-09-10 03:51:56,481 [TwitterProducer-scheduled-0] WARN  t.worker.TwitterProducer - Failed to close null
java.util.concurrent.TimeoutException: null
        at com.github.scribejava.httpclient.apache.OAuthAsyncCompletionHandler.getResult(OAuthAsyncCompletionHandler.java:103)
        at com.github.scribejava.httpclient.apache.ApacheHttpFuture.get(ApacheHttpFuture.java:42)
        at twitter2mastodon.worker.TwitterProducer.lambda$refreshWatch$46(TwitterProducer.java:649)
2022-09-10 04:14:19,366 [I/O dispatcher 1] ERROR i.g.r.t.helpers.RequestHelperV2 - 60,000 milliseconds timeout on connection http-outgoing-14 [ACTIVE]
java.net.SocketTimeoutException: 60,000 milliseconds timeout on connection http-outgoing-14 [ACTIVE]
        at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.timeout(HttpAsyncRequestExecutor.java:381)
        at org.apache.http.impl.nio.client.InternalIODispatch.onTimeout(InternalIODispatch.java:92)
2022-09-10 04:14:19,367 [TwitterProducer-scheduled-1] ERROR i.g.r.twitter.TwitterClient - Couldn't stopFilteredstream 
java.util.concurrent.ExecutionException: java.net.SocketTimeoutException: 60,000 milliseconds timeout on connection http-outgoing-14 [ACTIVE]
        at com.github.scribejava.httpclient.apache.OAuthAsyncCompletionHandler.getResult(OAuthAsyncCompletionHandler.java:95)
        at com.github.scribejava.httpclient.apache.ApacheHttpFuture.get(ApacheHttpFuture.java:37)
        at io.github.redouane59.twitter.TwitterClient.stopFilteredStream(TwitterClient.java:983)
        at twitter2mastodon.worker.TwitterProducer.lambda$refreshWatch$47(TwitterProducer.java:657)
Caused by: java.net.SocketTimeoutException: 60,000 milliseconds timeout on connection http-outgoing-14 [ACTIVE]
        at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.timeout(HttpAsyncRequestExecutor.java:381)
        at org.apache.http.impl.nio.client.InternalIODispatch.onTimeout(InternalIODispatch.java:92)
@takeshitakenji
Copy link
Contributor Author

I can put up a PR to add this later on.

@redouane59
Copy link
Owner

Hey @takeshitakenji , yes that's a good point. I don't really master this topic because it was developed by someone else but if you feel that you can improve it, feel free to submit a pull request !

@redouane59
Copy link
Owner

I can put up a PR to add this later on.

yes it would be perfect !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants