forked from simendsjo/mysqln
-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Description
When using a MySQLPool locked connection concurrently using Vibed HTTP server (using the following code), I randomly end up with an assertion in mysql-native/source/mysql/protocol/sockets.d
:
Code:
import vibe.vibe;
import mysql;
MySQLPool connPool;
void main()
{
connPool = new MySQLPool("host=localhost;port=3306;user=yourname;pwd=pass123;db=mysqln_testdb");
auto settings = new HTTPServerSettings;
settings.port = 8080;
settings.bindAddresses = ["::1", "127.0.0.1"];
auto router = new URLRouter;
router.registerWebInterface(new WebInterface);
listenHTTP(settings, router);
logInfo("Please open http://127.0.0.1:8080/ in your browser.");
runApplication();
}
class WebInterface {
void index(HTTPServerResponse res)
{
auto conn = connPool.lockConnection();
auto queryRes = conn.query("SELECT SLEEP(1)");
queryRes.close();
res.writeJsonBody("Success !");
}
}
Full repo ready to compile: test-connpool.tar.gz
Result:
When stressed using simply curl 127.0.0.1:8080 &; curl 127.0.0.1:8080 &
few times, it produces the following assertion:
core.exception.AssertError@../../.dub/packages/mysql-native-2.2.0/mysql-native/source/mysql/protocol/sockets.d(121): Assertion failure
----------------
??:? _d_assertp [0xd482e4bd]
??:? const void mysql.protocol.sockets.MySQLSocketVibeD.__invariant7() [0xd4601fc9]
??:? const void mysql.protocol.sockets.MySQLSocketVibeD.__invariant() [0xd4602180]
??:? const @property bool mysql.protocol.sockets.MySQLSocketVibeD.connected() [0xd4602010]
??:? void mysql.connection.Connection.kill() [0xd45f8f16]
??:? bool mysql.protocol.comms.execQueryImpl(mysql.connection.Connection, mysql.protocol.comms.ExecQueryImplInfo, out ulong) [0xd45fcd75]
??:? mysql.result.ResultRange mysql.commands.queryImpl(mysql.commands.ColumnSpecialization[], mysql.connection.Connection, mysql.protocol.comms.ExecQueryImplInfo) [0xd45f81da]
??:? mysql.result.ResultRange mysql.commands.query(mysql.connection.Connection, const(char[]), mysql.commands.ColumnSpecialization[]) [0xd45f815d]
??:? void app.WebInterface.index(vibe.http.server.HTTPServerResponse) [0xd45dd202]
... continues over vibed http stack
I honestly don't know why this happens, wether if it's
- bad mysql-native usage
- related to vibed 0.8.3
- related to dmd v2.079.0
Metadata
Metadata
Assignees
Labels
No labels