tedious icon indicating copy to clipboard operation
tedious copied to clipboard

ReadableTrackingBuffer.prototype.assertEnoughLeftFor - throwing oob error continuosly

Open ekelvin opened this issue 12 years ago • 15 comments

why ReadableTrackingBuffer.prototype.assertEnoughLeftFor is throwing oob error continuosly. is this normal and how can I avoid the break on this throw

ekelvin avatar Feb 22 '14 12:02 ekelvin

I just wrote up Tokens that span packets, which I hope goes some way to explaining why that exception is thrown and caught.

pekim avatar Feb 23 '14 17:02 pekim

I use node.js throw visual studio and the it braked the execution every time in that point. The Object thrown is not a predefined Error object and I should add an exception avoid rule to visual studio for a # which is not good because if another module do the same thing I will avoid their exceptions too. Can you make the object a predefined one with a name to avoid this. At last but not least in base of the type of error your return true or false. My recommendation is not to use exceptions for a normal behavior.

ekelvin avatar Mar 06 '14 09:03 ekelvin

Hi I am seeing same issues trying out various MSSQL node connectors any help appreciated thanks image

djholly123 avatar May 25 '14 11:05 djholly123

I am seeing the same thing from a very basic select statement:

SELECT [ComponentID], [Component].[Name] AS [ControlName], [FriendlyName] FROM [Component] WHERE [Component].[ProductFamilyID] = 16

Which results in this:

image

craigshoemaker avatar Aug 11 '14 21:08 craigshoemaker

This is something that will be fixed by #225.

arthurschreiber avatar Feb 23 '15 13:02 arthurschreiber

This was fixed with #285 which was merged and released with v1.12.0.

arthurschreiber avatar Aug 11 '15 11:08 arthurschreiber

Tried to input bad credentials. Still throws here on the latest version

buffer.js:582
    throw new RangeError('Trying to access beyond buffer length');
          ^
RangeError: Trying to access beyond buffer length
    at checkOffset (buffer.js:582:11)
    at Buffer.readUInt8 (buffer.js:588:5)
    at Packet.isLast (/DataAPI/node_modules/tedious/lib/packet.js:121:29)
    at ReadablePacketStream.<anonymous> (/DataAPI/node_modules/tedious/lib/message-io.js:102:18)
    at ReadablePacketStream.EventEmitter.emit (events.js:95:17)
    at readableAddChunk (/DataAPI/node_modules/tedious/node_modules/readable-stream/lib/_stream_readable.js:199:16)
    at ReadablePacketStream.Readable.push (/DataAPI/node_modules/tedious/node_modules/readable-stream/lib/_stream_readable.js:163:10)
    at ReadablePacketStream.Transform.push (/DataAPI/node_modules/tedious/node_modules/readable-stream/lib/_stream_transform.js:133:32)
    at ReadablePacketStream._transform (/DataAPI/node_modules/tedious/lib/message-io.js:68:16)
    at ReadablePacketStream.Transform._read (/DataAPI/node_modules/tedious/node_modules/readable-stream/lib/_stream_transform.js:172:10)

arkihillel avatar Dec 07 '15 11:12 arkihillel

Can you explain what you mean with tried to input bad credentials?

arthurschreiber avatar Dec 07 '15 14:12 arthurschreiber

@arthurschreiber Well I mean wrong credentials like a non suitable host/port/...

After some testing, I narrowed it down to a single reproducible weird case. When I input a MySQL server host and its port, the server crashes with the above error. Here's some code:

var Connection = require('tedious').Connection;
var config = {
    server: 'mysql-micro.*******.eu-west-1.rds.amazonaws.com',
    userName: 'hillel',
    password: '******',
    options: {
        port: 3306,
        database: 'test',
        rowCollectionOnDone: true,
        rowCollectionOnRequestCompletion: true
    }
};
var connection = new Connection(config);
connection.on('connect', function(err) {
    connection.close();
});

I tried it wit non existing hosts and Oracle, PostgreSQL and DB2 hosts. These don't crash. Only a MySQL host crashes as far as I can tell

arkihillel avatar Dec 07 '15 15:12 arkihillel

After some further testing on my DBs, I can make a quick list: Working (connection times out):

  • Oracle
  • PostgreSQL
  • IBM DB2
  • MongoDB

Crashing:

  • MySQL
  • MariaDB (expect-idly)
  • Cassandra
  • SAP Adaptive Server Enterprise

arkihillel avatar Dec 07 '15 15:12 arkihillel

Okay. This is weird. I don't think anyone expects tedious to be able to connect to any of those servers, but we shouldn't crash the whole process either. I'll take a look.

arthurschreiber avatar Dec 07 '15 15:12 arthurschreiber

I'm not expecting so. I'm just building a unified querying client and have mistakenly clicked on the wrong connector, thus discovering this issue

arkihillel avatar Dec 07 '15 15:12 arkihillel

Meet same issue.

RogerKang avatar Dec 14 '17 11:12 RogerKang

A years passed, and in the fall of 2018 I've met the same issue. Any news, guys? Shouldn't we reopen this issue?

tverdohleb avatar Nov 15 '18 18:11 tverdohleb

@tverdohleb @RogerKang, if you specify a different server in the config, what error message do you get back?

IanChokS avatar Dec 18 '19 19:12 IanChokS