-
Notifications
You must be signed in to change notification settings - Fork 28
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
Assertion when concurrently using multiple LockedConnection #170
Comments
Don't call queryRes.close(); (I don't know if that's related.) |
I tried removing it, but it didn't solve the issue. I noticed noticed that the assert always occurs when launching the double curl command the second time. I suspect something goes wrong when destroying/cleaning LockedConnections that have been used concurrently. |
First, thanks for the excellent test case. That's a huge help. Your code looks correct to me, so I did a little digging. So far, it looks like there's two parts to the problem here: The immediate failure, the AssertError your getting, is from an invariant contract check in mysql-native. But the check itself ( But, that AssertError is only a secondary failure. It's just an additional problem that's triggered while the stack is already unwinding from a different failure. If I remove that assert, the original problem is shown:
Appears to be something going wrong in vibe-d/eventcore (maybe due to something mysql-native is doing?). I will file a ticket there and hopefully we can get this resolved. |
Interesting. On vibe.d v0.8.2, this results in neither
|
By adding this to the test case's import std.stdio;
writeln("*cast(void**)&conn: ", *cast(void**)&conn); I can see that ConnectionPool is handing out the same connection to two different tasks before the first task has completed. |
Both, the old "aquiring reader" and the new "overwriting notification callback" assertions, have the same cause - reading or writing concurrently on the same connection. I had a look at the source and I think the bug lies here: mysql-native/source/mysql/pool.d Line 174 in 249c122
Due to the (awful) implicit casting that is possible through the |
Maybe |
Thanks a ton! That does indeed fix it! A stupid mistake in mysql-native and clearly I was just spinning in circles with it (and my code to output the address of the Connection object must've been wrong too.) Expect a fix and new release after I get some sleep, fading fast here... (BTW, one unfortunate problem I've found with opDot in the past is that it conflicts pretty badly with...uhh, one other major D feature...I think it might've been UFCS, IIRC). |
Speaking of this, mysql-native may need updated to optionally support |
Putting together a fix, regression test, and new release right now. Summary: Ultimately, How it happened: After a change made for v2.1.0, |
…e-core` (as opposed to `vibe-d:core`).
Also, the other part of this issue is that mysql-native's socket wrappers had an invariant check that was incompatible with |
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:
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:I honestly don't know why this happens, wether if it's
The text was updated successfully, but these errors were encountered: