ngerakines / erlang_mysql Goto Github PK
View Code? Open in Web Editor NEWA GitHub mirror of the native Erlang MySQL client library.
A GitHub mirror of the native Erlang MySQL client library.
This library was written by Magnus Ahltorp <[email protected]>. My changes: * Commented out code for debug logging. * Updated/tweaked the build system.
First let me apologize for submitting this issue. I have to do something wrong, but I can't figure out what.
Cloning and building erlang_mysql works fine, but then I run into errors executing the tests:
$ make test
sh ebin/mysql.app.in 3
mkdir -p ebin
(cd src;make)
/Users/ck/lib/erlang/erlang_mysql/src
make[1]: Nothing to be done for `all'.
prove t/*.t
t/001-load..............ok
t/connect...............ok 1/0
Crash dump was written to: erl_crash.dump
init terminating in do_boot (badarg)
t/connect...............dubious
Test returned status 1 (wstat 256, 0x100)
t/execute...............
Crash dump was written to: erl_crash.dump
init terminating in do_boot (badarg)
t/execute...............dubious
Test returned status 1 (wstat 256, 0x100)
t/fetch_many............
Crash dump was written to: erl_crash.dump
init terminating in do_boot (badarg)
t/fetch_many............dubious
Test returned status 1 (wstat 256, 0x100)
t/prepare...............
Crash dump was written to: erl_crash.dump
init terminating in do_boot (badarg)
t/prepare...............dubious
Test returned status 1 (wstat 256, 0x100)
t/prepare_concurrent....
Crash dump was written to: erl_crash.dump
init terminating in do_boot (badarg)
t/prepare_concurrent....dubious
Test returned status 1 (wstat 256, 0x100)
Failed Test Stat Wstat Total Fail List of Failed
-------------------------------------------------------------------------------
t/connect.t 1 256 ?? ?? ??
t/execute.t 1 256 ?? ?? ??
t/fetch_many.t 1 256 ?? ?? ??
t/prepare.t 1 256 ?? ?? ??
t/prepare_concurrent.t 1 256 ?? ?? ??
Failed 5/6 test scripts. -1/4 subtests failed.
Files=6, Tests=4, 4 wallclock secs ( 1.78 cusr + 2.41 csys = 4.19 CPU)
Failed 5/6 test programs. -1/4 subtests failed.
make: *** [test] Error 1
Then I check my existing code using the mysql drivers from http://erlang-mysql-driver.googlecode.com/svn/trunk to ensure everything is fine with MySQL. I'm able to connect to the database and retrieve rows. Replacing the mysql lib and the connect call with the one in erlang_mysql I again ran into the same error.
Any pointers where I went of the track are appreciated,
-ck
In the mysql_conn module, prepared statements are not being released properly and can result in an out-of-bounds error being raised by the mysql server.
There's a problem in the '... ! {remove_connection, Pid}' code when a connection is terminated. What can happen is that two spawned processes can both make requests to a connection for SQL executions whereby the first will fail and send a message back to the dispatcher to destroy and recreate the connection but only after the second one is to be executed. What needs to happen is that during the response phase for the mysql_dispatcher process, the timeout and connection destroy/recreate code needs to be handled at that point to not hang any subsequent connections.
Proof of concept:
> mysql:start_link/...
-- connection is spawned
> spawn(fun() -> mysql:execute(foo, <<"select sleep(20);">>)) end)
-- connection comes back without a timeout and does `whereis(mysql_dispatcher) ! {remove_connection, Pid}`
> spawn(fun() -> mysql:execute(foo, <<"select sleep(20);">>)) end)
-- The message to remove the connection above is in the message inbox after this SQL execution request and this one fails, hangs, timesout.
This can be resolved fairly easily a few different ways. If one of you want to tackle it then let me know on Monday, otherwise I'll take a stab at it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.