Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-3589

Mongoid with connection_pooling is not reconnecting to MongoDB in case of connection broken

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 12_01_17
    • Component/s: None
    • Labels:

      Description

      I use latest mongoid and moped code from repo.

      • Start application under puma 3 workers each with 8 threads and use

        : 25

        for mongoid. Check that all works.

      • Stop service

        , wait and start it again.
        - Established early connections doesn't reconnect and writes tons errors - 

        Moped::Errors::ConnectionFailure

        . 
        - So I must restart application.
         
        I would have expected mongoid to attempt to reconnect automatically in this case without requiring a restart of the apps.
         
        My production.log:
        


        WARN - MOPED: Retrying connection attempt 60 more time(s). runtime: n/a
        ...
        WARN - MOPED: Retrying connection attempt 1 more time(s). runtime: n/a

      FATAL - Moped::Errors::ConnectionFailure: Could not connect to a primary node for replica set #<Moped::Cluster:70042068689560 @seeds=[<Moped::Node resolved_address="000.000.000.000:27017">]>

       
      My mongoid.yml: 
      

      production:
      sessions:
      default:
      database: newauto_data
      hosts:

      • 000.000.000.000:27017
        username: xxx
        password: yyy
        options:
        pool_size: 25
        max_retries: 60
        retry_interval: 1
        refresh_interval: 30
        `

      I found issue 3 years old https://github.com/mongoid/mongoid/issues/794, but my case is new one.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            nodkz Pavel Chertorogov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: