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: 2 UNKNOWN: Transaction outcome unknown #202

Closed
walshie4 opened this issue May 23, 2018 · 13 comments
Closed

Error: 2 UNKNOWN: Transaction outcome unknown #202

walshie4 opened this issue May 23, 2018 · 13 comments
Assignees
Labels
api: spanner Issues related to the googleapis/nodejs-spanner API. 🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@walshie4
Copy link

Environment details

  • OS: CoreOS
  • Node.js version: v8.9.4
  • npm version: v6.0.1
  • @google-cloud/spanner version: v1.4.1

Steps to reproduce

  1. ???
  2. ???

Not sure what causes this but these errors started trickling in this morning. There's been about ~75 throughout the course of the day. Mainly wondering what would cause this sort of error and how I can go about debugging it.

Error info:

 meta: {
   code: 2    
   details: "Transaction outcome unknown."    
   message: "2 UNKNOWN: Transaction outcome unknown."    
   metadata: {
      _internal_repr: {
    }
 }
 note: "Exception occurred in retry method that was not classified as transient"    
 stack: [
    0: "Error: 2 UNKNOWN: Transaction outcome unknown."     
    1: "at Object.exports.createStatusError (/opt/app/node_modules/google-gax/node_modules/grpc/src/common.js:87:15)"     
    2: "at Object.onReceiveStatus (/opt/app/node_modules/google-gax/node_modules/grpc/src/client_interceptors.js:1214:28)"     
    3: "at InterceptingListener._callNext (/opt/app/node_modules/google-gax/node_modules/grpc/src/client_interceptors.js:590:42)"     
    4: "at InterceptingListener.onReceiveStatus (/opt/app/node_modules/google-gax/node_modules/grpc/src/client_interceptors.js:640:8)"     
    5: "at callback (/opt/app/node_modules/google-gax/node_modules/grpc/src/client_interceptors.js:867:24)"     
    6: ""     
  ]
  statusCode: 500    
} 
@walshie4
Copy link
Author

walshie4 commented May 23, 2018

FWIW this error occurs in the same location as we currently get a bunch of errors like so:

Server: 6 ALREADY_EXISTS: Unique index violation on index <index name>

(although this is expected for the values reported later in the message, just thought it could be relevant)

@walshie4
Copy link
Author

Another thing to note is that the requests which fail with this error all fail in just over 5 seconds. Could be a coincidence but they're all within 5020ms to 5275ms

@walshie4
Copy link
Author

walshie4 commented May 23, 2018

Here is the code which is causing this error (but succeeds usually):

// spanner is a Spanner database object ready to be used for operations
// tableName is a String of the desired table's name
// rowData is an object of data to write
export default (spanner, tableName, rowData) => {
  return new Promise((resolve, reject) => {
    // eslint-disable-next-line consistent-return
    spanner.runTransaction((errTrx, dbTrx) => {
      if (errTrx) {
        honeyLogger.error('V3 encountered error inserting', errTrx);
        return reject(errTrx);
      }

      const addedInfo = { storeShardId: getSpannerShardId(rowData.storeId) };
      const insertColumns = Object.assign({}, addedInfo, rowData);

      dbTrx.insert(tableName, insertColumns);
      dbTrx.commit((err) => {
        if (err) {
          dbTrx.end();
          return reject(err);
        }
        return resolve();
      });
    });
  })
  .then(() => rowData);
};

This code was written before we got further along with spanner so the approach is a bit odd but does work for nearly all inserts.

@JustinBeckwith JustinBeckwith added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels May 31, 2018
@crwilcox
Copy link
Contributor

crwilcox commented Jun 1, 2018

Just noting this is on the radar. We are currently handling some of the other issues which were prioritized over this.

@snehashah16
Copy link

This bug is being tracked in the backend, and in the interim the recommendation is to ignore the error "outcome unknown" and retry the request.

@JustinBeckwith
Copy link
Contributor

@snehashah16 do you have a bug on another public issue tracker the customer can follow? If there is no action item for this library, I'd prefer to not track it here :)

@crwilcox
Copy link
Contributor

crwilcox commented Jun 5, 2018

@snehashah16, just following up on this again, is there an ETA for a fix on the backend of this? Should we harden retry on the client anyway?

@crwilcox
Copy link
Contributor

crwilcox commented Jun 5, 2018

@JustinBeckwith adding a link to the back end issue: https://issuetracker.google.com/issues/90028517

@crwilcox
Copy link
Contributor

crwilcox commented Jun 5, 2018

Just spoke with a member of the Spanner team and they advised modifying the client to handle this particular error by retrying. The backend will be updated as well but they still would like the client to understand how to retry these types of failures.

@crwilcox crwilcox added priority: p0 Highest priority. Critical issue. P0 implies highest priority. and removed priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Jun 5, 2018
crwilcox added a commit that referenced this issue Jun 6, 2018
* fixes #202 by retrying on an UNKNOWN error code
@ghost ghost removed the priority: p0 Highest priority. Critical issue. P0 implies highest priority. label Jun 6, 2018
@crwilcox crwilcox mentioned this issue Jun 6, 2018
3 tasks
@crwilcox
Copy link
Contributor

crwilcox commented Jun 7, 2018

Fix released in https://www.npmjs.com/package/@google-cloud/spanner/v/1.4.3

@walshie4
Copy link
Author

walshie4 commented Jun 9, 2018

Still seeing this issue occasionally on v1.4.3, although they're now reported in a slightly different form with error code 4 and the message Deadline for Transaction exceeded..

@JustinBeckwith
Copy link
Contributor

@walshie4 Apologies. Thanks for reporting. Would you mind opening a new issue with the call stack? Also priority wise, is this more important than the other issues?

@walshie4
Copy link
Author

walshie4 commented Jun 9, 2018

@JustinBeckwith Sure thing. If the other issue you're referring to is issue #183, that is more important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/nodejs-spanner API. 🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

5 participants