google spanner close connection - node.js

I running my api based on swagger and node.
When my api is running for few minutes without a request and then i send an api request to it, I got this error:
{ Error: {"created":"#1488097564.272436000","description":"Delayed close due to in-progress write","file":"../src/core/ext/transport/chttp2/transport/chttp2_transport.c","file_line":406,"grpc_status":14,"referenced_errors":[{"created":"#1488097564.272434000","description":"Endpoint read failed","file":"../src/core/ext/transport/chttp2/transport/chttp2_transport.c","file_line":1851,"occurred_during_write":1,"referenced_errors":[{"created":"#1488097564.272350000","description":"Secure read failed","file":"../src/core/lib/security/transport/secure_endpoint.c","file_line":166,"referenced_errors":[{"created":"#1488097564.272347000","description":"Socket closed","fd":24,"file":"../src/core/lib/iomgr/tcp_posix.c","file_line":249,"target_address":"ipv4:172.217.19.10:443"}]}]}]}
at ClientReadableStream._emitStatusIfDone (/Users/aronsuarez/Code/asate/admin-apis/wiki-admin-api/node_modules/grpc/src/node/src/client.js:201:19)
at ClientReadableStream._readsDone (/Users/aronsuarez/Code/asate/admin-apis/wiki-admin-api/node_modules/grpc/src/node/src/client.js:169:8)
at readCallback (/Users/aronsuarez/Code/asate/admin-apis/wiki-admin-api/node_modules/grpc/src/node/src/client.js:242:12) code: 14, metadata: Metadata { _internal_repr: {} } }
I think google spanner is closing the connection, why and how can prevent it from to that?
The only way that i see in the docs is to send periodically a SELECT 1 request to spanner.
Is this correct?
Thanks for help

Related

POST to Bot timed out after 15s

Sometimes I am getting timeout error from my bot. Getting timeout for the first response itself.
Is there any option to increase that 15 seconds time?
Also, is there any option to skip this timeout issue?
Exception type : Microsoft.Bot.Schema.BotTimeoutException
Failed method : Microsoft.Bot.ChannelConnector.BotAPI+d__31.MoveNext
It is bot using C# and directlinechannel.
Please let me know if you need any other information
This is a problem in the Bot Framework, the direct line connection will timeout in 15s and currently there is no way to suppress it, check the following thread.
https://github.com/microsoft/botframework-sdk/issues/3220
this type of enforcement to make the bot more active and force to make faster bots.
same goes for Google's Dialog flow which timeouts at 5 seconds and Alexa Skill which timeouts at 8 seconds, so 15 second for Bot Framework is generous :P
You need to handle this with Periodic refresh token
var credentials = new MicrosoftAppCredentials(appID, appPassword);
Task.Factory.StartNew(async () =>
{
while (!_getTokenAsyncCancellation.IsCancellationRequested)
{
try{
var token = await credentials.GetTokenAsync().ConfigureAwait(false);
}
catch(MicrosoftAppCredentials.OAuthException ex)
{
Trace.TraceError(ex.message);
}
await Task.Delay(TimeSpan.FromMinutes(30), _getTokenAsyncCancellation.Token).ConfigureAwait(false);
}
}).ConfigureAwait(false);

Error: Request unsafe for browser client domain: dialogflow.googleapis.com

