PerfectlySoft / PerfectlySoft/Perfect-MySQL
Crash when try launch high load test
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 126
- Forks
- 58
- Avg merge
- 25m
- Merged PRs (30d)
- 1
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported ab -c 50 -n 10000 request against the /activities handler, then inspect PerfectMySQL's MySQLStmt.swift at line 218 alongside the connection setup. Done means the high-load request no longer aborts at mysql_stmt_execute, with the cause and verification documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, swift
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100