Skip to content

"MongoError: server selection failed" after upgrading from 5.9.19 to 5.9.20  #9167

@amit777

Description

@amit777

Do you want to request a feature or report a bug?
bug

What is the current behavior?
My app crashed with this stack trace:

    at Mongos.selectServer (/opt/app/backend/node_modules/mongodb/lib/core/topologies/mongos.js:1176:14)
    at Mongos.selectServer (/opt/app/backend/node_modules/mongodb/lib/topologies/topology_base.js:342:32)
    at executeWithServerSelection (/opt/app/backend/node_modules/mongodb/lib/operations/execute_operation.js:137:12)
    at executeOperation (/opt/app/backend/node_modules/mongodb/lib/operations/execute_operation.js:75:7)
    at Cursor._initializeCursor (/opt/app/backend/node_modules/mongodb/lib/core/cursor.js:540:7)
    at Cursor._initializeCursor (/opt/app/backend/node_modules/mongodb/lib/cursor.js:185:11)
    at nextFunction (/opt/app/backend/node_modules/mongodb/lib/core/cursor.js:743:10)
    at Cursor._next (/opt/app/backend/node_modules/mongodb/lib/core/cursor.js:201:5)
    at Cursor._read (/opt/app/backend/node_modules/mongodb/lib/core/cursor.js:340:10)
    at Cursor.Readable.read (_stream_readable.js:468:10)    at resume_ (_stream_readable.js:982:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

If the current behavior is a bug, please provide the steps to reproduce.

I'm still investigating why this would happen since other apps we created are working fine after the upgrade.

What is the expected behavior?
There should be no error connecting.

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.

5.9.20

Other environment notes:

  • MongoDB 4.2.7 sharded cluster
  • Node v12.18.1
  • My app is connecting to mongos connected on localhost:27018
  • Downgrading mongoose seems to fix the problem reliably.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions