Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8702637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:42:10+00:00 2026-06-13T02:42:10+00:00

Having some trouble understanding the right approach here. I have a connection to a

  • 0

Having some trouble understanding the right approach here.

I have a connection to a mongodb replica set with three members (standard master-slave-slave). Everything is working fine with the connection when the master remains consistent.

pymongo.Connection(['host1:27017','host2:27018','host3:27019']).database_test

For some reason, when the replica set primary steps down, this starts to throw an autoreconnect exception that doesn’t go away even after a new primary is elected.

Now I am aware that this exception needs to be caught and handled, most likely by waiting for the new primary to be elected. The problem I am having seems to be that it doesn’t care at all once the new primary has been chosen. This “master has changed” exception just keeps coming up.

Printing the connection with __dict__ shows all three hosts.

I’ve tried passing the replicaset kwarg to the connection, but this comes up as an unexpected argument.

Is there a reason why this kind of connection wouldn’t just start querying against the new primary?

EDIT:

This same problem is apparently now manifesting on the deployment server. The autoreconnect exception is thrown if the master changes at all and never goes away even after a new primary is elected.

Pymongo is version 2.2 and mongodb version 2.0.2. Changing the manner in which the connection is defined in the pymongo code (mongouri vs. list of hosts) has no effect. The only way to revive the service is to rs.stepDown() the other hosts until the original master is primary once more.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:42:11+00:00Added an answer on June 13, 2026 at 2:42 am

    The behavior you describe is a bug. The best possible course of action is to make sure there is a bug logged for it and link to it from your question. Since the question is almost a year old, I am expecting the bug to be closed (check jira.mongodb.org/browse/SERVER-4405 to see if it applies).

    If you upgrade to MongoDB 2.2 or later, the problem should go away.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some trouble understanding this brute force approach. I am using Perl
I'm having some trouble understanding this. Here's what's happening. I'm spawning a new thread
I'm having some trouble understanding how ko.mapping.fromJS and ko.mapping.toJS work. Here the explanation of
I'm having some trouble understanding the rules for array broadcasting in Numpy. Obviously, if
I'm having some trouble understanding a bit of code. I've got 2 classes Company
I'm having some trouble understanding Outlook terms (CommandBarPopup, CommandBarButton etc) like what is what
I'm having some trouble understanding the delegate/data source methodology. I understand that they exist
Hey I'm having some trouble understanding how Recursive Algebraic Types work and how to
I am having some trouble understanding designated initializers. I am studying Objective C from
I've been reading through Programming Clojure, and I've been having some trouble understanding Stuarts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.