Skip to content
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

select varchar - thinks the package is incomplete while it's actually complete #18

Closed
simendsjo opened this issue Sep 19, 2013 · 4 comments · Fixed by fsw/mysql-native#2

Comments

@simendsjo
Copy link

EDIT: I wrote the wrong compiler version

I'm not really sure what is causing this as I no longer remember the protocol.
This is running on linux x64, mariadb 5.5.32, dmd 2.063.2.

Could anyone test this on mysql? It's up for grabs if anyone wants it :)

    auto db = new MysqlDB("host=localhost;port=3306;user=test;pwd=test;db=homepage");
    auto cn = db.lockConnection;
    scope(exit) cn.close();
    auto cmd = new Command(cn, "create table if not exists mysqlnbug (s varchar(64));");
    ulong n;
    cmd.execSQL(n);
    cmd.sql = "select s from mysqlnbug";
    // In consumeNonBinaryIfComplete!string, isIncomplete=true because LCB value > packet.length
    // this causes Row to continue fetching packets, but there are no more data from
    // the server, so this just hangs forever.
    cmd.execSQLResult();
@sshamov
Copy link

sshamov commented Sep 19, 2013

I cannot test the case right now, but I noticed that a packet is not checked by calling packet.isEOFPacket() inside do-while loop at Row constructor. Maybe this is the problem.

@punkUser
Copy link

I'm seeing this issue here too. Field is a varchar(256) in my case and if it's sufficiently long the query will just hang within the loop. Any fixes or ideas what to do to work around?

fsw added a commit to fsw/mysql-native that referenced this issue May 11, 2014
fixed decoding LCB value for fields > 250 bytes.
according to this doc:
http://dev.mysql.com/doc/internals/en/event-content-writing-conventions.html

Current implementation ignored this and was hanging waiting for more packets when VARCHAR was larger than 250 bytes.

There is also parseLCB function that is doing this exactly,
but it seems to be not used since commit 01b30f1

this probably fixes mysql-d#18
@Abscissa
Copy link

@simendsjo: Your sample code doesn't reproduce the issue for me even if I insert a row with the maximum length, 64 bytes.

However, it does hang for me if I change it to varchar(256) and insert a row with at least 251 bytes. Is that perhaps what you meant? If so, then it should be fixed now, via #40. Can you verify?

Abscissa pushed a commit to Abscissa/mysql-native that referenced this issue Jun 6, 2014
@Abscissa
Copy link

Abscissa commented Oct 5, 2014

Pinging @simendsjo: Since I (still) can't reproduce the exact original problem with varchar(64), but can verify that #40 does fix it for varchar(256) and a row with >=251 bytes, I'm going to go ahead and assume this issue is fixed and close the ticket. Please re-open if the problem still occurs.

@Abscissa Abscissa closed this as completed Oct 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants