Git Product home page Git Product logo

Comments (10)

quinthar avatar quinthar commented on September 15, 2024

@willfong Can you clarify that the following steps will reproduce it:

  1. Install Ubuntu 16.04
  2. Run sudo apt-get install mariadb
  3. Install Bedrock per the instructions at http://bedrockdb.com
  4. Run service bedrock start
  5. Run mysql -h127.0.0.1 -e "SELECT 1 AS foo, 2 AS bar;"

Is there anything more to it than that -- no special commands or anything?

Tips for fixing:

Here are some pointers to anyone who wants to fix this:

  • The MySQL compatibility layer is entirely in MySQL.cpp/h
  • The getPort() command is what causes the plugin to open a port
  • Each time a connection is received on that port, onPortAccept() is called
  • The MySQL protocol is a bit unusual in that the server is the first to announce itself on a new connection, which it does to here
  • All MySQL packets are parsed and constructed using the simple MySQLPacket struct
  • Specifically, it sends back the results of MySQLPacket::serializeHandshake()
  • It's possible, but unlikely that that's where it crashes. Odds are the client receives that handshake successfully, and then responds with a request that crashes Bedrock.
  • That request would be processed in onPortRecv(), which is called whenever a socket accepted on the plugin's port receives data
  • To see the most verbose logging, start bedrock using the -v flag. This will cause its SDEBUG() log lines to execute (eg, like here)
  • MySQL is a pretty harsh and unforgiving binary protocol, so this often requires manually inspecting the hex-encoded request and comparing against the rather confusion (to me, at least) binary protocol documentation.
  • In particular, it uses a super-optimized length-encoded integer format, which you can see how to encode here.
  • Incidentally, I'd suggest adding a SINFO("Executing true query") line here, as that's the only code path I see that doesn't log what's happening clearly.
  • However, it looks from the log provided that it's crashing on the query select @@version_comment limit 1, which should be processed here, and should in theory successfully return this value here.
  • But that's a nasty little bit of code, so I could easily imagine a crash bug existing in there.

Regardless, if this is a reliably reproducible problem, that happens during connection setup, it should be relatively easy to fix -- especially since it seems to be happening after the packet itself was parsed. (Bugs during parsing are a lot harder to fix.)

Any volunteers to take it on?

from bedrock.

quinthar avatar quinthar commented on September 15, 2024

FYI, posted an Upwork job here if anybody would like to earn a quick $500: https://www.upwork.com/jobs/_~013f98c7e3d216f1a1

from bedrock.

willfong avatar willfong commented on September 15, 2024

@quinthar Yes, those steps are correct. Thanks for looking into this!

from bedrock.

Vadius avatar Vadius commented on September 15, 2024

@willfong, could you check if the bug reproduced on 7ece319 ?
I've tried to do it, but all work fine:

// tty.1
$ ./bedrock -clean -v -plugins status,db,jobs,cache,mysql -cache 10001

// tty.2
$ mysql --version
mysql  Ver 15.1 Distrib 10.0.28-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
$ mysql -h127.0.0.1 -e "SELECT 1 AS foo, 2 AS bar;"
+------+------+
| foo  | bar  |
+------+------+
|    1 |    2 |
+------+------+

from bedrock.

quinthar avatar quinthar commented on September 15, 2024

@willfong - Can you please rebuild from the master branch and test to see if you can reproduce this issue? Thanks!

from bedrock.

quinthar avatar quinthar commented on September 15, 2024

@willfong - Eager for your comments here, btw.

from bedrock.

willfong avatar willfong commented on September 15, 2024

@quinthar Hi, Sorry about the delay. This week is a bit busy for me, but I can check it out next week. Thank you very much for your fast resolution to this 😄

from bedrock.

willfong avatar willfong commented on September 15, 2024

Sorry, this week has been terribly busy for me. Can we mark this as resolved for now? When I get some time again, I can open a new issue if I encounter this again. Thank you again for the prompt resolution!

from bedrock.

Vadius avatar Vadius commented on September 15, 2024

@willfong , I can send you already built Bedrock binaries in tgz, so you should just run your test. If it's ok, send me a mail to vadius[]vadius.ru, I'll reply with the archive.

from bedrock.

 avatar commented on September 15, 2024

@willfong should be fixed by #127

from bedrock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.