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

acquiring connection for a transaction never times out #1703

koskimas opened this Issue Sep 28, 2016 · 0 comments


None yet
2 participants

koskimas commented Sep 28, 2016

Here's a test to reproduce this bug:

    it('acquireConnectionTimeout should work for transactions', function (done) {
      var knexConfig = _.clone(knex.client.config);

      knexConfig.pool.min = 0;
      knexConfig.pool.max = 1;
      knexConfig.acquireConnectionTimeout = 300;

      var knexDb = new Knex(knexConfig);

      // Create a transaction that will occupy the only available connection.
      knexDb.transaction(function() {
        // This transaction will fail after acquireConnectionTimeout because the outer
        // transaction is keeping our only connection. Note that this is not a save point, 
        // but simply another transaction. This code may not make sense, but the outer 
        // transaction is there simply to hog the connection.
        return knexDb.transaction(function() {})
      }).then(function () {
        done(new Error('should not get here'));
      }).catch(function (error) {
        // Should get here after 300 ms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment