socketry/rubydns

Assertion failed: (OutboundPages.size() > 0), function Write, file ed.cpp, line 1653.

Closed this issue · 12 comments

I have some issues when using RubyDNS, it faild some times, here is the log:

D, [2013-03-14T01:11:53.690315 #62668] DEBUG -- : Checking rule [/^test([0-9]+).mydomain.org$/, Resolv::DNS::Resource::IN::A]...
D, [2013-03-14T01:11:53.690406 #62668] DEBUG -- : No pattern matched.
I, [2013-03-14T01:11:53.690450 #62668]  INFO -- : Passing DNS request upstream...
D, [2013-03-14T01:11:57.063527 #62668] DEBUG -- : Receiving incoming query (28 bytes)...
D, [2013-03-14T01:11:57.063710 #62668] DEBUG -- : Processing question google.com Resolv::DNS::Resource::IN::A...
D, [2013-03-14T01:11:57.063764 #62668] DEBUG -- : Searching for google.com Resolv::DNS::Resource::IN::A
D, [2013-03-14T01:11:57.063800 #62668] DEBUG -- : Checking rule [/dev.mydomain.org/, Resolv::DNS::Resource::IN::ANY]...
D, [2013-03-14T01:11:57.063834 #62668] DEBUG -- : Resource class Resolv::DNS::Resource::IN::A failed to match Resolv::DNS::Resource::IN::ANY!
D, [2013-03-14T01:11:57.063865 #62668] DEBUG -- : Checking rule ["dev.mydomain.org", Resolv::DNS::Resource::IN::A]...
D, [2013-03-14T01:11:57.063892 #62668] DEBUG -- : No pattern matched.
D, [2013-03-14T01:11:57.063920 #62668] DEBUG -- : Checking rule ["80.0.0.10.in-addr.arpa", Resolv::DNS::Resource::IN::PTR]...
D, [2013-03-14T01:11:57.063948 #62668] DEBUG -- : Resource class Resolv::DNS::Resource::IN::A failed to match Resolv::DNS::Resource::IN::PTR!
D, [2013-03-14T01:11:57.063977 #62668] DEBUG -- : Checking rule ["dev.mydomain.org", Resolv::DNS::Resource::IN::MX]...
D, [2013-03-14T01:11:57.064023 #62668] DEBUG -- : Resource class Resolv::DNS::Resource::IN::A failed to match Resolv::DNS::Resource::IN::MX!
D, [2013-03-14T01:11:57.064051 #62668] DEBUG -- : Checking rule [/^test([0-9]+).mydomain.org$/, Resolv::DNS::Resource::IN::A]...
D, [2013-03-14T01:11:57.064080 #62668] DEBUG -- : No pattern matched.
I, [2013-03-14T01:11:57.064106 #62668]  INFO -- : Passing DNS request upstream...
Assertion failed: (OutboundPages.size() > 0), function Write, file ed.cpp, line 1653.

and here is the source code from your example file:

require 'rubygems'
require 'rubydns'
require 'rubydns/system'

# You can specify other DNS servers easily
# $R = Resolv::DNS.new(:nameserver => ["xx.xx.1.1", "xx.xx.2.2"])

R = RubyDNS::Resolver.new(RubyDNS::System::nameservers)
Name = Resolv::DNS::Name
IN = Resolv::DNS::Resource::IN

RubyDNS::run_server do
  # % dig +nocmd +noall +answer @localhost ANY dev.mydomain.org
    # dev.mydomain.org. 16000   IN  A   10.0.0.80
    # dev.mydomain.org. 16000   IN  MX  10 mail.mydomain.org.
    match(/dev.mydomain.org/, IN::ANY) do |match_data, transaction|
        transaction.append_question!

        [IN::A, IN::CNAME, IN::MX].each do |resource_class|
            logger.debug "Appending query for #{resource_class}..."
            transaction.append_query!(transaction.name, resource_class)
        end
    end

    # For this exact address record, return an IP address
    match("dev.mydomain.org", IN::A) do |transaction|
        transaction.respond!("10.0.0.80")
    end

    match("80.0.0.10.in-addr.arpa", IN::PTR) do |transaction|
        transaction.respond!(Name.create("dev.mydomain.org."))
    end

    match("dev.mydomain.org", IN::MX) do |transaction|
        transaction.respond!(10, Name.create("mail.mydomain.org."))
    end

    match(/^test([0-9]+).mydomain.org$/, IN::A) do |match_data, transaction|
        offset = match_data[1].to_i

        if offset > 0 && offset < 10
            logger.info "Responding with address #{"10.0.0." + (90 + offset).to_s}..."
            transaction.respond!("10.0.0." + (90 + offset).to_s)
        else
            logger.info "Address out of range: #{offset}!"
            false
        end
    end

    # Default DNS handler
    otherwise do |transaction|
        logger.info "Passing DNS request upstream..."
        transaction.passthrough!(R)
    end

My Env:

Darwin B612.local 12.2.1 Darwin Kernel Version 12.2.1: Thu Oct 18 12:13:47 PDT 2012; root:xnu-2050.20.9~1/RELEASE_X86_64 x86_64
EM 1.0.0
Ruby 2.0.0

Hi, seems like a bug in EventMachine (eventmachine/eventmachine#176) - can you try updating event machine to 1.0.3?

yeah. I'll try it.

2013/3/16 Samuel Williams notifications@github.com

Hi, seems like a bug in eventmachine - can you try updating event machine
to 1.0.3?


Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-14998489
.

Have tried EM 1.0.3. However, this issue presence.

I will try on my computer, can you tell me what command you use to cause failure? Are you using dig?

yes.

dig test111.mydomain.org

What version of RubyDNS are you using? 0.6.0 had some changes to the rule argument order. Previously it was |match_data, transaction| but now it is |transaction, match_data|.

Where did you get the example code from, what file, and what version of RubyDNS? I'm pretty sure I updated all the examples.

Also, dig test1.mydomain.org will return a result as per the logic in the script. dig test111 probably isn't going to work as expected.

rubydns version 0.5.4
oh! you updated example two days ago. I got the example 3 days ago..
59f66f8

pry(main)> "test111.mydomain.org" =~ /^test([0-9]+).mydomain.org$/
=> 0

Is your dns match ruler the same as regexp?

sorry, I missed this logic:

offset = match_data[1].to_i

        if offset > 0 && offset < 10
            logger.info "Responding with address #{"10.0.0." + (90 + offset).to_s}..."
            transaction.respond!("10.0.0." + (90 + offset).to_s)
        else
            logger.info "Address out of range: #{offset}!"
            false
        end

Yeah, sorry, it was updated recently which might cause some confusion, note the message in the README file which explains the changes. The changes were made because many times you don't care about match_data, and since it was the first argument you still had to write it down. Now, you can just ignore it on the argument list which is very convenient.

If you have any further problems, please open a new ticket :D Thanks for trying out RubyDNS.