I'm setting up a DialogFlow wrapper and I'm using the DialogFlow JavaScript SDK. But, I'm getting the following error:
Error: Request unsafe for browser client domain:
dialogflow.googleapis.com
This was working before, but I'm not sure why it suddenly stopped working.
I've tried reverting all code to a version that worked. I'm sure it's a DialogFlow error.
const intentDetectResponse = await sessionClient.detectIntent(request)
The complete error log is as follows:
{ Error: Request unsafe for browser client domain: dialogflow.googleapis.com
at Http2CallStream.call.on (/Users/NewProject/node_modules/#grpc/grpc-js/build/src/client.js:101:45)
at Http2CallStream.emit (events.js:194:15)
at process.nextTick (/Users/NewProject/node_modules/#grpc/grpc-js/build/src/call-stream.js:71:22)
at process.internalTickCallback (internal/process/next_tick.js:70:11)
code: 3,
details:
'Request unsafe for browser client domain: dialogflow.googleapis.com',
metadata:
Metadata {
options: undefined,
internalRepr: Map { 'grpc-server-stats-bin' => [Array] } } }
Pretty sure this is something wrong with dialogflow service. This is not the first time dialogflow facing some issues.
Pretty sure something is wrong with one of their servers behind the load balancer. If you try multiple times, sometimes a request can get through. But it should most definitely be a dialogflow api server issue.
It was issue from Dialogflow side, their technical team worked on it and resolved it. However they did not tell exactly what was the actual issue.
There is github issue as well for the same.
I think it's a rate limit of the Dialogflow API? I had the same error with a python script, after a few minutes it worked fine...
Says here there is a limit for 60 requests per minute.

Dialog flow Web hook time out

I am creating agent using dialogflow with webhook. Facing problem in webhook timeout:
webhook_status { code: 4 message: "Webhook call failed. Error: Request
timeout." }
kindly help me to increase webhook timeout time.
There is no way you can increase Time Out for webhook. Your webhook should respond back within 5 seconds (see Limits here)

How do I roll-back a message to Amazon MQ (AMQ) from Lambda?

So, I assume this relates to any Node.js and Active MQ installation but I am using Amazon MQ with Node.js Lambda...
Kind of a noob on ActiveMQ so please correct me where I am wrong!
After reading a message from a queue using stompit I continue processing the message and it shall then be sent over HTTPS to another server.
There is some message validation and enrichment happening on the way to the HTTPS POST, and of course the POST itself can result in an error.
How would I (best) handle a roll-back of the message in case of an error:
1) Keep the connection open and not send client.ack() until I finally got a HTTP 200 back from remote server?
2) Keep the message in a variable and put it back in case of error (sequence doesn't matter?
3) Use something other than stomp?
It is apparently not possible using STOMP so I've changed the code to use the library ampq10 instead.
import amqp10 from 'amqp10';
const AMQPClient = amqp10.Client;
const amqpClient = new AMQPClient({
receiverLink: {
attach: {
rcvSettleMode: amqp10.Constants.receiverSettleMode.settleOnDisposition
},
creditQuantum: 1
}
});
This will allow you to do a receiver.accept(message); if successfully handling the message. If you just .disconnect() whitout an .accept() the message will not be removed from the queue.

OpenDaylight Flow statistics using RPC call

I'm trying to get statistics using the following RPC call and not via the default statistics-manager.
POST / restconf / operations / opendaylight - flow - statistics: get - all - flows - statistics - from - all - flow - tables {
"input": {
"node": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id=\"openflow:1000\"]"
}
}
However, the response of this request is just transaction-id. While I can see the OpenFlow Flow Stat Request and Flow Stat Reply messages are exchanged between the controller and the switch, the operational datastore seems not to be updated as a result of calling the above RPC. I check the operational datastore using:
GET /restconf/operational/opendaylight-inventory:nodes/node/openflow:1000/table/0
My question is:
How can I get the flow statistics sent to the controller by the switch as a result of the above RPC (get-all-flows-statistics-from-all-flow-tables)? And why is the operational datastore is not updated?
Thanks! Michael.
Using Boron, what you're trying to use is deprecated, hence you should use the following:
Install odl-openflowplugin-flow-services
Connect your switch
Send the following request:
POST /restconf/operations/opendaylight-direct-statistics:get-node-connector-statistics
Host: localhost:8181
Content-Type: application/json
Authorization: Basic YWRtaW46YWRtaW4=
{
"input":
{
"node" : "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id=\"openflow:187811733353539\"]" ,
"store-stats" : false
}
}
Set store-stats to true if you want to keep them in the datastore.
You can also get the stats only for a specified port, but while trying, it appears not to be working well
Add this to the above payload:
"node-connector-id" : "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id=\"openflow:187811733353539\"]/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:187811733353539:LOCAL']",
Instead of LOCAL, specify the port you want.
Hope this helps,
Alexis

Resources