-
Notifications
You must be signed in to change notification settings - Fork 457
Azure function is invoked but the code is never executed #2151
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
Comments
From @dixitsuneel on November 21, 2017 22:17 Is there any update? We need an answer on this to make sure that we are able to use azure functions in production correctly. We are blocked because of this issue. |
From @dbronk on November 22, 2017 12:9 It doesn't look like this issue has been looked at yet or assigned. This is a production blocker for us. How can we escalate this issue? |
Can you clarify which version of the runtime? There is an issue in v2 runtime for language extensions where cold-start may cause first invoke to fail - I can't find the issue to reference - but not sure if that applies here |
We are using Node js version 6.5 |
Also, all of these are not cold starts. If you look at the timelines, they are executed within a couple of minutes duration. We have the function app on app service plan with always on and no timeout in the host.json file. |
Thanks that helps - looking into this |
@christopheranderson can you please investigate this |
Runtime version: 1.0.11388.0 (~1) |
@TomMalow I looked at the logs for your app and I am fairly sure that you are hitting #2015 - basically your prod slot and your staging slot are competing to run the timer because they are ending up with the same host ID. Our logic calculates the host ID by using the app name and slot name but it truncates the name to 32 characters and your app name has exactly 32 characters without the slot name included. My best recommendation at this point would be for you to recreate your app with a shorter name, such that the combination of app name + slot name is less than 32 characters. One other possibility would be for you to explicitly set the host ID in host.json (see the id line here), and to make sure your production host.json has a different value to your staging host.json. You would need to be careful to maintain this every time you do a deployment or a swap. I see this as a relatively fragile solution which is why it was not my first recommendation. If all of this sounds like a dumb limitation... I agree with you :/ Its a tricky issue for us to fix as it can be breaking in nature and there are multiple system components that have the same logic for calculating host ID. |
Yep. That seems to have been the problem. Recreated one of the slots with a shorter name and the functions in the new slots are now able to run without any issue. That is quite some limitation. Hopefully it will be better in 2.0. I will probably go and recreate the app with a better name to avoid the issue in the future. The current name does not leave much left for the slot name. Thank you @paulbatum, for the quick respond. Sadly my solution does not seem to relate or solve this issue. |
From @dixitsuneel on November 20, 2017 18:40
I can see in the monitoring log that the azure function is getting invoked.
But the code never receives the control for execution.
But if I hit the same http request to the function multiple times, then it starts working correctly after couple of tries.
I know that the control is never received by my code as the first line I have in my function app is context.log.info and that doesn't get executed.
What do we have to do to fix the issue?
Here's the screen shot where you can see multiple requests not completing and the logs section is empty for the selected request(2nd from the top)

Here's the screen shot of the first request which completed and you can see the log

I have also added global exception handling, just in case there is an exception then that method will terminate the context with an error.
Here's the code for the same
process.on('uncaughtException', function (err) {
context.log.error(err);
context.done(err);
});
There is no logging at all. Please help
Copied from original issue: Azure/Azure-Functions#601
The text was updated successfully, but these errors were encountered: