Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Cannot Reproduce
    • Affects Version/s: 0.10.1
    • Fix Version/s: 1.0.3, 1.1, 1.2
    • Component/s: Replication
    • Labels:
    • Environment:

      Linux x200 2.6.32-2 #2 SMP Wed Feb 17 01:00:03 CET 2010 x86_64 GNU/Linux

    • Skill Level:
      Regular Contributors Level (Easy to Medium)

      Description

      I have a host which is only reachable via IPv6. While I can connect to a CouchDB running on this host just fine, I cannot replicate my database to it.

      This is due to the inet6-option missing from the gen_tcp.connect() call. I will attach a patch which fixes the issue.

      To test it, you can use a host which only has an AAAA record in the DNS. CouchDB will immediately return 404 if you want to replicate to it unless you add the inet6 option.

      1. COUCHDB-665-replication-ipv6.patch
        2 kB
        Filipe Manana
      2. couchdb-ipv6.patch
        2 kB
        Michael Stapelberg
      3. patch
        0.8 kB
        Michael Stapelberg

        Activity

        Hide
        Jan Lehnardt added a comment -

        I can confirm Robert's observation.

        > curl -X PUT http://::1:5984/a

        {"ok":true}

        > curl -X PUT http://::1:5984/b

        {"ok":true}

        > curl -X PUT http://::1:5984/a/a -d '{}'

        {"ok":true,"id":"a","rev":"1-967a00dff5e02add41819138abb3284d"}

        > curl -X POST http://::1:5984/_replicate -d '

        {"source":"http://[::1]:5984/a","target":"http://[::1]:5984/b"}

        ' -Hcontent-type:application/json
        {"ok":true,"session_id":"f1c4f5c26932d416cbac4b86c533756d","source_last_seq":1,"replication_id_version":2,"history":[

        {"session_id":"f1c4f5c26932d416cbac4b86c533756d","start_time":"Tue, 21 Feb 2012 13:43:37 GMT","end_time":"Tue, 21 Feb 2012 13:43:37 GMT","start_last_seq":0,"end_last_seq":1,"recorded_seq":1,"missing_checked":1,"missing_found":1,"docs_read":1,"docs_written":1,"doc_write_failures":0}

        ]}
        > curl -X GET http://::1:5984/b/a

        {"_id":"a","_rev":"1-967a00dff5e02add41819138abb3284d"}
        Show
        Jan Lehnardt added a comment - I can confirm Robert's observation. > curl -X PUT http://::1:5984/a {"ok":true} > curl -X PUT http://::1:5984/b {"ok":true} > curl -X PUT http://::1:5984/a/a -d '{}' {"ok":true,"id":"a","rev":"1-967a00dff5e02add41819138abb3284d"} > curl -X POST http://::1:5984/_replicate -d ' {"source":"http://[::1]:5984/a","target":"http://[::1]:5984/b"} ' -Hcontent-type:application/json {"ok":true,"session_id":"f1c4f5c26932d416cbac4b86c533756d","source_last_seq":1,"replication_id_version":2,"history":[ {"session_id":"f1c4f5c26932d416cbac4b86c533756d","start_time":"Tue, 21 Feb 2012 13:43:37 GMT","end_time":"Tue, 21 Feb 2012 13:43:37 GMT","start_last_seq":0,"end_last_seq":1,"recorded_seq":1,"missing_checked":1,"missing_found":1,"docs_read":1,"docs_written":1,"doc_write_failures":0} ]} > curl -X GET http://::1:5984/b/a {"_id":"a","_rev":"1-967a00dff5e02add41819138abb3284d"}
        Hide
        Jan Lehnardt added a comment -

        I can confirm Robert's observation.

        > curl -X PUT http://::1:5984/a

        {"ok":true}

        > curl -X PUT http://::1:5984/b

        {"ok":true}

        > curl -X PUT http://::1:5984/a/a -d '{}'

        {"ok":true,"id":"a","rev":"1-967a00dff5e02add41819138abb3284d"}

        > curl -X POST http://::1:5984/_replicate -d '

        {"source":"http://[::1]:5984/a","target":"http://[::1]:5984/b"}

        ' -Hcontent-type:application/json
        {"ok":true,"session_id":"f1c4f5c26932d416cbac4b86c533756d","source_last_seq":1,"replication_id_version":2,"history":[

        {"session_id":"f1c4f5c26932d416cbac4b86c533756d","start_time":"Tue, 21 Feb 2012 13:43:37 GMT","end_time":"Tue, 21 Feb 2012 13:43:37 GMT","start_last_seq":0,"end_last_seq":1,"recorded_seq":1,"missing_checked":1,"missing_found":1,"docs_read":1,"docs_written":1,"doc_write_failures":0}

        ]}
        > curl -X GET http://::1:5984/b/a

        {"_id":"a","_rev":"1-967a00dff5e02add41819138abb3284d"}
        Show
        Jan Lehnardt added a comment - I can confirm Robert's observation. > curl -X PUT http://::1:5984/a {"ok":true} > curl -X PUT http://::1:5984/b {"ok":true} > curl -X PUT http://::1:5984/a/a -d '{}' {"ok":true,"id":"a","rev":"1-967a00dff5e02add41819138abb3284d"} > curl -X POST http://::1:5984/_replicate -d ' {"source":"http://[::1]:5984/a","target":"http://[::1]:5984/b"} ' -Hcontent-type:application/json {"ok":true,"session_id":"f1c4f5c26932d416cbac4b86c533756d","source_last_seq":1,"replication_id_version":2,"history":[ {"session_id":"f1c4f5c26932d416cbac4b86c533756d","start_time":"Tue, 21 Feb 2012 13:43:37 GMT","end_time":"Tue, 21 Feb 2012 13:43:37 GMT","start_last_seq":0,"end_last_seq":1,"recorded_seq":1,"missing_checked":1,"missing_found":1,"docs_read":1,"docs_written":1,"doc_write_failures":0} ]} > curl -X GET http://::1:5984/b/a {"_id":"a","_rev":"1-967a00dff5e02add41819138abb3284d"}
        Hide
        Robert Newson added a comment -

        I've successfully replicated a db using a remote source and target for an ipv6 couchdb. Here are my steps.

        1) added this to local_dev.ini;

        [httpd]
        bind_address = ::1

        2) Created a 'db1' and 'db2' database and added a doc to 'db1'.

        3) Performed replication;

        curl localhost:5984/_replicate -Hcontent-type:application/json -d '

        {"source":"http://[::1]:5984/db1","target":"http://[::1]:5984/db2"}

        '

        4) Replication succeeded, 'db2' has one document.

        Bastiaan, can you please respond to Filipe's request for more information? This would be a release blocking ticket if it can be confirmed (and assuming my result doesn't invalidate the ticket).

        Show
        Robert Newson added a comment - I've successfully replicated a db using a remote source and target for an ipv6 couchdb. Here are my steps. 1) added this to local_dev.ini; [httpd] bind_address = ::1 2) Created a 'db1' and 'db2' database and added a doc to 'db1'. 3) Performed replication; curl localhost:5984/_replicate -Hcontent-type:application/json -d ' {"source":"http://[::1]:5984/db1","target":"http://[::1]:5984/db2"} ' 4) Replication succeeded, 'db2' has one document. Bastiaan, can you please respond to Filipe's request for more information? This would be a release blocking ticket if it can be confirmed (and assuming my result doesn't invalidate the ticket).
        Hide
        Filipe Manana added a comment -

        Bastiaan, can you paste how you're triggering the replication (request and replication object/document) and the errors/stack traces you get (if any)?

        Show
        Filipe Manana added a comment - Bastiaan, can you paste how you're triggering the replication (request and replication object/document) and the errors/stack traces you get (if any)?
        Hide
        Randall Leeds added a comment -

        Re-opening in light of the last comment. Blocking 1.2 in my opinion.

        Show
        Randall Leeds added a comment - Re-opening in light of the last comment. Blocking 1.2 in my opinion.
        Hide
        Bastiaan Welmers added a comment -

        On 1.1.1 this bug seems to be reintroduced; replication over v6 connections is not possible

        Show
        Bastiaan Welmers added a comment - On 1.1.1 this bug seems to be reintroduced; replication over v6 connections is not possible
        Hide
        Filipe Manana added a comment -

        And backported to branch 1.0.x as well (1.0.3)

        Show
        Filipe Manana added a comment - And backported to branch 1.0.x as well (1.0.3)
        Hide
        Filipe Manana added a comment -

        Also backported to branch 1.1.x, so 1.1.0 will have this feature.

        Show
        Filipe Manana added a comment - Also backported to branch 1.1.x, so 1.1.0 will have this feature.
        Hide
        Filipe Manana added a comment -

        Ibrowse 2.2.0 released today adds support for IPv6 (https://github.com/cmullaparthi/ibrowse/pull/34).
        A small change to the replicator was also needed.

        Both patches applied to trunk.
        Thanks Michael Stapelberg for the initial patch and report.

        Show
        Filipe Manana added a comment - Ibrowse 2.2.0 released today adds support for IPv6 ( https://github.com/cmullaparthi/ibrowse/pull/34 ). A small change to the replicator was also needed. Both patches applied to trunk. Thanks Michael Stapelberg for the initial patch and report.
        Hide
        Filipe Manana added a comment -

        Thanks for the tip Michael. I wasn't aware of miredo.

        I'll give it a try when i get a free timeslot.

        In the meanwhile, if anyone is able try out the patch I attached here and report, I would be very grateful.

        Show
        Filipe Manana added a comment - Thanks for the tip Michael. I wasn't aware of miredo. I'll give it a try when i get a free timeslot. In the meanwhile, if anyone is able try out the patch I attached here and report, I would be very grateful.
        Hide
        Michael Stapelberg added a comment -

        You do have easy access to an IPv6 environment, just install miredo and you’ll automatically have a working IPv6 tunnel within seconds (provided you’re not behind some very restrictive firewall).

        An alternative would be to configure the IPv6 addresses statically between two computers (or between to instances of CouchDB running on different IPs), chosen from the unique local addresses prefix or some example prefix.

        Show
        Michael Stapelberg added a comment - You do have easy access to an IPv6 environment, just install miredo and you’ll automatically have a working IPv6 tunnel within seconds (provided you’re not behind some very restrictive firewall). An alternative would be to configure the IPv6 addresses statically between two computers (or between to instances of CouchDB running on different IPs), chosen from the unique local addresses prefix or some example prefix.
        Hide
        Filipe Manana added a comment -

        My concern with that patch is that it does manual parsing of IPv6 addresses.
        The right way is to use inet:gethostbyaddr/1 to determine if a peer's address is IPv6 or not.

        If I provide you a patch, are able to patch the source and test it? (I don't have right now easy access to an IPv6 environment)

        Show
        Filipe Manana added a comment - My concern with that patch is that it does manual parsing of IPv6 addresses. The right way is to use inet:gethostbyaddr/1 to determine if a peer's address is IPv6 or not. If I provide you a patch, are able to patch the source and test it? (I don't have right now easy access to an IPv6 environment)
        Hide
        Nathan Vander Wilt added a comment -

        Any reason this patch hasn't been landed? I'm still encountering this issue in 1.0.2 trying to replicate over Back To My Mac's VPN, which is IPv6 only.

        Show
        Nathan Vander Wilt added a comment - Any reason this patch hasn't been landed? I'm still encountering this issue in 1.0.2 trying to replicate over Back To My Mac's VPN, which is IPv6 only.
        Hide
        Michael Stapelberg added a comment -

        The new version of the patch does not always add the inet6 option (which only works on systems where /proc/sys/net/ipv6/bindv6only == 0) but checks which kind of hostname this is.

        Show
        Michael Stapelberg added a comment - The new version of the patch does not always add the inet6 option (which only works on systems where /proc/sys/net/ipv6/bindv6only == 0) but checks which kind of hostname this is.
        Hide
        Jan Lehnardt added a comment -

        Set to blocking as per dev@ request.

        Show
        Jan Lehnardt added a comment - Set to blocking as per dev@ request.
        Hide
        Michael Stapelberg added a comment -

        I forgot to mention that replication works via IPv6 and IPv4 after this patch.

        Show
        Michael Stapelberg added a comment - I forgot to mention that replication works via IPv6 and IPv4 after this patch.
        Hide
        Michael Stapelberg added a comment -

        Adds inet6 to ssl:connect() and gen_tcp:connect() to enable replication via IPv6

        Show
        Michael Stapelberg added a comment - Adds inet6 to ssl:connect() and gen_tcp:connect() to enable replication via IPv6

          People

          • Assignee:
            Filipe Manana
            Reporter:
            Michael Stapelberg
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 0.25h
              0.25h
              Remaining:
              Remaining Estimate - 0.25h
              0.25h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development