Skip to content

truncated response when serving big files #1101

Open
@alykhachov

Description

@alykhachov

Hi folks, I have php laravel app that servers big binary files, up to 600MB

unit version: 1.31.1
config:

{
	"listeners": {
		"0.0.0.0:8080": {
			"pass": "routes"
		}
	},

	"routes": [
		{
			"match": {
				"uri": "!/index.php"
			},

			"action": {
				"share": "/var/www/html/public$uri",
				"fallback": {
					"pass": "applications/laravel"
				}
			}
		}
	],

	"applications": {
		"laravel": {
			"type": "php",
			"options": {
				"file": "/etc/php/php.ini"
			},

			"limits": {
				"requests": 8192,
				"timeout": 60
			},

			"processes": {
				"max": 20,
				"spare": 5,
				"idle_timeout": 30
			},

			"working_directory": "/var/www/html",
			"root": "/var/www/html/public",
			"script": "index.php",
			"stdout": "/dev/stdout",
			"stderr": "/dev/stderr"
		}
	}
}

retrieving 24MB file - ok
retrieving 93MB file - failure

curl output

< HTTP/1.1 200 OK
< Content-Type: application/octet-stream
< Cache-Control: must-revalidate, no-cache, no-store, public
< Date: Mon, 29 Jan 2024 19:40:49 GMT
< Last-Modified: Thu, 16 Nov 2023 14:04:19 GMT
< Content-Disposition: attachment; filename=test.file
< ETag: "<sometag>"
< Content-Length: 97282411
< Accept-Ranges: bytes
< Content-Security-Policy: base-uri 'self'; default-src 'self'
< Permissions-Policy: accelerometer=(self), ambient-light-sensor=(self), autoplay=(self), battery=(self), camera=(self), cross-origin-isolated=(self), display-capture=(self), document-domain=*, encrypted-media=(self), execution-while-not-rendered=*, execution-while-out-of-viewport=*, fullscreen=(self), geolocation=(self), gyroscope=(self), magnetometer=(self), microphone=(self), midi=(self), navigation-override=(self), payment=(self), picture-in-picture=*, publickey-credentials-get=(self), screen-wake-lock=(self), sync-xhr=*, usb=(self), web-share=(self), xr-spatial-tracking=(self)
< X-Content-Type-Options: nosniff
< X-Download-Options: noopen
< X-Frame-Options: sameorigin
< X-Permitted-Cross-Domain-Policies: none
< X-XSS-Protection: 1; mode=block
< Referrer-Policy: no-referrer
< Cross-Origin-Embedder-Policy: unsafe-none
< Cross-Origin-Opener-Policy: unsafe-none
< Cross-Origin-Resource-Policy: cross-origin
< Server: Unit/1.31.1
< 
{ [9 bytes data]
  2 92.7M    2 1930k    0     0  1725k      0  0:00:55  0:00:01  0:00:54 1725k* transfer closed with 89600662 bytes remaining to read
  7 92.7M    7 7501k    0     0  4076k      0  0:00:23  0:00:01  0:00:22 4077k
* Closing connection
curl: (18) transfer closed with 89600662 bytes remaining to read

unit log

2024/01/29 19:45:07 [info] 30123#30123 "laravel" application started
2024/01/29 19:45:08 [alert] 18#18 app process 30114 exited on signal 7

Will appreciate any advise on which option to tune or how to properly debug this

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    z-phpLanguage-Module for PHP (SAPI)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions