Transaction fails due to exception in bounded C module ( JSON object key "maxTTL" not found )

Hello, all!

I’m trying to use SDK 4.0.0 transactions and encountering error in undergoing C module:
Here’s test code:

import {Cluster, DurabilityLevel} from 'couchbase';
/**
 * @typedef {Object} ServerEnv
 * @property {string} DB_HOST
 * @property {number} DB_PORT
 * @property {string} DB_USER
 * @property {string} DB_PASS
 */
/**
 * @typedef {Object} MyProcess
 * @property {ServerEnv} env
 */
/**
 * @type {MyProcess} process
 */
import process from 'process';

console.log('Connecting to Couchbase cluster at ' + process.env.DB_HOST + ':' + process.env.DB_PORT);
Cluster.connect(
	'couchbase://' + process.env.DB_HOST + ':' + process.env.DB_PORT,
	{
		username: process.env.DB_USER,
		password: process.env.DB_PASS,
		transactions: {
			durabilityLevel: DurabilityLevel.PersistToMajority
		}
	}
)
	.then(cluster => {
		console.log('Successfully connected to Couchbase cluster.');
		cluster.transactions().run(function (ctx) {
		})
			.then(function () {
				console.log('Transaction succeed');
			})
			.catch(function (error) {
				console.log({'Transaction failed' : error});
			});
	})
	.catch(reason => console.log('Connection failure: ' + reason));

And here’s result of running it:

/app $ node tests/test_transaction.js 
Connecting to Couchbase cluster at econ-db:11210
Successfully connected to Couchbase cluster.
Transaction succeed
terminate called after throwing an instance of 'std::out_of_range'
  what():  JSON object key "maxTTL" not found
Aborted (core dumped)

Did anyone encountered this problem? Probably someone could suggest a workaround?

Hi @scruoge

Would you be able to turn on debug logging by setting the CBPPLOGLEVEL=trace environment variable. Also, which Couchbase server version are you using?

I’m using docker image tagged “couchbase:community” which currently holds couchbase-server-community_7.0.2, and it reports version “Community Edition 7.0.2 build 6703” in the UI.
as for node version:

/app $ node --version
v16.14.2

exception trace:

/app $ CBPPLOGLEVEL=trace node tests/test_transaction.js 
Connecting to Couchbase cluster at econ-db:11210
[2022-03-29 12:00:06.235] [146,157] [warning] 74ms, DNS SRV query returned 0 records for "econ-db", assuming that cluster is listening this address
[2022-03-29 12:00:06.235] [146,157] [debug] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db:11210> attempt to establish MCBP connection
[2022-03-29 12:00:06.236] [146,157] [debug] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db:11210> connecting to 172.17.21.98:11210
[2022-03-29 12:00:06.236] [146,157] [debug] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db:11210> connected to 172.17.21.98:11210
[2022-03-29 12:00:06.236] [146,157] [debug] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> user_agent={"a":"cxx/1.0.0/7f07e53;couchnode%2F4.0.0%20(node%2F16.14.2%3B%20v8%2F9.4.146.24-node.20%3B%20ssl%2F1.1.1n%2Bquic)","i":"fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a"}, requested_features=[tcp_nodelay, mutation_seqno, xattr, xerror, select_bucket, json, duplex, alt_request_support, tracing, sync_replication, vattr, collections, subdoc_create_as_deleted, preserve_ttl, unordered_execution, clustermap_change_notification, snappy]
[2022-03-29 12:00:06.236] [146,157] [trace] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> MCBP send, opaque=1,  80 1f 00 c4 00 00 00 00 00 00 00 e6 01 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:00:06.236] [146,157] [trace] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> MCBP send, opaque=2,  80 20 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:00:06.236] [146,157] [trace] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> MCBP send, opaque=3,  80 21 00 0c 00 00 00 00 00 00 00 54 03 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:00:06.237] [146,157] [trace] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> MCBP recv, opaque=1,  81 1f 00 00 00 00 00 00 00 00 00 20 01 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:00:06.237] [146,157] [debug] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> supported_features=[tcp_nodelay, mutation_seqno, xattr, xerror, select_bucket, snappy, json, duplex, clustermap_change_notification, unordered_execution, alt_request_support, sync_replication, collections, preserve_ttl, vattr, subdoc_create_as_deleted]
[2022-03-29 12:00:06.237] [146,157] [trace] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> MCBP recv, opaque=2,  81 20 00 00 00 00 00 00 00 00 00 2a 02 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:00:06.237] [146,157] [trace] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> MCBP recv, opaque=3,  81 21 00 00 00 00 00 21 00 00 00 ad 03 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:00:06.237] [146,157] [trace] 0ms, decoding attribute list [r=0x1a 0x20 0x46 0xfffffffe 0x72 0xffffffbe 0x3a 0xffffffdcc4b503068789a9ba,s=jjShTuczzNhG6snpceU1yM0Qe0OQzwZ5us7HDgYsx3ZdPCYw1JcEJvJfH9lBpuGZSN80eVmbTbjW940PG9y8VQ==,i=4000]
[2022-03-29 12:00:06.250] [146,157] [trace] 12ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> MCBP send, opaque=4,  80 22 00 0c 00 00 00 00 00 00 00 b9 04 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:00:06.251] [146,157] [trace] 1ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> MCBP recv, opaque=4,  81 22 00 00 00 00 00 00 00 00 00 5a 04 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:00:06.251] [146,157] [trace] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> MCBP send, opaque=5,  80 fe 00 00 00 00 00 00 00 00 00 02 05 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:00:06.251] [146,157] [trace] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> MCBP send, opaque=6,  80 b5 00 00 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:00:06.252] [146,157] [trace] 1ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> MCBP recv, opaque=5,  81 fe 00 00 00 01 00 00 00 00 35 5f 05 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:00:06.253] [146,157] [trace] 1ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> MCBP recv, opaque=6,  81 b5 00 00 00 01 00 00 00 00 01 92 06 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:00:06.254] [146,157] [debug] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> received new configuration: #<config:f101c6fd-3f86-4e13-0882-0584a89407fb rev=1:41, nodes(1)=[#<node:0 hostname="cb.econ.local", plain=(kv=11210, mgmt=8091, fts=8094, n1ql=8093, capi=8092), tls=(), alt=[]>], bucket_caps=[], cluster_caps=[n1ql_enhanced_prepared_statements]>
[2022-03-29 12:00:06.254] [146,157] [debug] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> detected network is "default"
[2022-03-29 12:00:06.254] [146,157] [trace] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> MCBP send, opaque=7,  80 b5 00 00 00 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:00:06.254] [146,157] [trace] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> MCBP recv, opaque=7,  81 b5 00 00 00 01 00 00 00 00 01 92 07 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:00:06.255] [146,157] [trace] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/fc65b6bb-fd96-4ced-e39a-d6c5338a3b2a/plain/-] <econ-db/172.17.21.98:11210> received a configuration with identical revision (rev=1:41), ignoring
Successfully connected to Couchbase cluster.
[2022-03-29 12:00:06.259] [146,159] [debug] 98ms, cleanup attempts loop starting...
[2022-03-29 12:00:06.259] [146,146] [info] 98ms, couchbase transactions 2.0.0.beta.3-d3b234e creating new transaction object
[2022-03-29 12:00:06.260] [146,160] [info] 99ms, 0x7fcb4a8eedd0 starting lost attempts loop
[2022-03-29 12:00:06.261] [146,160] [trace] 6ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/6b61e48f-332a-4adc-779a-7562aafcdcd5] HTTP request: mgmt, method=GET, path="/pools/default/buckets", client_context_id="51d25c7d-90f9-4531-d31d-404639ab5712", timeout=75000ms
[2022-03-29 12:00:06.262] [146,161] [trace] 2ms, [645ce31c-4e72-48d2-e979-4ca7c4274e82/fd97aa78-80db-4316-0b9b-663d9da28765]:added new attempt, state NOT_STARTED, expiration in 14998ms
[2022-03-29 12:00:06.265] [146,161] [info] 3ms, starting attempt 1/645ce31c-4e72-48d2-e979-4ca7c4274e82/fd97aa78-80db-4316-0b9b-663d9da28765/
[2022-03-29 12:00:06.266] [146,162] [debug] 1ms, [645ce31c-4e72-48d2-e979-4ca7c4274e82/fd97aa78-80db-4316-0b9b-663d9da28765]:waiting on ops to finish...
[2022-03-29 12:00:06.266] [146,162] [debug] 0ms, [645ce31c-4e72-48d2-e979-4ca7c4274e82/fd97aa78-80db-4316-0b9b-663d9da28765]:commit fd97aa78-80db-4316-0b9b-663d9da28765
[2022-03-29 12:00:06.267] [146,162] [debug] 0ms, [645ce31c-4e72-48d2-e979-4ca7c4274e82/fd97aa78-80db-4316-0b9b-663d9da28765]:calling commit on attempt that has got no mutations, skipping
Transaction succeed
[2022-03-29 12:00:06.262] [146,157] [debug] 0ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/6b61e48f-332a-4adc-779a-7562aafcdcd5] connecting to 172.17.21.98:8091
[2022-03-29 12:00:06.269] [146,159] [info] 9ms, stopping - 0 entries on queue
[2022-03-29 12:00:06.269] [146,146] [info] 0ms, cleanup attempt thread closed
[2022-03-29 12:00:06.270] [146,157] [debug] 8ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/6b61e48f-332a-4adc-779a-7562aafcdcd5] connected to 172.17.21.98:8091
[2022-03-29 12:00:06.278] [146,157] [trace] 8ms, [fce2163a-52f9-48f6-1e9a-00d1769bfcb8/6b61e48f-332a-4adc-779a-7562aafcdcd5] <172.17.21.98:8091> HTTP response: mgmt, client_context_id="51d25c7d-90f9-4531-d31d-404639ab5712", status=200, body=[hidden]
terminate called after throwing an instance of 'std::out_of_range'
  what():  JSON object key "maxTTL" not found
Aborted (core dumped)

Hmm… I didn’t notice - seems transaction has actually succeeded, however, core-dumped is not the result I’ve expected ))

When using transactions, part of the process involves fetching a list of buckets. There is a bug when doing that on the community edition. You can follow the progress of the ticket here https://issues.couchbase.com/browse/CXXCBC-155. As a temporary workaround you can use the enterprise edition which is free to use during development (https://www.couchbase.com/licensing-and-support-faq). You can then switch back once the bug is fixed.

Thanks a lot!
Will try and report the result!

Migration to enterprize versison didn’t help.
CB version reported in UI: Enterprise Edition 7.0.3 build 7032

/app $ CBPPLOGLEVEL=trace node tests/test_transaction.js 
Connecting to Couchbase cluster at econ-db:11210
[2022-03-29 12:48:33.369] [133,144] [warning] 23ms, DNS SRV query returned 0 records for "econ-db", assuming that cluster is listening this address
[2022-03-29 12:48:33.369] [133,144] [debug] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db:11210> attempt to establish MCBP connection
[2022-03-29 12:48:33.369] [133,144] [debug] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db:11210> connecting to 172.17.21.114:11210
[2022-03-29 12:48:33.369] [133,144] [debug] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db:11210> connected to 172.17.21.114:11210
[2022-03-29 12:48:33.369] [133,144] [debug] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> user_agent={"a":"cxx/1.0.0/7f07e53;couchnode%2F4.0.0%20(node%2F16.14.2%3B%20v8%2F9.4.146.24-node.20%3B%20ssl%2F1.1.1n%2Bquic)","i":"686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919"}, requested_features=[tcp_nodelay, mutation_seqno, xattr, xerror, select_bucket, json, duplex, alt_request_support, tracing, sync_replication, vattr, collections, subdoc_create_as_deleted, preserve_ttl, unordered_execution, clustermap_change_notification, snappy]
[2022-03-29 12:48:33.369] [133,144] [trace] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> MCBP send, opaque=1,  80 1f 00 c4 00 00 00 00 00 00 00 e6 01 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:48:33.369] [133,144] [trace] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> MCBP send, opaque=2,  80 20 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:48:33.369] [133,144] [trace] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> MCBP send, opaque=3,  80 21 00 0c 00 00 00 00 00 00 00 5a 03 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:48:33.370] [133,144] [trace] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> MCBP recv, opaque=1,  81 1f 00 00 00 00 00 00 00 00 00 20 01 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:48:33.370] [133,144] [debug] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> supported_features=[tcp_nodelay, mutation_seqno, xattr, xerror, select_bucket, snappy, json, duplex, clustermap_change_notification, unordered_execution, alt_request_support, sync_replication, collections, preserve_ttl, vattr, subdoc_create_as_deleted]
[2022-03-29 12:48:33.370] [133,144] [trace] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> MCBP recv, opaque=2,  81 20 00 00 00 00 00 00 00 00 00 2a 02 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:48:33.370] [133,144] [trace] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> MCBP recv, opaque=3,  81 21 00 00 00 00 00 21 00 00 00 b3 03 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:48:33.370] [133,144] [trace] 0ms, decoding attribute list [r=0x3e 0x2e 0xffffffe6 0x2b 0x11 0xffffff9f 0xffffff83 0xffffffb20ee3d70e03d10d8d,s=jjShTuczzNhG6snpceU1yM0Qe0OQzwZ5us7HDgYsx3ZdPCYw1JcEJvJfH9lBpuGZSN80eVmbTbjW940PG9y8VQ==,i=4000]
[2022-03-29 12:48:33.372] [133,144] [trace] 2ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> MCBP send, opaque=4,  80 22 00 0c 00 00 00 00 00 00 00 bf 04 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:48:33.372] [133,144] [trace] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> MCBP recv, opaque=4,  81 22 00 00 00 00 00 00 00 00 00 5a 04 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:48:33.373] [133,144] [trace] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> MCBP send, opaque=5,  80 fe 00 00 00 00 00 00 00 00 00 02 05 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:48:33.373] [133,144] [trace] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> MCBP send, opaque=6,  80 b5 00 00 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:48:33.373] [133,144] [trace] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> MCBP recv, opaque=5,  81 fe 00 00 00 01 00 00 00 00 35 5f 05 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:48:33.373] [133,144] [trace] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> MCBP recv, opaque=6,  81 b5 00 00 00 01 00 00 00 00 01 92 06 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:48:33.373] [133,144] [debug] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> received new configuration: #<config:aa44ff9c-5c6e-4e67-0d78-b5f6fe497392 rev=1:65, nodes(1)=[#<node:0 hostname="cb.econ.local", plain=(kv=11210, mgmt=8091, fts=8094, n1ql=8093, capi=8092), tls=(), alt=[]>], bucket_caps=[], cluster_caps=[n1ql_enhanced_prepared_statements]>
[2022-03-29 12:48:33.373] [133,144] [debug] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> detected network is "default"
[2022-03-29 12:48:33.373] [133,144] [trace] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> MCBP send, opaque=7,  80 b5 00 00 00 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:48:33.373] [133,144] [trace] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> MCBP recv, opaque=7,  81 b5 00 00 00 01 00 00 00 00 01 92 07 00 00 00 00 00 00 00 00 00 00 00
[2022-03-29 12:48:33.373] [133,144] [trace] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/b4fad931-a6cf-4e35-e24f-e5500915b919/plain/-] <econ-db/172.17.21.114:11210> received a configuration with identical revision (rev=1:65), ignoring
Successfully connected to Couchbase cluster.
[2022-03-29 12:48:33.375] [133,133] [info] 30ms, couchbase transactions 2.0.0.beta.3-d3b234e creating new transaction object
[2022-03-29 12:48:33.375] [133,147] [info] 30ms, 0x7f89ca3d1140 starting lost attempts loop
[2022-03-29 12:48:33.375] [133,147] [trace] 1ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/210e33b5-a56d-470a-cbf9-1de7880e0b24] HTTP request: mgmt, method=GET, path="/pools/default/buckets", client_context_id="cdaf220b-6a7c-4507-d27d-563ae6d6f1b5", timeout=75000ms
[2022-03-29 12:48:33.376] [133,144] [debug] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/210e33b5-a56d-470a-cbf9-1de7880e0b24] connecting to 172.17.21.114:8091
[2022-03-29 12:48:33.376] [133,144] [debug] 0ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/210e33b5-a56d-470a-cbf9-1de7880e0b24] connected to 172.17.21.114:8091
[2022-03-29 12:48:33.376] [133,148] [trace] 0ms, [edb94ce3-52b9-4b57-bfd3-36e96a4ad801/db2d1652-5795-4e4e-8fbb-226ee9f85ff9]:added new attempt, state NOT_STARTED, expiration in 14999ms
[2022-03-29 12:48:33.376] [133,148] [info] 0ms, starting attempt 1/edb94ce3-52b9-4b57-bfd3-36e96a4ad801/db2d1652-5795-4e4e-8fbb-226ee9f85ff9/
[2022-03-29 12:48:33.382] [133,133] [debug] 6ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/ec948960-0757-4151-5017-0e5c946bf4cc/plain/undefined] <econ-db:11210> attempt to establish MCBP connection
[2022-03-29 12:48:33.383] [133,133] [trace] 7ms, op count changed by 1 to 1, 1 in_flight
[2022-03-29 12:48:33.383] [133,133] [trace] 0ms, [edb94ce3-52b9-4b57-bfd3-36e96a4ad801/db2d1652-5795-4e4e-8fbb-226ee9f85ff9]:first mutated doc in transaction is "/_default._default/new_key" on vbucket 913, so using atr "/_default._default/_txn:atr-913-#b0b"
[2022-03-29 12:48:33.383] [133,133] [debug] 0ms, [edb94ce3-52b9-4b57-bfd3-36e96a4ad801/db2d1652-5795-4e4e-8fbb-226ee9f85ff9]:updating atr /_default._default/_txn:atr-913-#b0b
[2022-03-29 12:48:33.383] [133,133] [trace] 0ms, [edb94ce3-52b9-4b57-bfd3-36e96a4ad801/db2d1652-5795-4e4e-8fbb-226ee9f85ff9]:got bucket_not_found trying to set atr to pending
[2022-03-29 12:48:33.385] [133,144] [trace] 2ms, [686de549-a21f-42e0-b30e-ed1221dd9b21/210e33b5-a56d-470a-cbf9-1de7880e0b24] <172.17.21.114:8091> HTTP response: mgmt, client_context_id="cdaf220b-6a7c-4507-d27d-563ae6d6f1b5", status=200, body=[hidden]
[2022-03-29 12:48:33.389] [133,146] [debug] 43ms, cleanup attempts loop starting...
[2022-03-29 12:48:33.407] [133,133] [trace] 23ms, in_flight decremented to 0
[2022-03-29 12:48:33.407] [133,133] [trace] 0ms, op count changed by -1 to 0, 0 in_flight
[2022-03-29 12:48:33.411] [133,133] [error] 3ms, got transaction_operation_failed bucket_not_found
[2022-03-29 12:48:33.411] [133,133] [trace] 0ms, got rollback-able exception, rolling back
[2022-03-29 12:48:33.411] [133,133] [debug] 0ms, [edb94ce3-52b9-4b57-bfd3-36e96a4ad801/db2d1652-5795-4e4e-8fbb-226ee9f85ff9]:rolling back db2d1652-5795-4e4e-8fbb-226ee9f85ff9
[2022-03-29 12:48:33.411] [133,133] [debug] 0ms, [edb94ce3-52b9-4b57-bfd3-36e96a4ad801/db2d1652-5795-4e4e-8fbb-226ee9f85ff9]:rollback called on txn with no mutations
[2022-03-29 12:48:33.411] [133,133] [trace] 21ms, attempt in state NOT_STARTED, not adding to cleanup
terminate called after throwing an instance of 'std::out_of_range'
  what():  JSON object key "maxTTL" not found
Aborted (core dumped)

Note that after I added inserting in a transaction - no “transaction succeed” message appear in the log.

updated test code:

import {Cluster, DurabilityLevel} from 'couchbase';
/**
 * @typedef {Object} ServerEnv
 * @property {string} DB_HOST
 * @property {number} DB_PORT
 * @property {string} DB_USER
 * @property {string} DB_PASS
 * @property {string} DB_BUCKET
 */
/**
 * @typedef {Object} MyProcess
 * @property {ServerEnv} env
 */
/**
 * @type {MyProcess} process
 */
import process from 'process';

console.log('Connecting to Couchbase cluster at ' + process.env.DB_HOST + ':' + process.env.DB_PORT);
Cluster.connect(
	'couchbase://' + process.env.DB_HOST + ':' + process.env.DB_PORT,
	{
		username: process.env.DB_USER,
		password: process.env.DB_PASS,
		transactions: {
			durabilityLevel: DurabilityLevel.PersistToMajority
		}
	}
)
	.then(cluster => {
		console.log('Successfully connected to Couchbase cluster.');
		cluster.transactions().run(function (ctx) {
			ctx.insert(
				cluster.bucket(process.env.DB_TEST_BUCKET).defaultCollection(),
				'new_key',
				{key1: 'value1', key2: {key3: 'value3'}}
			)
				.then(function (res) {
					console.log({'Insert succeeded': res});
				})
				.catch(function (error) {
					console.log({'Insert failed': error});
				});
		})
			.then(function () {
				console.log('Transaction succeed');
			})
			.catch(function (error) {
				console.log({'Transaction failed' : error});
			});
	})
	.catch(reason => console.log('Connection failure: ' + reason));

Is it possible you still have a 7.0.2 community edition node as part of the cluster? I was able to reproduce the issue on community but not enterprise edition.

That’s not exactly right. I’ve just replaced docker image and thought that’s enough (enterprise CB was running on a community data volume). That’s must be an issue.

After I’ve re-created enterprize cluster from scratch - transactions started to work fine!
Thanks a lot.

1 Like

Hey @scruoge ,

As a side-note, I have filed an issue to cover the improvement of this error message so that the lack of support is more straightforward to recognize:
https://issues.couchbase.com/browse/TXNCXX-245

Cheers, Brett

1 Like