Skip to content

Running the app test fails with error Assertion failed: MongoClient was not closed before deinitialization. Please call close() or syncClose() when the client is no longer needed #9

Open
@thomasburguiere

Description

@thomasburguiere

Versions/Environment

  1. What version of Swift are you using? (Run swift --version)
    swift-driver version: 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100) Target: arm64-apple-macosx13.0
  2. What operating system are you using? (Run uname -a)
    Darwin thomass-macbook-pro.home 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64
  3. What versions of the driver and its dependencies are you using? (Run swift package show-dependencies)
.
├── vapor<https://github.com/vapor/[email protected]>
│   ├── async-http-client<https://github.com/swift-server/[email protected]>
│   │   ├── swift-nio<https://github.com/apple/[email protected]>
│   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│   │   │   └── swift-collections<https://github.com/apple/[email protected]>
│   │   ├── swift-nio-ssl<https://github.com/apple/[email protected]>
│   │   │   └── swift-nio<https://github.com/apple/[email protected]>
│   │   │       ├── swift-atomics<https://github.com/apple/[email protected]>
│   │   │       └── swift-collections<https://github.com/apple/[email protected]>
│   │   ├── swift-nio-http2<https://github.com/apple/[email protected]>
│   │   │   ├── swift-nio<https://github.com/apple/[email protected]>
│   │   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│   │   │   │   └── swift-collections<https://github.com/apple/[email protected]>
│   │   │   └── swift-atomics<https://github.com/apple/[email protected]>
│   │   ├── swift-nio-extras<https://github.com/apple/[email protected]>
│   │   │   └── swift-nio<https://github.com/apple/[email protected]>
│   │   │       ├── swift-atomics<https://github.com/apple/[email protected]>
│   │   │       └── swift-collections<https://github.com/apple/[email protected]>
│   │   ├── swift-nio-transport-services<https://github.com/apple/[email protected]>
│   │   │   ├── swift-nio<https://github.com/apple/[email protected]>
│   │   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│   │   │   │   └── swift-collections<https://github.com/apple/[email protected]>
│   │   │   └── swift-atomics<https://github.com/apple/[email protected]>
│   │   ├── swift-log<https://github.com/apple/[email protected]>
│   │   └── swift-atomics<https://github.com/apple/[email protected]>
│   ├── async-kit<https://github.com/vapor/[email protected]>
│   │   ├── swift-nio<https://github.com/apple/[email protected]>
│   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│   │   │   └── swift-collections<https://github.com/apple/[email protected]>
│   │   └── swift-log<https://github.com/apple/[email protected]>
│   ├── console-kit<https://github.com/vapor/[email protected]>
│   │   └── swift-log<https://github.com/apple/[email protected]>
│   ├── swift-crypto<https://github.com/apple/[email protected]>
│   ├── routing-kit<https://github.com/vapor/[email protected]>
│   │   └── swift-log<https://github.com/apple/[email protected]>
│   ├── swift-backtrace<https://github.com/swift-server/[email protected]>
│   ├── swift-nio<https://github.com/apple/[email protected]>
│   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│   │   └── swift-collections<https://github.com/apple/[email protected]>
│   ├── swift-nio-ssl<https://github.com/apple/[email protected]>
│   │   └── swift-nio<https://github.com/apple/[email protected]>
│   │       ├── swift-atomics<https://github.com/apple/[email protected]>
│   │       └── swift-collections<https://github.com/apple/[email protected]>
│   ├── swift-nio-http2<https://github.com/apple/[email protected]>
│   │   ├── swift-nio<https://github.com/apple/[email protected]>
│   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│   │   │   └── swift-collections<https://github.com/apple/[email protected]>
│   │   └── swift-atomics<https://github.com/apple/[email protected]>
│   ├── swift-nio-extras<https://github.com/apple/[email protected]>
│   │   └── swift-nio<https://github.com/apple/[email protected]>
│   │       ├── swift-atomics<https://github.com/apple/[email protected]>
│   │       └── swift-collections<https://github.com/apple/[email protected]>
│   ├── swift-log<https://github.com/apple/[email protected]>
│   ├── swift-metrics<https://github.com/apple/[email protected]>
│   ├── swift-algorithms<https://github.com/apple/[email protected]>
│   │   └── swift-numerics<https://github.com/apple/[email protected]>
│   ├── websocket-kit<https://github.com/vapor/[email protected]>
│   │   ├── swift-nio<https://github.com/apple/[email protected]>
│   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│   │   │   └── swift-collections<https://github.com/apple/[email protected]>
│   │   ├── swift-nio-ssl<https://github.com/apple/[email protected]>
│   │   │   └── swift-nio<https://github.com/apple/[email protected]>
│   │   │       ├── swift-atomics<https://github.com/apple/[email protected]>
│   │   │       └── swift-collections<https://github.com/apple/[email protected]>
│   │   ├── swift-nio-transport-services<https://github.com/apple/[email protected]>
│   │   │   ├── swift-nio<https://github.com/apple/[email protected]>
│   │   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│   │   │   │   └── swift-collections<https://github.com/apple/[email protected]>
│   │   │   └── swift-atomics<https://github.com/apple/[email protected]>
│   │   └── swift-atomics<https://github.com/apple/[email protected]>
│   └── multipart-kit<https://github.com/vapor/[email protected]>
│       ├── swift-nio<https://github.com/apple/[email protected]>
│       │   ├── swift-atomics<https://github.com/apple/[email protected]>
│       │   └── swift-collections<https://github.com/apple/[email protected]>
│       └── swift-collections<https://github.com/apple/[email protected]>
└── mongodb-vapor<https://github.com/mongodb/[email protected]>
    ├── mongo-swift-driver<https://github.com/mongodb/[email protected]>
    │   ├── nimble<https://github.com/Quick/[email protected]>
    │   ├── swift-nio<https://github.com/apple/[email protected]>
    │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
    │   │   └── swift-collections<https://github.com/apple/[email protected]>
    │   ├── swift-bson<https://github.com/mongodb/[email protected]>
    │   │   ├── swift-nio<https://github.com/apple/[email protected]>
    │   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
    │   │   │   └── swift-collections<https://github.com/apple/[email protected]>
    │   │   ├── swift-extras-json<https://github.com/swift-extras/[email protected]>
    │   │   ├── swift-extras-base64<https://github.com/swift-extras/[email protected]>
    │   │   └── nimble<https://github.com/Quick/[email protected]>
    │   └── swift-atomics<https://github.com/apple/[email protected]>
    └── vapor<https://github.com/vapor/[email protected]>
        ├── async-http-client<https://github.com/swift-server/[email protected]>
        │   ├── swift-nio<https://github.com/apple/[email protected]>
        │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
        │   │   └── swift-collections<https://github.com/apple/[email protected]>
        │   ├── swift-nio-ssl<https://github.com/apple/[email protected]>
        │   │   └── swift-nio<https://github.com/apple/[email protected]>
        │   │       ├── swift-atomics<https://github.com/apple/[email protected]>
        │   │       └── swift-collections<https://github.com/apple/[email protected]>
        │   ├── swift-nio-http2<https://github.com/apple/[email protected]>
        │   │   ├── swift-nio<https://github.com/apple/[email protected]>
        │   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
        │   │   │   └── swift-collections<https://github.com/apple/[email protected]>
        │   │   └── swift-atomics<https://github.com/apple/[email protected]>
        │   ├── swift-nio-extras<https://github.com/apple/[email protected]>
        │   │   └── swift-nio<https://github.com/apple/[email protected]>
        │   │       ├── swift-atomics<https://github.com/apple/[email protected]>
        │   │       └── swift-collections<https://github.com/apple/[email protected]>
        │   ├── swift-nio-transport-services<https://github.com/apple/[email protected]>
        │   │   ├── swift-nio<https://github.com/apple/[email protected]>
        │   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
        │   │   │   └── swift-collections<https://github.com/apple/[email protected]>
        │   │   └── swift-atomics<https://github.com/apple/[email protected]>
        │   ├── swift-log<https://github.com/apple/[email protected]>
        │   └── swift-atomics<https://github.com/apple/[email protected]>
        ├── async-kit<https://github.com/vapor/[email protected]>
        │   ├── swift-nio<https://github.com/apple/[email protected]>
        │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
        │   │   └── swift-collections<https://github.com/apple/[email protected]>
        │   └── swift-log<https://github.com/apple/[email protected]>
        ├── console-kit<https://github.com/vapor/[email protected]>
        │   └── swift-log<https://github.com/apple/[email protected]>
        ├── swift-crypto<https://github.com/apple/[email protected]>
        ├── routing-kit<https://github.com/vapor/[email protected]>
        │   └── swift-log<https://github.com/apple/[email protected]>
        ├── swift-backtrace<https://github.com/swift-server/[email protected]>
        ├── swift-nio<https://github.com/apple/[email protected]>
        │   ├── swift-atomics<https://github.com/apple/[email protected]>
        │   └── swift-collections<https://github.com/apple/[email protected]>
        ├── swift-nio-ssl<https://github.com/apple/[email protected]>
        │   └── swift-nio<https://github.com/apple/[email protected]>
        │       ├── swift-atomics<https://github.com/apple/[email protected]>
        │       └── swift-collections<https://github.com/apple/[email protected]>
        ├── swift-nio-http2<https://github.com/apple/[email protected]>
        │   ├── swift-nio<https://github.com/apple/[email protected]>
        │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
        │   │   └── swift-collections<https://github.com/apple/[email protected]>
        │   └── swift-atomics<https://github.com/apple/[email protected]>
        ├── swift-nio-extras<https://github.com/apple/[email protected]>
        │   └── swift-nio<https://github.com/apple/[email protected]>
        │       ├── swift-atomics<https://github.com/apple/[email protected]>
        │       └── swift-collections<https://github.com/apple/[email protected]>
        ├── swift-log<https://github.com/apple/[email protected]>
        ├── swift-metrics<https://github.com/apple/[email protected]>
        ├── swift-algorithms<https://github.com/apple/[email protected]>
        │   └── swift-numerics<https://github.com/apple/[email protected]>
        ├── websocket-kit<https://github.com/vapor/[email protected]>
        │   ├── swift-nio<https://github.com/apple/[email protected]>
        │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
        │   │   └── swift-collections<https://github.com/apple/[email protected]>
        │   ├── swift-nio-ssl<https://github.com/apple/[email protected]>
        │   │   └── swift-nio<https://github.com/apple/[email protected]>
        │   │       ├── swift-atomics<https://github.com/apple/[email protected]>
        │   │       └── swift-collections<https://github.com/apple/[email protected]>
        │   ├── swift-nio-transport-services<https://github.com/apple/[email protected]>
        │   │   ├── swift-nio<https://github.com/apple/[email protected]>
        │   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
        │   │   │   └── swift-collections<https://github.com/apple/[email protected]>
        │   │   └── swift-atomics<https://github.com/apple/[email protected]>
        │   └── swift-atomics<https://github.com/apple/[email protected]>
        └── multipart-kit<https://github.com/vapor/[email protected]>
            ├── swift-nio<https://github.com/apple/[email protected]>
            │   ├── swift-atomics<https://github.com/apple/[email protected]>
            │   └── swift-collections<https://github.com/apple/[email protected]>
            └── swift-collections<https://github.com/apple/[email protected]>

  1. What version of MongoDB are you using? (Check with the MongoDB shell using db.version())
    6.0.2
  2. What is your MongoDB topology (standalone, replica set, sharded cluster, serverless)?
    standalone

