Hello community,
We have been in contact with Autodesk support for the last couple of weeks regarding a strange issue that occured at our studio, for which we found a solution and wanted to share with the community, just in case anybody else has the same issues. So maybe it’s helpful for anybody else ![]()
We were experiencing delays when working with anything API (shotgun_api3) related. So everytime the pipeline establishes connections with our FPT site. So basically everywhere in the pipeline. For example, we are using an automatic Versions upload script that runs from SG Desktop. When we run it, it runs instantly. But if we ran it again after 4 minutes, it took 20 seconds to start. This also happened in Nuke, Houdini, etc. For instance, opening the tk-workfiles2 app after 4 mins of inactivity (that is, not doing anything that causes the API to connect) took 20 secs.
It was always 20 secs after 4 min of inactivity. So you can imagine how much impact this had on our day to day workflow.
So we started digging with the help of the Autodesk FPT devs and managed to narrow it down all the way down to our internet connection itself. Our modem to be precise. It turned out our modem had a pre-set tcp_idle_timeout set of 4 minutes. Meaning, it would automatically close open sockets, thus fooling our pipeline into thinking the connection to our FPT site was still open, while it was already closed by our modem, causing constant delays of exactly 20 secs.
We found out that by adding a piece of TCP keepalive in the core of FPT, the issue was solved.
This code essentially tells the modem (or any other piece of network stack) to send a keepalive packet every X seconds, and thus forcing the modem to keep the connection open.
I attached a version of the init.py file (that has tcp_keepalive enabled) that lives in the core folder here:
\install\core\python\tank_vendor\shotgun_api3\lib\httplib2\python3