Skip to content

Python timer trigger does not run locally when runonstartup is set to true #5262

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

Closed
paulbatum opened this issue Nov 18, 2019 · 7 comments
Closed
Assignees

Comments

@paulbatum
Copy link
Member

Repro Steps:

  1. In VS Code, create a new python function app, add a timer trigger.
  2. Modify function.json, add this line: "runOnStartup": true,
  3. Add a breakpoint to the function code
  4. F5

Expected result: host starts, function runs, breakpoint is hit.
Actual result: host hangs, eventually shows this error:

[11/18/2019 9:59:11 PM] Executed 'Functions.TimerTrigger' (Failed, Id=9a4b4a95-f436-4502-bad9-6d72f5090339)
[11/18/2019 9:59:11 PM] System.Private.CoreLib: Exception while executing function: Functions.TimerTrigger. Microsoft.Azure.WebJobs.Script: Did not find any initialized language workers.
@maiqbal11
Copy link
Contributor

maiqbal11 commented Nov 18, 2019

Synced with @pragnagopa offline. She said that she would be able to take a look at this from the Host side.

@pragnagopa pragnagopa added this to the Triaged milestone Nov 18, 2019
@pragnagopa
Copy link
Member

@yojagad - please verify fix #5458 fixes this issue as well.

@yojagad yojagad assigned yojagad and unassigned pragnagopa Jan 22, 2020
@yojagad yojagad modified the milestones: Triaged, Functions Sprint 68 Jan 22, 2020
@yojagad
Copy link
Contributor

yojagad commented Jan 23, 2020

Took a closer look at this and following are the observations

  • Does not repro with node (both from command line and from vs code)
  • Does not repro when running python function from command line
  • When running from VS code, it does and the following are the additional arguments noticed while starting up the worker process
    Starting worker process:python c:/Users/yojagad/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/ptvsd_launcher.py --default --host 127.0.0.1 --port 9091 --wait "C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools\workers\python\3.7/WINDOWS/X64/worker.py" --host 127.0.0.1 --port 60099 --workerId 3088ded6-8f53-4fac-a166-b0f19631bdbd --requestId f64bf3c7-9070-4b4d-af96-7f093d15266b --grpcMaxMessageLength 134217728

Following the last observation, I tried to launch the runtime with debug arguments like
"languageWorkers:python:arguments": "-m ptvsd --host localhost --port 9091 --wait" and observed the same behavior as originally described.

I wonder if it's trying to complete attachment before runtime initialization is complete...?

@pragnagopa
Copy link
Member

Thanks @yojagad for the investigation.

@EricJizbaMSFT - We have narrowed the issue to command line options --wait passed by VS Code for python functions. Can you please help us understand what is the requirement for adding '--wait'?

@ejizba
Copy link
Contributor

ejizba commented Jan 24, 2020

The command line options come from the Python extension (related to microsoft/vscode-python#3121) and pretty sure we just went with the default. @DonJayamanne @brettcannon what exactly does that --wait flag do?

@ejizba
Copy link
Contributor

ejizba commented Jan 25, 2020

I tried removing the --wait flag and it seemed to work ¯\_(ツ)_/¯. I'm fine to remove it, but would prefer to get confirmation from the python extension folks first.

Also this gets the timer trigger to run, but I still can't hit the breakpoint for the first execution. We have an issue on that here microsoft/vscode-azurefunctions#1492 and it's blocked by #4384

@pragnagopa
Copy link
Member

Thanks @EricJizbaMSFT for more details.
Closing this issue as there is a tracking issue on VS Code for this.

@ghost ghost locked as resolved and limited conversation to collaborators Feb 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants