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

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

    • Type: Icon: Task Task
    • Resolution: Done
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None

      I use latest mongoid and moped code from repo.

      • Start application under puma 3 workers each with 8 threads and use
        Unable to find source-code formatter for language: pool_size. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
        : 25

        for mongoid. Check that all works.

      • Stop service
        Unable to find source-code formatter for language: mongodb```. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
        , 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.

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

              Created:
              Updated:
              Resolved: