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

Remove code to shutdown EventLoopGroup in FluentQueuesDriver #11

Merged
merged 1 commit into from
Aug 26, 2020

Conversation

thuotdwz
Copy link
Contributor

This will fix error message:

ERROR: Cannot schedule tasks on an EventLoop that has already shut down. This will be upgraded to a forced crash in future SwiftNIO versions.

when using Ctrl+C to shut down application. EventLoopGroup here is not owned by FluentQueuesDriver and used by other objects during shutdown procedure

Fixes #6

This will fix error message:

ERROR: Cannot schedule tasks on an EventLoop that has already shut down. This will be upgraded to a forced crash in future SwiftNIO versions.

when using Ctrl+C to shut down application. EventLoopGroup here is not owned by FluentQueuesDriver and used by other objects during shutdown procedure

Fixes m-barthelemy#6
@thuotdwz
Copy link
Contributor Author

Can we please add this fix to a release?

@m-barthelemy
Copy link
Owner

I added this exactly because I was getting issues during shutdown (using Ctrl+C) - the app was hanging.
I'm unable to reproduce the ERROR: Cannot schedule tasks on an EventLoop that has already shut down message.

@thuotdwz
Copy link
Contributor Author

I create new vapor template using vapor-beta new command, then add your package dependency. Just below the line

app.databases.use(.sqlite(.file("db.sqlite")), as: .sqlite)

I add two lines

app.queues.use(.fluent(.sqlite))
app.migrations.add(JobModelMigrate())

If I run this template app on Mac OS and do ctrl+c I instantly see error messages

[ NOTICE ] Server starting on http://127.0.0.1:8080
^C
ERROR: Cannot schedule tasks on an EventLoop that has already shut down. This will be upgraded to a forced crash in future SwiftNIO versions.
ERROR: Cannot schedule tasks on an EventLoop that has already shut down. This will be upgraded to a forced crash in future SwiftNIO versions.
ERROR: Cannot schedule tasks on an EventLoop that has already shut down. This will be upgraded to a forced crash in future SwiftNIO versions.
ERROR: Cannot schedule tasks on an EventLoop that has already shut down. This will be upgraded to a forced crash in future SwiftNIO versions.
Fatal error: leaking promise created at (file: "/Users/thuotdwz/app/.build/checkouts/swift-nio/Sources/NIO/SelectableEventLoop.swift", line: 214): file /Users/thuotdwz/app/.build/checkouts/swift-nio/Sources/NIO/SelectableEventLoop.swift, line 214

If you try the same steps do you also see this error?

@thuotdwz
Copy link
Contributor Author

Hi, have you had a chance to check on this bug fix?

@m-barthelemy
Copy link
Owner

Not yet unfortunately.
If you still have your sample project created from the vapor-beta new command and can push it to Github, I will clone it and use it to try reproducing the error (and hopefully fix it if it's related to this package).

@thuotdwz
Copy link
Contributor Author

thuotdwz commented Jun 6, 2020

sure, I uploaded a sample app here https://github.com/thuotdwz/app

All you need to see the bug is run "swift run" and then type Ctrl+c once started

@jnordberg jnordberg mentioned this pull request Aug 24, 2020
Copy link
Owner

@m-barthelemy m-barthelemy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to help, finally merging this.

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

Successfully merging this pull request may close these issues.

Bug inside ordering of objects in configure()
2 participants