504 Gateway Time-out on long REST calls

I’m running GitLab 8.17.0ce on Docker using the official Docker image, and whenever I try to PUT a long description or POST long notes using the GitLab API it gives a 504 Gateway Time-out. And by long I mean something with over 8000 characters, nothing excessive. Each time, the 504 happens exactly one minute after the REST call started. The instance has 4 cores and 16 GB of memory.

Does anyone know any reason why it would be so slow? It seems to me like a REST call of that size shouldn’t take a minute.

Secondly, does anyone know how to stop the gateway time-out from happening? Initially it was because the unicorn workers were getting reaped with the following error in the unicorn log:

E, [2017-05-05T16:54:28.589503 #5229] ERROR – : worker=3 PID:5346 timeout (61s > 60s), killing
E, [2017-05-05T16:54:28.595120 #5229] ERROR – : reaped #<Process::Status: pid 5346 SIGKILL (signal 9)> worker=3

But even after I updated the unicorn[‘worker_timeout’] in the gitlab.rb file and reconfigured gitlab, the REST calls still got the 504 after exactly one minute. In the unicorn worker log it just said:

I, [2017-05-05T17:00:51.884941 #5229] INFO – : reaped #<Process::Status: pid 5343 exit 0> worker=2

edit:

After further testing I realized that this bug happens not only because of the size of the description I am trying to PUT, but also due to the fact that the test data I was using does not contain any spaces or punctuation. If I use the API to PUT a description 8000 characters long that does have spaces or punctuation it takes very little time to succeed. However since GitLab doesn’t even allow to search for keywords in comments, I am somewhat at a loss as to why GitLab would care about the length of words.