Describe the bug

running the App test provided in the template by calling swift test ends up with the following error;

Building for debugging...
Build complete! (0.89s)
Test Suite 'All tests' started at 2023-04-09 09:24:37.824
Test Suite 'VaporExamplePackageTests.xctest' started at 2023-04-09 09:24:37.825
Test Suite 'AppTests' started at 2023-04-09 09:24:37.825
Test Case '-[AppTests.AppTests testFetchKittens]' started.
MongoSwift/MongoClient.swift:398: Assertion failed: MongoClient was not closed before deinitialization. Please call `close()` or `syncClose()` when the client is no longer needed.
error: Exited with signal code 5

BE SPECIFIC:

  • What is the expected behavior and what is actually happening?
  • Do you have any particular output that demonstrates this problem?
  • Do you have any ideas on why this may be happening that could give us a
    clue in the right direction?
  • Did this issue arise out of nowhere, or after an update (of the driver,
    server, and/or Swift)?
  • Are there multiple ways of triggering this bug (perhaps more than one
    function produce a crash)?
  • If you know how to reproduce this bug, please include a code snippet here:

To Reproduce
Steps to reproduce the behavior:

  1. checkout the code at [email protected]
  2. remove all leaf code and imports (couldnt get that to compile)
  3. run swift test

Metadata

Metadata

Labels

bugSomething isn't workingtriage

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions