Skip to content

Unexepected "Conn close because of error end of file reached" in stream #165

@m-thomson

Description

@m-thomson

Describe the bug
The following command works as expected, but always terminates with an error "end of file reached" after precisely 5 minutes:

twurl -j -t -d follow=783214 -H stream.twitter.com /1.1/statuses/filter.json > tweets

The error is:

Conn close because of error end of file reached
Traceback (most recent call last):
	24: from /usr/local/bin/twurl:23:in `<main>'
	23: from /usr/local/bin/twurl:23:in `load'
	22: from /Library/Ruby/Gems/2.6.0/gems/twurl-0.9.6/bin/twurl:4:in `<top (required)>'
	21: from /Library/Ruby/Gems/2.6.0/gems/twurl-0.9.6/lib/twurl/cli.rb:21:in `run'
	20: from /Library/Ruby/Gems/2.6.0/gems/twurl-0.9.6/lib/twurl/cli.rb:40:in `dispatch'
	19: from /Library/Ruby/Gems/2.6.0/gems/twurl-0.9.6/lib/twurl/abstract_command_controller.rb:7:in `dispatch'
	18: from /Library/Ruby/Gems/2.6.0/gems/twurl-0.9.6/lib/twurl/request_controller.rb:15:in `dispatch'
	17: from /Library/Ruby/Gems/2.6.0/gems/twurl-0.9.6/lib/twurl/request_controller.rb:19:in `perform_request'
	16: from /Library/Ruby/Gems/2.6.0/gems/twurl-0.9.6/lib/twurl/oauth_client.rb:184:in `perform_request_from_options'
	15: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http.rb:1470:in `request'
	14: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http.rb:920:in `start'
	13: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http.rb:1472:in `block in request'
	12: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http.rb:1479:in `request'
	11: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http.rb:1517:in `transport_request'
	10: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http/response.rb:165:in `reading_body'
	 9: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http.rb:1518:in `block in transport_request'
	 8: from /Library/Ruby/Gems/2.6.0/gems/twurl-0.9.6/lib/twurl/request_controller.rb:20:in `block in perform_request'
	 7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http/response.rb:204:in `read_body'
	 6: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http/response.rb:283:in `read_body_0'
	 5: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http/response.rb:264:in `inflater'
	 4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http/response.rb:285:in `block in read_body_0'
	 3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http/response.rb:315:in `read_chunked'
	 2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/protocol.rb:201:in `readline'
	 1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/protocol.rb:191:in `readuntil'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/protocol.rb:225:in `rbuf_fill': end of file reached (EOFError)

Since it's always after 5 minutes (as measured with the linux time command), it leads me to the obvious conclusion that there is a 5 minute time limit for listening to streams. Is that the case? I can't find anything in the API docs mentioning this.

What is the best way to handle this? Should I just keep re-running the command in a loop?

Expected behavior
The command should run indefinitely unless terminated.

Desktop (please complete the following information):

  • OS: MacOS 14.4 on M1 Mac Mini.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions