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

Crash when try launch high load test #44

Open
sglushchenko opened this issue Dec 2, 2018 · 0 comments
Open

Crash when try launch high load test #44

sglushchenko opened this issue Dec 2, 2018 · 0 comments

Comments

@sglushchenko
Copy link

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.

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

1 participant