Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 6 and Hummingbird Postgres #20

Closed
thoven87 opened this issue Jul 30, 2024 · 5 comments
Closed

Swift 6 and Hummingbird Postgres #20

thoven87 opened this issue Jul 30, 2024 · 5 comments

Comments

@thoven87
Copy link
Contributor

I know Swift 6 isn't stable yet.

I noticed the following behavior with the latest version of Hummingbird Postgres

The following will produce warning and causes what looks like a memory leak:

WARNING message
Sending 'self'-isolated value of type '[PostgresMigrationGroup]' with later accesses to actor-isolated context risks causing data races; this is an error in the Swift 6 language mode

    app.beforeServerStarts {
        try await postgresMigrations.apply(client: postgresClient, logger: logger, dryRun: false)
    }

Memory will grow until the server is restarted.

Disabling the Postgres migration, the application stays steady at 6mb until traffic starts following.

Swift version
swift-driver version: 1.112.3 Apple Swift version 6.0 (swiftlang-6.0.0.6.8 clang-1600.0.23.1) Target: arm64-apple-macosx15.0

@thoven87 thoven87 changed the title Swift 6 and Hummingbird postgres Swift 6 and Hummingbird Postgres Jul 30, 2024
@adam-fowler
Copy link
Member

The warning message isn't about memory leaks. It's about accessing memory from multiple tasks. In theory it shouldn't be an issue and I understood the compiler diagnostic should get resolved before Swift 6 was released but I may have to re-visit this.

There was a possible memory leak reported in PostgresNIO just the other day. https://discord.com/channels/431917998102675485/448584561845338139/1267793957153407068

@thoven87
Copy link
Contributor Author

thoven87 commented Aug 3, 2024

It's indeed a PostgresNIO memory leak issue. I pinned PostgresNIO to version 1.21.6 and the service memory stayed constant. Thanks @adam-fowler it looks an issue was created for the memory leak issue in Postgres here already.

@thoven87
Copy link
Contributor Author

thoven87 commented Aug 3, 2024

The warning message isn't about memory leaks. It's about accessing memory from multiple tasks. In theory it shouldn't be an issue and I understood the compiler diagnostic should get resolved before Swift 6 was released but I may have to re-visit this.

There was a possible memory leak reported in PostgresNIO just the other day. https://discord.com/channels/431917998102675485/448584561845338139/1267793957153407068

Should I leave this issue open for the warning in swift 6?

@adam-fowler adam-fowler transferred this issue from hummingbird-project/hummingbird Aug 3, 2024
@adam-fowler
Copy link
Member

adam-fowler commented Aug 3, 2024

No we'll keep it open. I've also transferred it to hummingbird-postgres repo

@thoven87
Copy link
Contributor Author

Is this still needed since PR was just merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants