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

ERROR: queryObj.pause is not a function #264

Closed
leejsinclair opened this issue Oct 6, 2022 · 4 comments
Closed

ERROR: queryObj.pause is not a function #264

leejsinclair opened this issue Oct 6, 2022 · 4 comments

Comments

@leejsinclair
Copy link

leejsinclair commented Oct 6, 2022

The error displayed is:

queryObj.pause is not a function - "queryObj.pause is not a function"
TypeError: queryObj.pause is not a function
 at PoolEventCaster.pauseQuery (./node_modules/msnodesqlv8/lib/pool.js:55:20)
 at Timeout._onTimeout (./node_modules/msnodesqlv8/lib/util.js:88:15)
 at listOnTimeout (internal/timers.js:557:17)
 at processTimers (internal/timers.js:500:7)

Notes:

  • We exclusively use callProc via new sql.Pool(options).
  • Using driver /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.10.so.1.1
  • Production is running Alpine Linux, Locally Ubuntu

I can replicate this locally using a stored procedure that takes longer than the SP timeout value.

Timeout test
Stored Procedure:

CREATE OR ALTER PROCEDURE timeoutTest
AS
BEGIN
	SET NOCOUNT ON;
	SET XACT_ABORT ON;

	WAITFOR DELAY '00:10'; -- 10 minutes
END;

Application Code:

db = new sql.Pool(options)
await db.promises.callProc('timeoutTest', {}, { timeoutMs: 1000 })
@TimelordUK
Copy link
Owner

thanks - "the queryObj.pause is not a function" is probably coming from q.pause() for example being called with the underlying connection being torn down.

Am very time constrained currently, thanks for example code.

it is not likely this will be resolved in next 1-2 months but I will keep you posted with progress as time permits.

@TimelordUK
Copy link
Owner

are you able to test query_timeout branch - this is far more change than I would have liked (I did look at it in the end but this is early build). I have only built Alpine Linux binaries so far.

This will require extensive testing as the code has never before had ability to cancel a call which is blocked on server - we only supported polling based queries. Here we are having to cancel an active query whilst the cpp native code is blocked on call to stored proc.

image

image

const timeoutSproc = `CREATE OR ALTER PROCEDURE <name>
AS
BEGIN
\tSET NOCOUNT ON;
\tSET XACT_ABORT ON;
\tWAITFOR DELAY '00:10'; -- 10 minutes
END;
`


    it('pool: sproc with timeout early terminates - check pool', async function handler () {
      const spName = 'timeoutTest'
      const size = 4
      const pool = env.pool(size)
      await pool.promises.open()
      await env.promisedCreate(spName, timeoutSproc)
      try {
        await pool.promises.callProc(spName, {}, { timeoutMs: 2000 })
        throw new Error('expected exception')
      } catch (err) {
        assert(err)
        assert(err.message.includes('Query cancelled'))
        const res = await pool.promises.query('select 1 as n')
        expect(res.first[0].n).equals(1)
      } finally {
        await pool.close()
      }
    })

@TimelordUK
Copy link
Owner

this fix is now released

@TimelordUK
Copy link
Owner

i think this is fixed closing

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

2 participants