Tyk response with Empty reply from Server

Hi I am trying to upload a 2G file via tyk-gateway with v3.2.2, by curl and I found the file is being uploaded successfully but the response from the server is seen in the packet capture but the tyk is responding back with an Empty reply from the Server.

  • Curl_http_done: called premature == 0
  • Empty reply from server
  • Connection #0 to host left intact
    curl: (52) Empty reply from server

Note that the tyk tested with and without docker in both the cases the response is the same
Tyk.conf
{
“listen_address”: “”,
“listen_port”: 8080,
“secret”: “”,
“template_path”: “/opt/tyk-gateway/templates”,
“middleware_path”: “/opt/tyk-gateway/middleware”,
“use_db_app_configs”: false,
“app_path”: “/opt/tyk/apps/”,
“storage”: {
“type”: “redis”,
“host”: “”,
“port”: 6379,
“username”: “”,
“password”: “”,
“database”: 0,
“optimisation_max_idle”: 100
},
“enable_analytics”: true,
“analytics_config”: {
“type”: “csv”,
“csv_dir”: “/var/log/tyk-gateway/metrics/”,
“purge_delay”: 2
},
“health_check”: {
“enable_health_checks”: false,
“health_check_value_timeouts”: 60
},
“optimisations_use_async_session_write”: true,
“allow_master_keys”: false,
“policies”: {
“policy_source”: “file”,
“policy_record_name”: “/var/config/default/tyk/policies/policies.json”
},
“hash_keys”: false,
“close_connections”: true,
“allow_insecure_configs”: true,
“global_session_lifetime”: 100,
“force_global_session_lifetime”: false,
“max_idle_connections_per_host”: 100,
“http_server_options”: {
“enable_websockets”:true
}
}

Hello @mohammed_bilal and welcome to the forums.

We are aware about the scenario and as you’ve confirmed Tyk completes the operation. You can get around the Empty rely from Server` response by setting the proxy_default_timeout.

Hi, @Olu Thanks for the reply, tried with the “proxy_default_timeout”, and got the new error response from the tyk.

  • Recv failure: Connection reset by peer
  • Curl_http_done: called premature == 1
  • stopped the pause stream!
  • Closing connection 0
    curl: (56) Recv failure: Connection reset by peer

How long does the upload take? Was the value in the proxy_default_timeout set to something a bit higher than the default upload time?

Yes, the upload time actually takes around 8minutes i updated the “proxy_default_timeout”: 1000 , in tyk.conf file

@Olu And found that tyk is getting killed shows
fatal error: runtime: out of memory

Is the timeout instant or after 1000 seconds?

It is Instant after executing the curl command

Can you try replacing proxy_default_timeout with enforced-timeout middleware in the API definition. Does it yield the same result?

Yes @Olu the response is same

Thanks for the info. I am going to try and replicate this. I’ll get back to you with my feedback

Hi @mohammed_bilal

Could you upload your current tyk.conf and any environment variables used to configure the gateway please? I would also be interested in knowing what headers you use during the upload. For example are you setting Content-Type or Content-Length or even Transfer-Encoding?

If you have an example curl -v that would be very helpful to see, but if not that more detail on how the upload is being done would be great

Cheers,
Pete

Hi @Pete Please find the below snippet : curl -vv

*   Trying 192.168.0.10...
* TCP_NODELAY set
* Connected to 192.168.0.10 (192.168.0.10) port 9090 (#0)
> POST /v1/software/upload HTTP/1.1
> Host: 192.168.0.10:9090
> User-Agent: curl/7.52.1
> Accept: application/json
> Authorization: Basic wefagerghnrthetyte
> Content-Length: 2336905520
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------701e34056682310
>
< HTTP/1.1 100 Continue
HTTP/1.1 100 Continue

* Curl_http_done: called premature == 0
* Empty reply from server
* Connection #0 to host 192.168.0.10 left intact
curl: (52) Empty reply from server```

Hi,

Thanks for that. Could you include the actual command as well as your current tyk.conf please?

Cheers,
Pete