技术堆栈:
Lambda
Dynomodb
DAX
amazon-dax-client
DAX查询:
const parameters = {
TableName: USER_TABLE,
....
};
const endpoint = DAX_CLUSTER_ENDPOINT;
const daxService = new AmazonDaxClient({ endpoints: [endpoint], region });
const daxClient = new AWS.DynamoDB.DocumentClient({ service: daxService });
response = await daxClient.query(parameters).promise();
API工作正常,但有时会抛出此错误
ERROR Failed to pull from my-dax-cluster.dax-clusters.xxxx.amazonaws.com (ip address.): TimeoutError: Connection timeout after 10000ms
at SocketTubePool.alloc (/var/task/node_modules/amazon-dax-client/src/Tube.js:244:64)
at /var/task/node_modules/amazon-dax-client/generated-src/Operations.js:215:30
在这个错误之后
{
"errorType": "Error",
"errorMessage": "Endpoint is unreachable: my-ip:9111. connect EMFILE my-ip:9111 - Local (undefined:undefined)",
"time": 1635838117288,
"retryable": true,
"requestId": null,
"statusCode": -1,
"_tubeInvalid": false,
"waitForRecoveryBeforeRetrying": false,
"stack": [
"Error: Endpoint is unreachable: my-ip:9111. connect EMFILE my-ip:9111 - Local (undefined:undefined)",
" at SocketTubePool.socketError (/var/task/node_modules/amazon-dax-client/src/Tube.js:290:11)",
" at TLSSocket.<anonymous> (/var/task/node_modules/amazon-dax-client/src/Tube.js:277:103)",
" at TLSSocket.emit (events.js:400:28)",
" at TLSSocket.emit (domain.js:470:12)",
" at emitErrorNT (internal/streams/destroy.js:106:8)",
" at emitErrorCloseNT (internal/streams/destroy.js:74:3)",
" at processTicksAndRejections (internal/process/task_queues.js:82:21)",
" at runNextTicks (internal/process/task_queues.js:64:3)",
" at listOnTimeout (internal/timers.js:526:9)",
" at processTimers (internal/timers.js:500:7)"
]
其他类似问题:
https://stackoverflow.com/questions/63587352/still-receiving-timeout-connects-using-js-dax-client-classified-as-an-error-but
Aws dax stability issues