question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RequestError: Timeout: Request failed to complete in 15000ms

See original GitHub issue

Issue: unable to set requestTimeout with configuration parameter for “mssql” dilect No matter whatever value is in requestTimeout parameter, the driver sets default value of “15000ms”. Hence, Timeout error occurs for all query that takes longer than 15s.

Application log is as follows:

Executing (default): SELECT [AnalysisTagID], [RefDate], [CategorySet], [AssetID], [Category] FROM [EMA_RiskAllocCategoriesView] AS [EMA_RiskAllocCategoriesView] ORDER BY [EMA_RiskAllocCategoriesView].[AssetID] OFFSET 0 ROWS FETCH NEXT 3 ROWS ONLY;
Error EMA_RiskAllocCategoriesView.getAll DatabaseError [SequelizeDatabaseError]: Timeout: Request failed to complete in 15000ms
    at Query.formatError (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/sequelize/lib/dialects/mssql/query.js:309:12)
    at Request.userCallback (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/sequelize/lib/dialects/mssql/query.js:69:23)
    at Request.callback (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/lib/request.js:37:27)
    at Connection.message (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/lib/connection.js:2181:24)
    at Connection.dispatchEvent (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/lib/connection.js:1172:36)
    at MessageIO.<anonymous> (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/lib/connection.js:1045:14)
    at MessageIO.emit (events.js:200:13)
    at Message.<anonymous> (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/lib/message-io.js:32:14)
    at Message.emit (events.js:205:15)
    at endReadableNT (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/node_modules/readable-stream/lib/_stream_readable.js:1077:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:9) {
  name: 'SequelizeDatabaseError',
  parent: RequestError: Timeout: Request failed to complete in 15000ms
      at RequestError (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/lib/errors.js:32:12)
      at Connection.requestTimeout (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/lib/connection.js:1117:21)
      at Timeout._onTimeout (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/lib/connection.js:1085:14)
      at listOnTimeout (internal/timers.js:531:17)
      at processTimers (internal/timers.js:475:7) {
    message: 'Timeout: Request failed to complete in 15000ms',
    code: 'ETIMEOUT',
    sql: 'SELECT [AnalysisTagID], [RefDate], [CategorySet], ' +
      '[AssetID], [Category] FROM [EMA_RiskAllocCategoriesView] ' +
      'AS [EMA_RiskAllocCategoriesView] ORDER BY ' +
      '[EMA_RiskAllocCategoriesView].[AssetID] OFFSET 0 ROWS ' +
      'FETCH NEXT 3 ROWS ONLY;'
  },

What are you doing?

sequelize is instantiated as follows where requestTimeout is set to 30s

const sequelize = new Sequelize(config.db.schema, config.db.username, config.db.password, {  
  "host": config.db.url,
  "dialect": "mssql",
  "dialectOptions": {
    "requestTimeout": 300000
  },
  pool: {
    max: 5,
    min: 0,
    acquire: 30000,
    idle: 10000
  }
});

A query that does full scan in a large table is run as follows:

EMA_RiskAllocCategoriesView.findAll({
    }).catch((err)=>{
      console.log("Error EMA_RiskAllocCategoriesView.getAll",err)
    });

To Reproduce Steps to reproduce the behavior:

  1. Initiate sequelize with requestTimeout set to 30s
  2. Use a query that takes longer than 15s
  3. See error which says “Request failed to complete in 15000ms”

What do you expect to happen?

Not thow request timeout error for queries that run for 30s if sequelize is set to have requestTimeout of 30s.

What is actually happening?

Timeout Error for all query that takes longer than 15 s

Output, either JSON or SQL

Executing (default): SELECT [AnalysisTagID], [RefDate], [CategorySet], [AssetID], [Category] FROM [EMA_RiskAllocCategoriesView] AS [EMA_RiskAllocCategoriesView] ORDER BY [EMA_RiskAllocCategoriesView].[AssetID] OFFSET 0 ROWS FETCH NEXT 3 ROWS ONLY;
Error EMA_RiskAllocCategoriesView.getAll DatabaseError [SequelizeDatabaseError]: Timeout: Request failed to complete in 15000ms
    at Query.formatError (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/sequelize/lib/dialects/mssql/query.js:309:12)
    at Request.userCallback (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/sequelize/lib/dialects/mssql/query.js:69:23)
    at Request.callback (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/lib/request.js:37:27)
    at Connection.message (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/lib/connection.js:2181:24)
    at Connection.dispatchEvent (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/lib/connection.js:1172:36)
    at MessageIO.<anonymous> (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/lib/connection.js:1045:14)
    at MessageIO.emit (events.js:200:13)
    at Message.<anonymous> (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/lib/message-io.js:32:14)
    at Message.emit (events.js:205:15)
    at endReadableNT (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/node_modules/readable-stream/lib/_stream_readable.js:1077:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:9) {
  name: 'SequelizeDatabaseError',
  parent: RequestError: Timeout: Request failed to complete in 15000ms
      at RequestError (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/lib/errors.js:32:12)
      at Connection.requestTimeout (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/lib/connection.js:1117:21)
      at Timeout._onTimeout (/Users/abinash/Desktop/my-app/new-dashboard/ember-electron/resources/sapiat-server/node_modules/tedious/lib/connection.js:1085:14)
      at listOnTimeout (internal/timers.js:531:17)
      at processTimers (internal/timers.js:475:7) {
    message: 'Timeout: Request failed to complete in 15000ms',
    code: 'ETIMEOUT',
    sql: 'SELECT [AnalysisTagID], [RefDate], [CategorySet], ' +
      '[AssetID], [Category] FROM [EMA_RiskAllocCategoriesView] ' +
      'AS [EMA_RiskAllocCategoriesView] ORDER BY ' +
      '[EMA_RiskAllocCategoriesView].[AssetID] OFFSET 0 ROWS ' +
      'FETCH NEXT 3 ROWS ONLY;'
  },

Environment

Dialect:

  • mssql

Dialect library version: tedious 6.1.2 Database version: mcr.microsoft.com/mssql/server:2017-latest (docker) Sequelize version: 5.8.7 Node Version: v12.3.1 OS: osx If TypeScript related: TypeScript version: XXX Tested with latest release:

  • No

Self investigation. hard coded fix is to change the value of the following variable in “lib/connection.js” module of tedious library const DEFAULT_CLIENT_REQUEST_TIMEOUT = 15 * 1000;

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

24reactions
cbogwillcommented, Jul 2, 2019

@nash90: I had the same issue. Try doing this instead:

"dialectOptions": {
    options: { "requestTimeout": 300000 }
  },
4reactions
jepalencommented, Dec 28, 2020

For me in NodeJs with Mssql worked just this small change: just put outside of the options the field requestTimeout

const config = { user: ‘login’, password: ‘pass’, server: ‘10.11.24.15’, port: 1433, database: ‘base’, ‘requestTimeout’: 130000, options: { ‘enableArithAbort’: true, ‘idleTimeoutMillis’: 130000 },

Read more comments on GitHub >

github_iconTop Results From Across the Web

seriate RequestError: SqlContext Error. Failed on step ...
Does the error still indicate that "Request failed to complete in 15000ms" as opposed to the new timeout value of 300000? And how...
Read more >
timeout: request failed to complete in 15000ms mssql
requesterror: timeout: request failed to complete in 15000ms mssql. Issue: unable to set requestTimeout with configuration parameter for "mssql" dilect No ...
Read more >
Timeout: Request failed to complete - jsreport forum
I changed the "reportTimeout": 240000, from 60000 but same issue. Timeout: Request failed to complete in 15000ms logs: +0 Starting rendering ...
Read more >
requesterror timeout request failed to complete in 15000ms ...
requesterror timeout request failed to complete in 15000ms mssql nodejs技术、学习、经验文章掘金开发者社区搜索结果。掘金是一个帮助开发者成长的社区 ...
Read more >
SqlServer 请求超时:Request failed to complete in 15000ms
SqlServer 查询分析器默认为 15秒 。 如果数据量较大请求超时即会报错,如下图: name: 'SequelizeDatabaseError', parent: RequestError: Timeout: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found