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

Unsupported dataLength 18 for IntN #398

Open
mhingston opened this issue Jun 24, 2016 · 2 comments
Open

Unsupported dataLength 18 for IntN #398

mhingston opened this issue Jun 24, 2016 · 2 comments
Labels
Follow up Recent question asked by tedious members for old issues or discussion that requires member input

Comments

@mhingston
Copy link

mhingston commented Jun 24, 2016

Hi,

Just got the following uncaught exception (SQL Server 2008/TDS 7.4/Tedious 1.14.0/Windows 10 x64):

MyProject\node_modules\tedious\lib\token\stream-parser.js:121

        callback();
        ^
Error: Unsupported dataLength 18 for IntN
    at MyProject\node_modules\tedious\lib\value-parser.js:125:43
    at MyProject\node_modules\tedious\lib\token\stream-parser.js:147:9
    at Parser.awaitData (MyProject\node_modules\tedious\lib\token\stream-parser.js:121:9)
    at Parser.readUInt8 (MyProject\node_modules\tedious\lib\token\stream-parser.js:144:12)
    at readDataLength (MyProject\node_modules\tedious\lib\value-parser.js:64:27)
    at MyProject\node_modules\tedious\lib\value-parser.js:90:5
    at readTextPointerNull (MyProject\node_modules\tedious\lib\value-parser.js:36:5)
    at valueParse (MyProject\node_modules\tedious\lib\value-parser.js:89:3)
    at next (MyProject\node_modules\tedious\lib\token\row-token-parser.js:19:5)
    at MyProject\node_modules\tedious\lib\token\row-token-parser.js:35:7
    at MyProject\node_modules\tedious\lib\value-parser.js:402:7
    at MyProject\node_modules\tedious\lib\token\stream-parser.js:410:9
    at Parser.awaitData (MyProject\node_modules\tedious\lib\token\stream-parser.js:121:9)
    at Parser.readBuffer (MyProject\node_modules\tedious\lib\token\stream-parser.js:407:12)
    at readNChars (MyProject\node_modules\tedious\lib\value-parser.js:401:19)
    at MyProject\node_modules\tedious\lib\value-parser.js:202:20
    at MyProject\node_modules\tedious\lib\token\stream-parser.js:180:9
    at Parser.awaitData (MyProject\node_modules\tedious\lib\token\stream-parser.js:121:9)
    at Parser.readUInt16LE (MyProject\node_modules\tedious\lib\token\stream-parser.js:177:12)
    at readDataLength (MyProject\node_modules\tedious\lib\value-parser.js:67:27)
    at MyProject\node_modules\tedious\lib\value-parser.js:90:5
    at readTextPointerNull (MyProject\node_modules\tedious\lib\value-parser.js:36:5)

I'm not able to replicate this at present, but it appears to have happened just calling execSql with a simple select statement.

@mhingston
Copy link
Author

mhingston commented Jul 27, 2016

This is still happening occasionally.

Most recent stack trace:

MyProject\node_modules\tedious\lib\token\stream-parser.js:121

        callback();
        ^
Error: Unsupported dataLength 10 for IntN
    at MyProject\node_modules\tedious\lib\value-parser.js:125:43
    at MyProject\node_modules\tedious\lib\token\stream-parser.js:147:9
    at Parser.awaitData (MyProject\node_modules\tedious\lib\token\stream-parser.js:121:9)
    at Parser.readUInt8 (MyProject\node_modules\tedious\lib\token\stream-parser.js:144:12)
    at readDataLength (MyProject\node_modules\tedious\lib\value-parser.js:64:27)
    at MyProject\node_modules\tedious\lib\value-parser.js:90:5
    at readTextPointerNull (MyProject\node_modules\tedious\lib\value-parser.js:36:5)
    at valueParse (MyProject\node_modules\tedious\lib\value-parser.js:89:3)
    at next (MyProject\node_modules\tedious\lib\token\row-token-parser.js:19:5)
    at MyProject\node_modules\tedious\lib\token\row-token-parser.js:35:7
    at MyProject\node_modules\tedious\lib\value-parser.js:402:7
    at MyProject\node_modules\tedious\lib\token\stream-parser.js:410:9
    at Parser.awaitData (MyProject\node_modules\tedious\lib\token\stream-parser.js:121:9)
    at Parser.readBuffer (MyProject\node_modules\tedious\lib\token\stream-parser.js:407:12)
    at readNChars (MyProject\node_modules\tedious\lib\value-parser.js:401:19)
    at MyProject\node_modules\tedious\lib\value-parser.js:202:20
    at MyProject\node_modules\tedious\lib\token\stream-parser.js:180:9
    at Parser.awaitData (MyProject\node_modules\tedious\lib\token\stream-parser.js:121:9)
    at Parser.readUInt16LE (MyProject\node_modules\tedious\lib\token\stream-parser.js:177:12)
    at readDataLength (MyProject\node_modules\tedious\lib\value-parser.js:67:27)
    at MyProject\node_modules\tedious\lib\value-parser.js:90:5
    at readTextPointerNull (MyProject\node_modules\tedious\lib\value-parser.js:36:5)

This always seems to happen when I call execSql with a parameterised statement to invoke a stored procedure which takes a single Int argument. The actual call looks like this: exec MyDatabase.dbo.GetSelection 20. It doesn't happen all the time though, only say 10% of the time. The stored procedure looks like this:

USE [MyDatabase]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[GetSelection]
    @FilterID int
AS

SET NOCOUNT OFF

SELECT MAX(Account.AccountName) [Name], MAX(Account.AccountID) [AccountID], MAX(Account.AccountName) [AccountName]
FROM MyOtherDatabase.dbo.FilterFranchise
JOIN MyOtherDatabase.dbo.Franchise ON Franchise.FranchiseID = FilterFranchise.FranchiseID
JOIN MyOtherDatabase.dbo.Site ON Site.SiteID = Franchise.SiteID
JOIN Account ON Account.AccountID = Site.AccountID
WHERE FilterFranchise.FilterID = @FilterID
GROUP BY Account.AccountID

SELECT MAX(Account.AccountName + ' > ' + Site.SiteName) [Name], MAX(Account.AccountID) [AccountID], MAX(Account.AccountName) [AccountName]
FROM MyOtherDatabase.dbo.FilterFranchise
JOIN MyOtherDatabase.dbo.Franchise ON Franchise.FranchiseID = FilterFranchise.FranchiseID
JOIN MyOtherDatabase.dbo.Site ON Site.SiteID = Franchise.SiteID
JOIN dbo.Account ON Account.AccountID = Site.AccountID
WHERE FilterFranchise.FilterID = @FilterID
GROUP BY Site.SiteID

SELECT MAX(Account.AccountName + ' > ' + Site.SiteName + ' > ' + Franchise.FranchiseName) [Name], MAX(Account.AccountID) [AccountID], MAX(Account.AccountName) [AccountName]
FROM MyOtherDatabase.dbo.FilterFranchise
JOIN MyOtherDatabase.dbo.Franchise ON Franchise.FranchiseID = FilterFranchise.FranchiseID
JOIN MyOtherDatabase.dbo.Site ON Site.SiteID = Franchise.SiteID
JOIN Account ON Account.AccountID = Site.AccountID
WHERE FilterFranchise.FilterID = @FilterID
GROUP BY Franchise.FranchiseID

Switching to callProcedure in place of execSql makes no difference.

@IanChokS
Copy link
Member

Hi @mhingston, are you still experiencing this issue with the latest tedious version?

@IanChokS IanChokS added the Follow up Recent question asked by tedious members for old issues or discussion that requires member input label Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Follow up Recent question asked by tedious members for old issues or discussion that requires member input
Projects
None yet
Development

No branches or pull requests

2 participants