Closed EmTee70 closed 3 years ago
Easiest way is to compile with -g (or dub's debug build option) and then run the program from inside gdb like this
gdb --args ./your_program any args it needs
First thing you need to do in here is disable the debugger catching with the GC pauses it. Assuming you on linux, paste these two lines in:
handle SIGUSR1 noprint
handle SIGUSR2 noprint
Now you are ready to go. It will give you a prompt and type "r" (for "run").
Then go to the browser and do what you need to do to make it crash.
Then go back to the debugger, it should say something like "signal received SIGSEGV" and be at a prompt again. Now you can type "where" and it should spit out the line where it failed and a stack trace.
That might be enough for you to see where the bug is yourself, or you can paste it in here and I'll see if it makes any sense to me too.
I've done a bunch of larger data sets with mysql in the past with this lib... but nothing recently. Back when they put out MySQL version 5.1, it was a breaking change on the binary layout of data, so you had to use a version specifier when building. But that was so long ago you surely don't have an old version....... but possible a new version did a similiar change.
What database version do you have?
Of course also possible it is just a plain old bug I messed up on.
Thank you a lot! I have: mysql --version mysql Ver 14.14 Distrib 5.7.32, for Linux (x86_64) using EditLine wrapper
Hmm: [New Thread 0x7ffff7fd5700 (LWP 18295)] [New Thread 0x7ffff7e16700 (LWP 18296)] [New Thread 0x7ffff7e0f700 (LWP 18297)]
Thread 1 "mysql-browse" received signal SIGSEGV, Segmentation fault. 0x00007ffff787dbca in ?? () from /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20
Should I go further and install the debug symbols for mysql: as mentioned here ? https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1818985
I will check it out on my notebook, updating it to Ubuntu 20.04. and a newer mysqlclient, if this helps I will do the same for my server. The only strange thing is, that the other mysql-d lib was working without problems.
Did the where
command give any more info? The problem is almost certainly a higher level than that.
(i think the other mysql lib doesn't use the same client at all btw)
yes:
at ../../.dub/packages/arsd-official-8.5.2/arsd-official/mysql.d:232
at ../../.dub/packages/arsd-official-8.5.2/arsd-official/mysql.d:236
at /usr/include/dmd/phobos/std/array.d:3249
at /usr/include/dmd/phobos/std/array.d:3853
at /usr/include/dmd/phobos/std/conv.d:150
at /usr/include/dmd/phobos/std/conv.d:1050
at /usr/include/dmd/phobos/std/conv.d:223
at /usr/include/dmd/phobos/std/conv.d:4195
at /usr/include/dmd/phobos/std/conv.d:4150
The old lib was based on your code: mysql library binding. Extraction from https://github.com/adamdruppe/arsd
Your old arsd version of close was:
void close() {
if (mysql) {
mysql_close(mysql);
mysql = null;
}
}
now:
void close() {
mysql_close(mysql);
}
May be mysql
can be undefined and than... dump?
oh that must explain it. on my copy that code has never been changed - the person who forked it must have already noticed and fixed this bug!
I just pushed it, you should try making the change on your copy too then see if it fixes your problem too.
It works! Thank you for teaching me!
yay! that was easier than I thought it would be lol, just a plain missing null check :)
I am very happy, that my mysql-browse now relies on a maintained package. In the moment I have increased the scope of the program to do some other special tasks for me. But I may reduce it to the pure mysql-browser again and put it on github. Because it is simple and fast I get a table and/or database info request rendered in 120ms and not in more than a second with phpmyadmin. (and you don't need a login in what saves most). It was my fist useful D program and I love the quick response, always when I need to know table or field names or type of one of our many mysql tables. So thank you again for your lib!
yeah let me know if you need more, i haven't used this module for a while so there are probably some missing spots
Hi, Adam I wrote a small tool (like a simple and fast replacement for phpmyadmin) to browse my mysql databases. I was using https://code.dlang.org/packages/mysql-d which was working stable, but because of several deprecation warnings i switched to your arsd-mysql.d Now the tool starts working but crashes after several browser requests. With a core dump. What can I do to find out the reason - I am not used to use the debugger but willing learn. How to start? And it seems to be depending on the size of the requested data, too. Any hint?