-
Notifications
You must be signed in to change notification settings - Fork 246
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
UserStream: many "twitter socket closed, leaving loop" until error 420 #231
Comments
By adding if err := scanner.Err(); err != nil {
s.api.Log.Notice(err)
} after the mentioned for-loop over
So I doubled the scanner := bufio.NewScanner(response.Body)
scanner.Buffer([]byte{}, 2*bufio.MaxScanTokenSize) I probably should have used Or is it a bug? |
What's the token that it's choking on? I'm surprised that there's a token longer than |
At the moment, the very first token I receive from Twitter is a large array of IDs with 78467 bytes. UserStream will be replaced in June, so documentation is not clear: But looking at |
After updating to the most recent version I started getting these as well:
In my case I am just using Update: |
👍 on this - i'm getting those same info messages until finally it culminates into
That's an error being thrown from a different library, but I have a feeling it's a result of this open/close loop? I tried setting: But that did not work |
Looks like it's related to this commit: I wonder if the timeout and reconnecting is too aggressive? According to twitter docs:
https://developer.twitter.com/en/docs/tweets/filter-realtime/guides/connecting |
Agreed; this seems to be a regression from c0624fe. For whatever reason, the keep-alives aren't satisfying the timeout either. I changed the timeout from 20 to 90 seconds and it's still timing out after 90 seconds. For me it's just reconnecting (so harmless?) but maybe I'm just not waiting long enough to get the 420 error. If you're not subject to the mutex deadlock, it might make sense to comment out twitter.c line 130. This is probably just affecting the streaming API, which Twitter plans to sunset on June 19, 2018, so it may not be worth a long-term fix. |
* Enforce a default HTTP client timeout, to avoid deadlocking wrapper mutexes * Fix webhook documentation link
Hi, I'm experiencing similar behaviours. I've tried listening for all incoming events to see if twitter sends a keep alive or not, but it doesn't seem to. Maybe it's not responding to anacondas keepalive requests? |
I just received and email stating these API's they may have been shut down, however, that does not seem to be the case. This seems to work today; with the caveat that it gets disconnected often; however I do see new tweets being created. func main() {
api := anaconda.NewTwitterApiWithCredentials(
access_token,
access_token_secret,
consumer_key,
consumer_secret,
)
log := &logger{logrus.New()}
log.SetLevel(logrus.DebugLevel)
api.SetLogger(log)
v := url.Values{}
s := api.PublicStreamFilter(v)
v.Add("follow", "15209123") // 15209123 = @dijit
for {
item := <-s.C
log.Infoln(item)
} |
That's interesting -- I had also thought all streaming APIs were shut down in favor of the Account Activity API, but that seems not to be the case for PublicStreamFilter, unlike UserStreams and SiteStreams that were sunset on August 23. My experience with UserStreams before they were sunset was that they were also closed often by Twitter, which is why the |
Is this still not fixed ?
After the "write on closed buffer" my program crashes. All it does is reading from the Stream and printing the values. I get many "twitter socket closed, leaving loop", but the loop is started again after that. |
No support ? |
I think this is probably due to last August's sunset of the streaming API (or much of it, anyway). I did some work on an extension (#261) for the account Activity API, but it doesn't have equivalent functionality to the streaming API (in particular, you can't subscribe to a user's "home tweetstream", so I have lost interest in doing more work on this. |
Alright, thank you. |
From logger, I see it keeps getting "twitter socket closed, leaving loop"
and then trying to reconnect until it receives a 420 error from Twittter and
backs off for a while.
As far as I understand from the code,
scanner.Scan()
is returning false atanaconda/streaming.go
Line 176 in 6d66c39
Is it Twitter blocking User Stream access for my account?
Testing code:
The text was updated successfully, but these errors were encountered: