I am trying to deploy a Keras model but getting an error. My code is
service = Webservice.deploy_from_model(workspace = ws,
name = "test-classifier",
deployment_config = aciconfig,
models = [model],
image_config = image_config)
service.wait_for_deployment(show_output = True)
Error:
{
"code": "GatewayTimeout",
"statusCode": 504,
"message": "ACI Service request failed. Reason: The gateway did not receive a response from 'Microsoft.ContainerInstance' within the specified time period.."
}
Why am I getting this error?
The default timeout is 1 minute.You can increase the timeout or try to speed up the service by modifying the score.py to remove unnecessary calls. If these actions do not correct the problem, use the information in this article to debug the score.py file. The code may be in a non-responsive state or an infinite loop.
Related
I use CosmosClient from SDK Microsoft.Azure.Cosmos 3.28.0 in ASP.NET Core 3.1 in Azure Durable Function. This client is getting and sending data from/to my cosmos instance (Core (SQL)) and it works fine but I see that it constantly throws exception in following http request for metadata
GET 169.254.169.254/metadata/instance
System.Net.Http.HttpRequestException: An attempt was made to access a socket in a way forbidden by its access permissions.
I use following configuration:
private static void RegisterCosmosDbClient(ContainerBuilder builder)
{
builder.Register(c => new SocketsHttpHandler()
{
PooledConnectionLifetime = TimeSpan.FromMinutes(10), // Customize this value based on desired DNS refresh timer
MaxConnectionsPerServer = 20, // Customize the maximum number of allowed connections
}).As<SocketsHttpHandler>().SingleInstance();
builder.Register(
x =>
{
var cosmosDbOptions = x.Resolve<CosmosDbOptions>();
var socketsHttpHandler = x.Resolve<SocketsHttpHandler>();
return new CosmosClient(cosmosDbOptions.ConnectionString, new CosmosClientOptions()
{
ConnectionMode = ConnectionMode.Direct,
PortReuseMode = PortReuseMode.PrivatePortPool,
IdleTcpConnectionTimeout = new TimeSpan(0, 23, 59, 59),
SerializerOptions = new CosmosSerializationOptions()
{
PropertyNamingPolicy = CosmosPropertyNamingPolicy.CamelCase
},
HttpClientFactory = () => new HttpClient(socketsHttpHandler, disposeHandler: false)
});
})
.AsSelf()
.SingleInstance();
}
I also tried approach with passing IHttpClientFactory from this blog but it didn't help.
It looks like there are no new sockets available in your environment therefore you are getting the socket forbidden error. Please review how to manage connection for Azure Cosmos DB clients and you should use a singleton Azure Cosmos DB client for the lifetime of your application to resolve the issue. In case if you still facing the issue leveraging the singleton object then please let me know so we can further review it.
That particular IP and path is for https://learn.microsoft.com/azure/virtual-machines/windows/instance-metadata-service?tabs=windows
The SDK is attempting to detect the Azure information. It could mean for Durable Functions, this information and endpoint is not available.
This does not affect SDK operations and should not block you from performing other actions on the CosmosClient instance.
I’ve been having an issue with a long running Azure Function App. It’s basically reads in a pipe delimeted file, creates an Employee object from the values, get the corresponding employee database record, and do a database insert or update.
Since it’s taking so long and spiking the CPU, some suggested that I read in each line of the file and send it to a Service Bus. Then have another function inside of my Function App to read from the queue and do my record comparison.
I’ve never used Service Bus before but went through and set one up in Azure. Now I’m trying to use the ServiceBus output binding in my Function App to send the message but I’m not getting it to work. I’ve been following along with some different articles I found including the following ones from Microsoft.
https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus-output?tabs=in-process%2Cextensionv5&pivots=programming-language-csharp#example
https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus?tabs=in-process%2Cextensionv5%2Cextensionv3&pivots=programming-language-csharp
I have the ServiceBusConnection added to my local.settings.json file. I pulled the connection string from the Azure Service Bus "Shared Access policies" section. I double checked the settings and made sure that the property name is correct. However, since the connection string is in the return section I don't know how to debug and confirm it's actually pulling the connection string and that it is correct.
This is what I’ve come up with so far but I’m not seeing any messages in my queue.
[FunctionName("ProcessEmployeeInput")]
[return: ServiceBus("myQueueName", Connection = "ServiceBusConnection")]
public string Run(
[BlobTrigger("%InputContainer%/%InputFolder%/{name}.txt", Connection = "StorageConnection")] Stream fileBlob, string name, ILogger log)
{
log.LogInformation($"Azure Function START.");
log.LogInformation($"Processing file {name}.");
string jsonEmployee = string.Empty;
try
{
using (var srFile = new StreamReader(fileBlob))
{
srFile.ReadLine(); //first line is a header. Just call ReadLine to skip past it.
while (!srFile.EndOfStream)
{
var record = srFile.ReadLine();
//Create an Employee object and map the properties.
Employee employee = MapEmployeeProperties(record, log);
//Serialize into text before sending to service bus
jsonEmployee = JsonConvert.SerializeObject(employee);
}
}
}
catch (Exception ex)
{
log.LogError("Error processing file. {0} | {1} | {2}", ex.Message, ex.StackTrace, ex.InnerException);
}
return jsonEmployee;
}
Error Message
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
I didn't see this at first but from this message it sounds like it can't find the Service Bus endpoint. Since the connection is in the output binding, I can confirm it can find it and that it is correct.
Glad that #Caverman for solved the issue. Thank you #Jesse Squire for your suggestions that helped to fix the issue. Posting this on behalf of your discussion so that it will be beneficial for other community members.
Workaround:-
To resolve the above issue make sure that we have following in our host.json file and the nuget package
Azure.Messaging.ServiceBus is installed in the environment.
host.json file example:-
{
"version": "2.0",
"extensions": {
"serviceBus": {
"clientRetryOptions":{
"mode": "exponential",
"tryTimeout": "00:01:00",
"delay": "00:00:00.80",
"maxDelay": "00:01:00",
"maxRetries": 3
},
"prefetchCount": 0,
"transportType": "amqpWebSockets",
"webProxy": "https://proxyserver:8080",
"autoCompleteMessages": true,
"maxAutoLockRenewalDuration": "00:05:00",
"maxConcurrentCalls": 16,
"maxConcurrentSessions": 8,
"maxMessageBatchSize": 1000,
"sessionIdleTimeout": "00:01:00",
"enableCrossEntityTransactions": false
}
}
}
For more information please refer this MICROSOFT DOCUMENTATION FAQ .
I am trying to import ibm-cos-bucket and cos-instance from IBM cloud. I am able to import cos-instance however, getting error while importing ibm-cos-bucket.
Error: rpc error: code = Unavailable desc = transport is closing
*[ERROR] : eval: *terraform.EvalRefresh, err: rpc error: code = Unavailable desc = transport is closing
[ERROR] : eval: terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
[WARN] plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
[DEBUG] plugin: plugin exited
panic: runtime error: index out of range [1] with length 1
Terraform crashed!!!
here is sample resource block:-
resource "ibm_cos_bucket" "mybucket" {}
Please help me in this regards.
Thanks in advance!
Are you using CRN or ID for import?
According to doc's ID must be used.
id = $CRN:meta:$buckettype:$bucketlocation
ID can be easily find by using data. Here is an example.
data "ibm_cos_bucket" "my-bucket" {
bucket_name = "my-bucket"
resource_instance_id = data.ibm_resource_instance.my-resource.id
bucket_region = "us-south"
bucket_type = "region_location"
}
output "bucket-info" {
value = data.ibm_cos_bucket.my-bucket.id
}
This seems to be a fault/bug of IBM provider. Simillar issue for aws is here.
Thus, you can report the problem by making the issue on IBM provider's github:
https://github.com/IBM-Cloud/terraform-provider-ibm/issues
I have HttpHandler (abc.ashx), which I make a call to process (Bulk Upload) an excel file. This processing takes a certain amount of time, which is proportionate to the number of rows in the excel.
On top of this I have an Event Handler in Sharepoint which uses a WebClient to make a post service call to this handler using the code below;
NOTE: I generate an identity token using elevated privilege of Sharepoint, and use that token to impersonate to make the service call. net net I make the post service call using the identity of the System Account.
WindowsIdentity identity = null;
// Get an identity token using delegate activity of Elevated Privelleges of Sharepoint
SPHelper.ElevatedActivity(properties.Web.Site.Url, properties.Web.ServerRelativeUrl, web =>
{
identity = WindowsIdentity.GetCurrent();
});
//Impersonates the identity of System Account user, as received in token in the line above
using (identity.Impersonate())
{
// create a web client object which only increases the timeout of the web client call
var webClient = (new CustomWebClient());
webClient.Credentials = CredentialCache.DefaultNetworkCredentials;
webClient.UseDefaultCredentials = true;
//url of the httphandler as deployed in sharepoint, and the parameters that needs to be passed
string handlerUrl =
string.Format(
properties.Web.Url.Trim('/') + "/_layouts/Handlers/abc.ashx?Table=BulkUpload&Region={0}&UserId={1}&BatchId={2}&FileUrl={3}",
region, userValue.User.LoginName, batchId, fileUrl);
}
// execute the web service call using the webclient object
webClient.DownloadString(handlerUrl));
Essentially this code is written in the Event Handler for ItemAdded and ItemUpdated event.
The issue is in the webClient which seems to give an error "system.net.webexception: the remote server returned an error: (401) unauthorized", after precisely 5 mins of processing. Hence if the excel sheet to be processed has rows less than certain number (1700), the processing happens within 5 minutes, and everything runs fine without any error. However if it has more than that, then the processing takes more than 5 minutes, and fails with the error specificed above.
The strange behaviour is it seems like a timeout issue but the error message indicates authorization issue, which does not make sense, as if there was an authorization issue, it shouldnt have worked even when the processing time was less that 5 minutes.
We have tried to find any configuration that times out in 5 minutes, however we could not find any.
Any help or suggestion on this matter is appreciated.
UPDATE: I have now tried to make this work using HttpWebRequest, and have tried a bunch of setting which might cause this timeout/issue. However still getting the same issue, where after 5 minutes of processing I am getting "system.net.webexception: the remote server returned an error: (401) unauthorized". Below is the code I have tried
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(handlerUrl);
httpWebRequest.Credentials = CredentialCache.DefaultCredentials;
httpWebRequest.UseDefaultCredentials = true;
httpWebRequest.Timeout = 600000;
httpWebRequest.ReadWriteTimeout = 600000;
httpWebRequest.ServicePoint.ConnectionLeaseTimeout = 600000;
httpWebRequest.ServicePoint.MaxIdleTime = 600000;
httpWebRequest.ContentType = "application/json; charset=utf-8";
httpWebRequest.ContentLength = 0;
httpWebRequest.Method = WebRequestMethods.Http.Get;
BulkUploadProcessorResponse response = null;
var httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (Stream stream = httpWebResponse.GetResponseStream())
{
using (StreamReader sr = new StreamReader(stream))
{
response =
JsonHelper.JsonDeserialize<BulkUploadProcessorResponse>(sr.ReadToEnd());
}
}
Sometimes, while calling the https://api.spotify.com/v1/me endpoint, I receive a 502 bad gateway error. This error occurs sporadically.
I would appreciate any help. Thanks!
Code:
PublicProfile profile = null;
var url = "https://api.spotify.com/v1/me";
using (var wc = new WebClient())
{
wc.Headers.Add("Authorization", TokenType + " " + AccessToken);
var response = wc.DownloadString(url);
profile = JsonConvert.DeserializeObject<PublicProfile>(response, settings);
}
I having the same issue. A majority of time when I make this request I get the 502: Bad Gateway response. Occasionally I will get an actual response. I am using Python and rauth library to make this request, this leads me to believe this is an error on Spotify's end and not ours.