Azure / Azure/azure-functions-host
Azure Function Timing out before max amount of time allowed for a timeout.
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
I have a blob storage trigger written in python. I'm receiving timeouts in my function before reaching the max amount of time allowed for my function to time out.
My functionTimeout parameter in my host.json file is set to
```"functionTimeout": "00:40:00"```
Though I'm seeing timeouts happen within seconds at times.
These timeouts seem to be happening when I'm inserting data into my Azure DB, I'm using a pandas method called ```to_sql()```
There is a parameter called ```chunksize``` that I can use in that method to write out data to the database in batches. I've tried multiple different chunksizes, all the way down to 10. I've also gone ahead and set my Connection Timeout parameter inside of my connection string to the db to ```Connection Timeout=0``` so that the connection never times out, thinking that may also solve the problem.
Here is line of code regarding my to_sql() call:
```to_sql(blob_name_file.lower(), conn, if_exists = 'append', index=False, chunksize=500)```
Here is my connection to my Azure DB:
```
# urllib.parse.quote_plus for python 3
params = urllib.parse.quote_plus(fr'Driver={DRIVER};Server=tcp:{SERVER_NAME},1433;Database=newTestdb;Uid={USER_NAME};Pwd={PASSWORD};Encrypt=yes;TrustServerCertificate=no;Connection Timeout=0;')
conn_str = 'mssql+pyodbc:///?odbc_connect={}'.format(params)
engine_azure = create_engine(conn_str,echo=True)
conn = engine_azure.connect()
```
I'm at a loss as to why I'm receiving time outs and what I can do about it.
Any suggestions would be appreciated, thank you, in advance, for your time.
EDIT: I've found an instance where a timeout occurred when my script was grabbing a table from the DB. So it seems the timeouts may be happening at random, not pertaining to just inserts.
Contributor guide
Assessment
This issue has not been assessed yet.