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

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

Closed
hooopo opened this issue Mar 16, 2013 · 12 comments

Comments

@hooopo
Copy link

hooopo commented Mar 16, 2013

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

@ioquatix
Copy link
Member

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

@hooopo
Copy link
Author

hooopo commented Mar 16, 2013

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
.

@hooopo
Copy link
Author

hooopo commented Mar 16, 2013

Have tried EM 1.0.3. However, this issue presence.

@ioquatix
Copy link
Member

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

@hooopo
Copy link
Author

hooopo commented Mar 16, 2013

yes.

dig test111.mydomain.org

@ioquatix
Copy link
Member

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.

@ioquatix
Copy link
Member

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.

@hooopo
Copy link
Author

hooopo commented Mar 16, 2013

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

@hooopo
Copy link
Author

hooopo commented Mar 16, 2013

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

Is your dns match ruler the same as regexp?

@hooopo
Copy link
Author

hooopo commented Mar 16, 2013

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

@ioquatix
Copy link
Member

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.

@ioquatix
Copy link
Member

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

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

No branches or pull requests

2 participants