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

After reboot MySQL, raise RangeError: index out of range #68

Open
ivesbai opened this issue Sep 12, 2017 · 0 comments
Open

After reboot MySQL, raise RangeError: index out of range #68

ivesbai opened this issue Sep 12, 2017 · 0 comments

Comments

@ivesbai
Copy link

ivesbai commented Sep 12, 2017

:\projects\nodejs\mysql_replication\node_modules\mysql\lib\protocol\Parser.js:78
        throw err; // Rethrow non-MySQL errors
        ^

RangeError: index out of range
    at checkOffset (buffer.js:696:11)
    at Buffer.readUInt8 (buffer.js:734:5)
    at readRow (F:\projects\nodejs\mysql_replication\node_modules\zongji\lib\rows_event.js:111:47)
    at WriteRows.RowsEvent._fetchOneRow (F:\projects\nodejs\mysql_replication\node_modules\zongji\lib\rows_event.js:95:10)
    at WriteRows.RowsEvent (F:\projects\nodejs\mysql_replication\node_modules\zongji\lib\rows_event.js:64:27)
    at new WriteRows (F:\projects\nodejs\mysql_replication\node_modules\zongji\lib\rows_event.js:126:13)
    at BinlogHeader.parse (F:\projects\nodejs\mysql_replication\node_modules\zongji\lib\packet\binlog_header.js:47:23)
    at Protocol._parsePacket (F:\projects\nodejs\mysql_replication\node_modules\mysql\lib\protocol\Protocol.js:262:12)
    at Parser.write (F:\projects\nodejs\mysql_replication\node_modules\mysql\lib\protocol\Parser.js:74:12)
    at Protocol.write (F:\projects\nodejs\mysql_replication\node_modules\mysql\lib\protocol\Protocol.js:39:16)

In function readRow, parser._offset is great than parser._buffer.length. I don't know how to fix this.

var readRow = function(tableMap, parser, emitter) {
  var row = {}, column, columnSchema;
  var nullBitmapSize = Math.floor((tableMap.columns.length + 7) / 8);
  var nullBuffer = parser._buffer.slice(parser._offset, 
                                        parser._offset + nullBitmapSize);                                     
  var curNullByte, curBit;
  parser._offset += nullBitmapSize;

  for (var i = 0; i < tableMap.columns.length; i++) {
    curBit = i % 8;
    if(curBit === 0) curNullByte = nullBuffer.readUInt8(Math.floor(i / 8));
    column = tableMap.columns[i];
    columnSchema = tableMap.columnSchemas[i];
    if((curNullByte & (1 << curBit)) === 0){
      row[column.name] =
        Common.readMysqlValue(parser, column, columnSchema, tableMap, emitter);
    }else{
      row[column.name] = null;
    }
  }
  return row;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant