Skip to content

Do not leak DNS Request IDs#5019

Merged
enebo merged 1 commit intojruby:jruby-9.1from
olleolleolle:carry-do-not-leak-dns-request-ids-to-jruby-9-1
Jan 29, 2018
Merged

Do not leak DNS Request IDs#5019
enebo merged 1 commit intojruby:jruby-9.1from
olleolleolle:carry-do-not-leak-dns-request-ids-to-jruby-9-1

Conversation

@olleolleolle
Copy link
Member

@olleolleolle olleolleolle commented Jan 29, 2018

(This is a cherry-pick of #4981, here against jruby-9.1.)


While d1a760e fixed handling of compressed IPv6 addresses,
it also broke the "freeing" part of it.

Currently every DNS request leaks single request id:

require 'resolv'

Resolv::DNS::RequestID.values.map(&:length)

Resolv::DNS.new.getaddress('example.com')

Resolv::DNS::RequestID.values.map(&:length)

Given the fact that request ids are chosen from 0x0000..0xffff range - the app can issue 65535 requests and then will be blocked forever trying to allocate another one.

This commit makes request id caching work by using same data for allocation and freeing.

While jruby@d1a760e fixed handling of compressed IPv6 addresses,
it also broke the "freeing" part of it.

Currently every DNS request leaks single request id:
```
require 'resolv'

Resolv::DNS::RequestID.values.map(&:length)

Resolv::DNS.new.getaddress('example.com')

Resolv::DNS::RequestID.values.map(&:length)
```

Given the fact that request ids are chosen from `0x0000..0xffff` range - the app can issue 65535 requests and then will be blocked forever trying to allocate another one.

This commit makes request id caching work by using same data for allocation and freeing.
@olleolleolle
Copy link
Member Author

@enebo This is step 1 in the #4981 PR.

@enebo enebo added this to the JRuby 9.1.16.0 milestone Jan 29, 2018
@enebo enebo merged commit 26005d0 into jruby:jruby-9.1 Jan 29, 2018
@enebo
Copy link
Member

enebo commented Jan 29, 2018

@olleolleolle @headius I think we will also need to update our MRI stdlib with this commit. I guess though there will be a collection of PRs on this by the time it is done.

@olleolleolle olleolleolle deleted the carry-do-not-leak-dns-request-ids-to-jruby-9-1 branch January 29, 2018 21:27
@olleolleolle
Copy link
Member Author

Noting the progress: the above update was done in f8ac719

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants