Skip to content

Instantly share code, notes, and snippets.

View MickaelCruzDB's full-sized avatar

Mickaël Cruz MickaelCruzDB

View GitHub Profile
[1060/1060] Linking Run
Fatal error: Application.shutdown() was not called before Application deinitialized.: file /home/homehub/Documents/HomeHub/.build/checkouts/vapor/Sources/Vapor/Application.swift, line 139
Current stack trace:
0 libswiftCore.so 0x00007ff75b8acec0 swift_reportError + 50
1 libswiftCore.so 0x00007ff75b91df60 _swift_stdlib_reportFatalErrorInFile + 115
2 libswiftCore.so 0x00007ff75b841f0e <unavailable> + 3514126
3 libswiftCore.so 0x00007ff75b842087 <unavailable> + 3514503
4 libswiftCore.so 0x00007ff75b63782d <unavailable> + 1374253
5 libswiftCore.so 0x00007ff75b818e68 <unavailable> + 3346024
6 libswiftCore.so 0x00007ff75b636d96 <unavailable> + 1371542
import Fluent
import FluentSQLiteDriver
import Vapor
import APNS
struct GlobalVariables {
static var phoneTokens = [String]()
}
// Called before your application initializes.
homehub@homehub:~/Documents/test$ swift build -c release
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "csqlite.h"
^
/home/homehub/Documents/test/.build/checkouts/sqlite-nio/Sources/CSQLite/csqlite.h:4:10: error: 'sqlite3.h' file not found
#include <sqlite3.h>
^
/home/homehub/Documents/test/.build/checkouts/sqlite-nio/Sources/SQLiteNIO/SQLiteConnection.swift:2:8: error: could not build C module 'CSQLite'
import CSQLite
^
homehub@homehub:~$ swift --version
Command 'swift' not found, but can be installed with:
sudo snap install openstackclients # version train, or
sudo snap install swift # version 4.0.3
sudo apt install python-swiftclient
sudo apt install python3-swiftclient
See 'snap info <snapname>' for additional versions.
[ NOTICE ] Server starting on http://127.0.0.1:8080
[ INFO ] POST /personFound
Precondition failed: BUG DETECTED: wait() must not be called when on an EventLoop.
Calling wait() on any EventLoop can lead to
- deadlocks
- stalling processing of other connections (Channels) that are handled on the EventLoop that wait was called on
Further information:
- current eventLoop: Optional(SelectableEventLoop { selector = Selector { descriptor = 7 }, scheduledTasks = PriorityQueue(count: 0): [ScheduledTask(readyTime: 54512519868654)] })
- event loop associated to future: SelectableEventLoop { selector = Selector { descriptor = 18 }, scheduledTasks = PriorityQueue(count: 0): [ScheduledTask(readyTime: 54521621925322)] }: file /Users/mika/Desktop/APNS/Sources/App/Controllers/PersonFoundController.swift, line 27
app.post("personFound") { req -> String in
let message = try req.content.decode(PersonFound.self)
let personFound = PersonFoundController()
personFound.sendNotification(foundPerson: message.found, eventLoop: req.eventLoop)
return "ok"
}
app.post("personFound") { req -> String in
let message = try req.content.decode(PersonFound.self)
let personFound = PersonFoundController()
personFound.sendNotification(foundPerson: message.found)
return "ok"
}
[ NOTICE ] Server starting on http://127.0.0.1:8080
[ INFO ] POST /personFound
Precondition failed: BUG DETECTED: wait() must not be called when on an EventLoop.
Calling wait() on any EventLoop can lead to
- deadlocks
- stalling processing of other connections (Channels) that are handled on the EventLoop that wait was called on
Further information:
- current eventLoop: Optional(SelectableEventLoop { selector = Selector { descriptor = 7 }, scheduledTasks = PriorityQueue(count: 0): [ScheduledTask(readyTime: 51080543268837)] })
- event loop associated to future: SelectableEventLoop { selector = Selector { descriptor = 18 }, scheduledTasks = PriorityQueue(count: 0): [ScheduledTask(readyTime: 51089935241727)] }: file /Users/mika/Desktop/APNS/Sources/App/Controllers/PersonFoundController.swift, line 27
import Foundation
import Vapor
import APNSwift
struct PersonFoundController {
func sendNotification(foundPerson: String) {
let group = MultiThreadedEventLoopGroup(numberOfThreads: 1)
let verbose = true
struct PersonFound: Content {
var found: String
}
app.post("personFound") { req -> EventLoopFuture<HTTPStatus> in
let message = try req.content.decode(PersonFound.self)
let personFound = PersonFoundController()
personFound.sendNotification(foundPerson: message.found)