Closed bwhite closed 11 years ago
Although it definitely shouldn't error there, it appears it couldn't connect. The oauth accepts the oauth params and would look like this
go run twoauth.go --cs=xx \
--ck=xx \
--ot=xx \
--os=xx \
--user=username
go run twoauth.go --help
Usage of /tmp/go-build066061857/command-line-arguments/_obj/exe/twoauth:
-ck="": Consumer Key
-cs="": Consumer Secret
-logging="debug": Which log level: [debug,info,warn,error,fatal]
-maxct=10: Max # of messages
-os="": OAuthTokenSecret
-ot="": Oauth Token
-search="android,golang,zeromq,javascript": keywords to search for, comma delimtted
-user="": twitter username
-users="": list of twitter userids to filter for, comma delimtted
Before I had hardcoded them but I tried the command line, same error. I had traced it down to inside the oauth library but couldn't find the issue. It says it is a timeout error which is odd because the default timeout is 0 which should mean it shouldn't timeout. When you run it does it work? I figured the new API changes broke it (I'm able to use anaconda and twittergo just fine) and it would help me out tremendously to be able to use the streaming api.
The null pointer error is just because of this https://github.com/araddon/httpstream/blob/master/stream.go#L135 (just return null, err there). The real error is something to do with the oauth connection at this line https://github.com/araddon/httpstream/blob/master/stream.go#L124. Is there anything I can do to make it easier to figure out what the problem is?
Can you run this with your ConsumerKey, Secret? That will help isolate it down a bit https://gist.github.com/araddon/5914272
Thanks for your help I got
2013/07/02 20:28:31 send: addr = api.twitter.com:https read tcp 199.16.156.40:443: i/o timeout
The second line came from https://gist.github.com/araddon/5914272#file-twoauth-go-L40 so it was an error getting the url. I did deleted the local version of "github.com/akrennmair/goauth" and tried again, no help. Maybe you have a version of it that works and the current head is broken?
My "go version" go version go1.1.1 linux/amd64. If it helps I could make a new twitter account and just give you the tokens to try out on your side.
I don't think it is token related, it sounds network related possibly? Any way you have a proxy on your network? I verified that the goauth version i have is the most recent off of master from akrenmair/goauth.
Try this, drop a few fmt.Println() statements to debug here: https://github.com/akrennmair/goauth/blob/master/http.go#L131 and pre/post line 138, figure out which of those two is erroring, if that doesn't work try changing line 138
resp, err = http.ReadResponse(reader, req)
// replace with
resp, err = http.DefaultClient.Do(req)
Awesome figured it out. For some reason if I do "go get github.com/akrennmair/goauth" it gives me a super old version (maybe that is tagged or there is some config file specifying to use that? I haven't seen this problem). I noticed when I tried to add print statements and use my own branch it was still pulling an old version, I manually went into the dir and did "git checkout master" then redid the "go get" to rebuild. No idea why that is but now it works great. I'm planning to use httpstream for this project http://www.youtube.com/watch?v=mHWejjTwOMY as right now I have to use the mentions timeline and search api calls which have a high latency (~60 sec due to limiting for mentions). Thank you for your help, much appreciated.
I ran into the same issue as bwhite. Maybe worth making a note in the README?
Ok, let me try a few things and consider different oauth, or reame etc.
I have the same issue, btw. Getting the current oauth master does not seem to fix it.
@linohh, @lateefj, @bwhite thank you for identifying this. As noted above, this I did track down to the behavior in go get which uses Flags/Branches and was thus pulling this old out of date branch: https://github.com/akrennmair/goauth/tree/go1
So had to update to my version of it.
Hmmm. Something still seems to be broken with oauth signature generation or something, I get 401 Errors. Or I'm missing something, which always may be the case :)
oh this one was on me. seems like the flag package works a bit different than expected.
Fixed a performance issue in the oauth implementation. If you accept the pull request in the other project, httpstream should fetch stuff much faster when timeout is set to 0.
@linohh +1
@araddon Can you please merge? Even forks of this project are suffering from this.
By the way I'm using a fork of this project (https://github.com/ahmetalpbalkan/httpstream) forked from https://github.com/attilaolah/oauth 's lint branch)
It uses a different oauth library, (https://github.com/mrjones/oauth) but the error persists and it does not seem like it's thrown from oauth code. (I'm using examples/simple.go)
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x38 pc=0x3f184]
goroutine 1 [running]:
runtime.panic(0x238140, 0x5042f9)
/usr/local/homebrew/Cellar/go/1.2/libexec/src/pkg/runtime/panic.c:266 +0xb6
github.com/ahmetalpbalkan/httpstream.(*streamConn).oauthConnect(0xc210049460, 0x0, 0x0, 0x0, 0x0)
/Users/alp/workspace/project/src/github.com/ahmetalpbalkan/httpstream/stream.go:109 +0xa4
github.com/ahmetalpbalkan/httpstream.func·003(0x2406a0, 0xc2100484c0, 0x1fab9)
/Users/alp/workspace/project/src/github.com/ahmetalpbalkan/httpstream/stream.go:277 +0x32
github.com/ahmetalpbalkan/httpstream.(*Client).Connect(0xc21004f120, 0xc2100490e0, 0x0, 0xc21004f060, 0x0, ...)
/Users/alp/workspace/project/src/github.com/ahmetalpbalkan/httpstream/stream.go:281 +0x1f6
github.com/ahmetalpbalkan/httpstream.(*Client).Sample(0xc21004f120, 0xc21004f060, 0x2cd170, 0x2a)
/Users/alp/workspace/project/src/github.com/ahmetalpbalkan/httpstream/stream.go:380 +0x47
main.main()
/Users/alp/workspace/project/src/main.go:52 +0x311
I tried it out with my credentials and got
05:35:46.053035 http.go:116: send: addr = stream.twitter.com:https 2013/06/29 05:35:46 stream.go:135: read tcp 199.16.156.110:443: i/o timeout panic: runtime error: invalid memory address or nil pointer dereference [signal 0xb code=0x1 addr=0x10 pc=0x4307a0]
goroutine 1 [running]: github.com/araddon/httpstream.(_Client).Connect(0xc200099460, 0xc2000b40e0, 0xc200095a40, 0xc2000bc0c0, 0x0, ...) gocode/src/github.com/araddon/httpstream/stream.go:317 +0x3f0 github.com/araddon/httpstream.(_Client).Filter(0xc200099460, 0x777200, 0x0, 0x0, 0xc200095a00, ...) /gocode/src/github.com/araddon/httpstream/stream.go:372 +0x44b main.main() twoauth.go:75 +0x676
goroutine 2 [syscall]: