Perfect-MySQL icon indicating copy to clipboard operation
Perfect-MySQL copied to clipboard

Crash when try launch high load test

Open sglushchenko opened this issue 6 years ago • 0 comments

Hello,

I have a crash when I try to make a test for high load. I call ab -c 50 -n 10000 -f TLS1.2 -H "Accept-Encoding: gzip,deflate" http://127.0.0.1:8181/activities in a command line and I have the crash in PerfectMySQL->MySQLStmt.swift->line 218 let r = mysql_stmt_execute(ptr) Crash is Thread 2: signal SIGABRT

I use Mac OS Majove, Swift 4.2 PerfectMySQL 3.3.0

Maybe I wrong setup connect to a database?

part of my code:

//Connection to database
mySQL = MySQL()
let isConnected = mySQL.connect(host: testHost, user: testUser, password: testPassword, db: nil, port: testPort, socket: nil, flag: 0)
db = Database(configuration: MySQLDatabaseConfiguration(connection: mySQL))

//Code from handler
let result = try db.table(Activity.self).order(by: \Activity.updatedAt).limit(count, skip: from).select()
let activities: [[String: Any]] = result.map{
     $0.toJson()
}
let responseString = JSON(activities).rawString() ?? "[]"
response.appendBody(string: responseString).completed(status: .ok)

So the code is very simple. just select items from the database.

sglushchenko avatar Dec 02 '18 22:12 sglushchenko