desiguel opened a new issue #3290:
URL: https://github.com/apache/couchdb/issues/3290


   ## Description
   
   If you setup two databases on localhost on different ports then replication 
fails with the following error:
   
   ```
   
{"database":"_replicator","doc_id":"cb949cbbf5b38344a6917f099a001a75","id":"1bada9bcf6da8bb8578b6e07887f6829+continuous","node":"nonode@nohost","source":"http://admin:*****@localhost:5984/events/","target":"http://admin:*****@127.0.0.1:5985/events/","state":"crashing","info":{"error":"{replication_auth_error,\n
    {session_request_failed,\"http://127.0.0.1:5985/_session\",\"admin\",\n     
   
{conn_failed,{error,econnrefused}}}}"},"error_count":1,"last_updated":"2020-12-08T00:12:36Z","start_time":"2020-12-08T00:12:34Z","source_proxy":null,"target_proxy":null}
   ```
   ## Steps to Reproduce
   
   1. Setup two running CouchDB instances on localhost using docker compose:
   
   ```
   version: "3.8"
   
   networks:
     dev-couch:
       driver: bridge
       ipam:
         config:
           - subnet: 192.168.56.0/27
   
   services:
   
     # CouchDB A
     couchdb-a:
       image: apache/couchdb:latest
       restart: always
       environment:
         COUCHDB_USER: admin
         COUCHDB_PASSWORD: password
       ports:
         - 5984:5984
       networks:
         - dev-couch
     
     # CouchDB B
     couchdb-b:
       image: apache/couchdb:latest
       restart: always
       environment:
         COUCHDB_USER: admin
         COUCHDB_PASSWORD: password
       ports:
         - 5985:5984
       networks:
         - dev-couch
   ```
   
   2. Setup databases using curl:
   ```
   curl -u admin:password -X PUT http://localhost:5984/_users
   curl -u admin:password -X PUT http://localhost:5984/_replicator
   curl -u admin:password -X PUT http://localhost:5984/events
   
   curl -u admin:password -X PUT http://localhost:5985/_users
   curl -u admin:password -X PUT http://localhost:5985/events
   ```
   
   2. Setup replication using curl:
   ```
   curl -X POST -u admin:password localhost:5984/_replicator  -d 
'{"target":"http://admin:password@localhost:5984/events";, "source": 
"http://admin:password@localhost:5985/events";, "continuous": true}' -H 
"content-Type: application/json"
   ```
   
   ## Expected Behaviour
   
   Replication works.
   
   ## Your Environment
   
   * CouchDB version used: Latest
   * Browser name and version:N/A
   * Operating system and version: Kubuntu 18.04
   
   ## Additional Context
   
   It looks like Couch isn't respecting port when determining whether hosts are 
different. My guess is that at least one login in the replication works, a 
session is created, then when Couch sees the second host it treats it as the 
same and tries to use the same session to access the second instance.
    
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to