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

Issue with latest releases and Celluloid #254

Closed
kstole opened this Issue Feb 26, 2019 · 6 comments

Comments

Projects
None yet
3 participants
@kstole
Copy link
Contributor

kstole commented Feb 26, 2019

I'm having an issue running a bot with the latest releases of slack-ruby-client and slack-ruby-bot when Celluloid is used as the concurrency library.

The bot tries to connect to Slack for a while until it finally encounters an exception for too many API calls.

Puma starting in single mode...
* Version 3.12.0 (ruby 2.5.3-p105), codename: Llamas in Pajamas
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://0.0.0.0:9292
Use Ctrl-C to stop
I, [2019-02-25T18:50:33.830169 #82067]  INFO -- request: POST https://slack.com/api/rtm.start
I, [2019-02-25T18:50:34.126264 #82067]  INFO -- response: Status 200
I, [2019-02-25T18:50:34.161070 #82067]  INFO -- request: POST https://slack.com/api/rtm.start
I, [2019-02-25T18:50:34.407250 #82067]  INFO -- response: Status 200
...

For a bit of additional testing, I forked slack-mathbot and got it working with updated ruby and other gems:
https://github.com/kstole/slack-mathbot/tree/443d89923ccaf0e8d64ff936825c73637c42bf54
but not with the latest versions of slack-ruby-client and slack-ruby-bot:
https://github.com/kstole/slack-mathbot/tree/8bcc927696d43ccef33ec0524dc349ac770506d7

@gsmetal

This comment has been minimized.

Copy link

gsmetal commented Feb 26, 2019

Same for me. After this message #208 (comment) I tried to update slack-ruby-bot and got infinite reconnects on bot start (on my local machine):

I, [2019-02-26T11:13:19.676049 #27027]  INFO -- request: POST https://slack.com/api/rtm.start
D, [2019-02-26T11:13:19.676147 #27027] DEBUG -- request: Accept: "application/json; charset=utf-8"
User-Agent: "Slack Ruby Client/0.14.0"
Content-Type: "application/x-www-form-urlencoded"
I, [2019-02-26T11:13:20.566883 #27027]  INFO -- response: Status 200
D, [2019-02-26T11:13:20.567021 #27027] DEBUG -- response: content-type: "application/json; charset=utf-8"
transfer-encoding: "chunked"
connection: "close"
date: "Tue, 26 Feb 2019 08:13:19 GMT"
server: "Apache"
expires: "Mon, 26 Jul 1997 05:00:00 GMT"
x-content-type-options: "nosniff"
pragma: "no-cache"
vary: "Accept-Encoding"
x-accepted-oauth-scopes: "rtm:stream,client"
x-oauth-scopes: "identify,bot:basic"
cache-control: "private, no-cache, no-store, must-revalidate"
x-xss-protection: "0"
x-slack-req-id: "7f2aeaca-35d8-4b53-a9e2-b67ff02caed0"
strict-transport-security: "max-age=31536000; includeSubDomains; preload"
referrer-policy: "no-referrer"
access-control-allow-origin: "*"
x-via: "haproxy-www-w13q"
x-cache: "Miss from cloudfront"
via: "1.1 3529bf84e9522012233c3dd2a59fdfe9.cloudfront.net (CloudFront)"
D, [2019-02-26T11:13:21.217017 #27027] DEBUG -- Slack::RealTime::Concurrency::Celluloid::Socket#connect!: WebSocket::Driver::Client
I, [2019-02-26T11:13:21.224434 #27027]  INFO -- request: POST https://slack.com/api/rtm.start
D, [2019-02-26T11:13:21.224505 #27027] DEBUG -- request: Accept: "application/json; charset=utf-8"
User-Agent: "Slack Ruby Client/0.14.0"
Content-Type: "application/x-www-form-urlencoded"
D, [2019-02-26T11:13:21.721559 #27027] DEBUG -- Slack::RealTime::Concurrency::Celluloid::Socket#write: GET /websocket/XXXXX HTTP/1.1
Host: cerberus-xxxx.lb.slack-msgs.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: XXXX
Sec-WebSocket-Version: 13


D, [2019-02-26T11:13:21.887341 #27027] DEBUG -- Slack::RealTime::Concurrency::Celluloid::Socket#handle_read: HTTP/1.1 101 Switching Protocols
upgrade: websocket
connection: upgrade
sec-websocket-accept: XXXXXX
X-Via: haproxy-lb-mp-lbcert-bom-692n


D, [2019-02-26T11:13:21.889081 #27027] DEBUG -- SlackRubyBot::Client#run_loop: WebSocket::Driver::OpenEvent
I, [2019-02-26T11:13:22.100866 #27027]  INFO -- response: Status 200
D, [2019-02-26T11:13:22.101030 #27027] DEBUG -- response: content-type: "application/json; charset=utf-8"
transfer-encoding: "chunked"
connection: "close"

and so on.

After switching to faye-websocket it works well as I can see.

@dblock

This comment has been minimized.

Copy link
Collaborator

dblock commented Feb 26, 2019

I'm looking into it.

@dblock

This comment has been minimized.

Copy link
Collaborator

dblock commented Feb 26, 2019

Please try #255

gem 'slack-ruby-client', github: 'dblock/slack-ruby-client', branch: 'fix-254'
@dblock

This comment has been minimized.

Copy link
Collaborator

dblock commented Feb 26, 2019

For mathbot I PRed slack-ruby/slack-mathbot#3

@dblock

This comment has been minimized.

Copy link
Collaborator

dblock commented Feb 26, 2019

I confirmed the fix in a few other places.

Released as 0.14.1.

@dblock

This comment has been minimized.

Copy link
Collaborator

dblock commented Feb 26, 2019

Ya'll should be switching to the maintained async-websocket lib when you get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.