Closed thuotdwz closed 4 years ago
Can we please add this fix to a release?
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.
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?
Hi, have you had a chance to check on this bug fix?
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).
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
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