I am working on a Django app on Ubuntu 16.04, and recently noticed that functional tests using selenium in the test suite for my Django app will sometimes fail (timeout). These are tests that previously passed, and no code has been changed. When this happens, it is seemingly random which tests will fail; on one run test A will fail, on the next run test B will fail and A will pass. However, it seems like what usually fails is calls to outside web services (Google Maps API calls), or loading external libraries (loading Font Awesome or Bootstrap through a CDN) - selenium will timeout waiting for these resources to load.
When this happens, running the site locally with the development server (./manage.py runserver
) will usually be slower than usual (i.e., some pages will load much slower than usual, or will fail to load altogether).
My suspicion is that some sort of network traffic on my computer is blocking or slowing down Django's development and test server, like another process is using/trying to use the same port or something of that nature.
At one point when this issue was particularly bad, I realized I was trying to upload a ~1GB file to dropbox on the same machine. When I stopped this process my test suite and development server both started to run without issue. Another time, I was uploading music files through Google Music Manager, and when I quit music manager, the tests and dev server went back to normal. However, I am experiencing the same issue at the moment, and I am not currently doing any major file downloading or uploading (that I am aware of).
So, assuming that these are not coincidences, is it the case that any kind of heavy network traffic will cause issues with the Django development server and test server, or is this caused by certain processes on my machine trying to use the same port/resources/something as the Django server? How can I diagnose/solve such a problem?
I have searched SO and elsewhere for insight into the issue, but I am having trouble finding a solution, partially I think because I am not really sure what the problem is or how to articulate it in a way that the search engine understands.
I have tried using the netstat
tool, with the suspicion being that some other process was running on 127.0.0.1:8000
(for the dev server run with runserver
) and 127.0.0.1:8081
(which is where the test server seems to run), but I will admit that I am not really even sure what I should be looking for there, or if I should be looking there at all.
Please forgive my ignorance; I am new to networking issues (if that is what I am experiencing) and I am aware that I am probably talking about this in a way that will make veterans' skin crawl. I apologize in advance if this question is too vague. If you must downvote, please let me know additional information I can provide to make the question clearer/more useful.
In the time I have spent preparing this post, the problem has once again cleared up on its own, and all my tests pass, but I know it will come back, so any advice would be appreciated. Thank you!