Comments (8)
Published new release of the gem with your fixes so closing this one for now, thanks!
https://github.com/nats-io/pure-ruby-nats/releases/tag/v0.1.2
from nats-pure.rb.
After some more digging into this I think the problem is much simpler luckily
- it IS connecting to all the addresses, v4 and v6, so thats great
- it is not always trying the v6 address before the v4 address, this is probably wrong but lets ignore that for now, I could make that into a different ticket
- When connecting it always tries all the servers found in DNS and doesn't stop when it finds a good connection https://github.com/nats-io/pure-ruby-nats/blob/60a958b896a219cf0e5dbf9cd7132d4b1959e50a/lib/nats/io/client.rb#L972
So simply changing that to:
addrinfo.each_with_index do |ai, i|
begin
@socket = connect_addrinfo(ai, @uri.port, @connect_timeout)
break
rescue SystemCallError
# Give up if no more available
raise if addrinfo.length == i+1
end
end
ie. breaking if the socket connect_addrinfo
doesn't raise any errors - ie. we're connected - then this all works
Some extra error callbacks would still be good
from nats-pure.rb.
PR addresses the stuff I mentioned - except for the V6 first.
@wallyqs you're free to discard and do whatever you prefer, there doesnt seem to be test coverage for the Socket class so I didnt add any tests
from nats-pure.rb.
Good catch... Merged your changes after adding some minor changes to the spec. I will take a look at the ipv4/ipv6 connection preference and update here too. Thanks for the PR and the feedback!
from nats-pure.rb.
Seems that since right now we are relying on the default behavior from Socket.getaddrinfo
for the ordering of the list of endpoints to attempt to connect, and since it looks like that result already went through from what is defined in the RFC-3484 and RFC-6724 standards, think we can probably leave as is for now, and letting the user determine the ipv6 ordering by tuning /etc/gai.conf
to set the precedence of address families to try when connecting as it is suggested in those RFCs.
from nats-pure.rb.
That's what I thought but my machines are configured for IPv6 priority already - and works for other stuff. Not to worry I will investigate further and if I can narrow it down to either environment or code I will make a new ticket. For now happy to close this one
from nats-pure.rb.
As a separate issue sounds good for now, we could add a sort_by
ipv6 before attempting to connect ( (wallyqs/pure-ruby-nats@48dfda9d5967fc17832e565817e3ee64ff368937)[example]) so that those addresses are tried first but just not sure whether that is correct. Thanks again.
from nats-pure.rb.
Yeah, I'll investigate more - probably in a few weeks.
Happy to close this and hopefully we get a release soon :)
from nats-pure.rb.
Related Issues (20)
- KV History
- Review and verify that on create of streams and consumers, naming errors are surfaced in the client
- Default Error Listener
- Don't Auto ack when Ack Policy is No Ack
- Implement Allow consumer filter subject to be updated
- Implement Support Consumer Retry Backoff and Nak delays
- Implement StreamInfo request changes to retrieve subjects
- Implement Bind subscribe validation
- Implement new pull consumer and ephemeral consumer options
- Implement MaxBytes for pull requests
- pull_consumer behaving oddly
- Implement support for Jetstream consumers with multiple subject filters
- Possible bug in nats-pure.rb/lib/nats/io /client.rb#1828 HOT 2
- NATS connection with username / password with URI Escape characters fails
- List of keys from jetstream KV
- Implement Consumer Pause
- Alternate Prefixes
- Flow Control
- Nats-Expected-Last-Sequence
- Nats-Expected-Last-Msg-Id
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nats-pure.rb.