Skip to content

Memory leak adding files from path to Zip with Symfony #349

Closed as not planned
@althaus

Description

@althaus

ZipStream-PHP version

3.1.2

PHP version

8.2.28

Constraints for Bug Report

Summary

Hi,

I've got an issue I'd need some help with. I've got a project where I'm adding lots of files (~ 100) to a ZIP archive using Symfony. A customer of mine reported broken ZIP archives and after digging into the code I've found out that there's some kind of memory leak.

My code looks like this (simplified):

$response = new StreamedResponse(function () use ($files, $zipName) {
            // Prepare ZIP archive
            $zip = new ZipStream(
                defaultEnableZeroHeader: true,
                outputName: $zipName,
                contentType: 'application/octet-stream',
                flushOutput: true,
            );

            // Iterate over files and add them to the archive
            foreach ($files as $file) {
                try {
                    $size = $file->getSize();
                    $zip->addFileFromPath(
                        fileName: $file->name,
                        path: $file->getPathname(),
                        exactSize: false === $size ? null : $size,
                    );
                } catch (\Throwable $e) {
                    $this->logger->error('Could not add file {file} to archive!', [
                        'file' => $file->getFilename(),
                        'exception' => $e,
                    ]);
                } finally {
                    unset($file);
                }
            }

            $zip->finish();
        });

This response is just send through a Symfony controller.

Current behavior

The server runs with 64 MB and I'm trying to add 100 files (user uploads) from disk with file sizes up to 80 MB each. In theory there should be no problem as everyhing gets streamed. The issue now is that Symfony runs into an OutOfMemoryException:

request.CRITICAL: Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\OutOfMemoryError: "Error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 16969928 bytes)" at File.php line 345 {"exception":"[object] (Symfony\Component\ErrorHandler\Error\OutOfMemoryError(code: 0): Error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 16969928 bytes) at /path/to/app/vendor/maennchen/zipstream-php/src/File.php:345)"} []

If I double the available RAM to 128 MB the archive is generated properly. I've added some more logging to debug the memory consumption:

[2025-03-27T12:02:44.362089+01:00] app.ERROR: Response: 326498dd-c4d7-4ad0-9006-369cfe28f0ad - File: be97ffdb-2223-4046-a061-662fbe183645 - Memory: 5190912 / 6349848 [] []
[2025-03-27T12:02:44.377531+01:00] app.ERROR: Response: 326498dd-c4d7-4ad0-9006-369cfe28f0ad - File: f391abf5-65da-41d8-87de-9b705bca5a37 - Memory: 5327264 / 6490160 [] []
[2025-03-27T12:02:44.406182+01:00] app.ERROR: Response: 326498dd-c4d7-4ad0-9006-369cfe28f0ad - File: cfe208e4-680a-4866-b509-b32824ff958c - Memory: 5335584 / 7424176 [] []
[2025-03-27T12:02:44.434935+01:00] app.ERROR: Response: 326498dd-c4d7-4ad0-9006-369cfe28f0ad - File: b7405dac-0381-4030-935b-fad704ee4fec - Memory: 5376672 / 7432496 [] []
[2025-03-27T12:02:44.436918+01:00] app.ERROR: Response: 603f6c2c-28e6-4806-bf33-5966792a7634 - File: 0886cdf4-af4e-4099-b56a-431989138d85 - Memory: 5376784 / 7432496 [] []
[2025-03-27T12:02:44.481339+01:00] app.ERROR: Response: 603f6c2c-28e6-4806-bf33-5966792a7634 - File: 2b76f1bd-4628-411c-9c67-4e27eedbad83 - Memory: 5512064 / 7768584 [] []
[2025-03-27T12:02:44.523841+01:00] app.ERROR: Response: 603f6c2c-28e6-4806-bf33-5966792a7634 - File: 4ab97f66-66f8-40f4-b903-ad75acc32474 - Memory: 5512176 / 7768584 [] []
[2025-03-27T12:02:44.550377+01:00] app.ERROR: Response: 603f6c2c-28e6-4806-bf33-5966792a7634 - File: a3ad3dba-0bfe-427a-ab6c-c1c7c80d31e7 - Memory: 5512288 / 7768584 [] []
[2025-03-27T12:02:44.617862+01:00] app.ERROR: Response: 78a0f3ee-0123-44b4-be2f-0e29c98bc3ed - File: 9d3942a0-fe5e-45fa-a5c0-19f0c3e1f882 - Memory: 6327664 / 9616216 [] []
[2025-03-27T12:02:44.622266+01:00] app.ERROR: Response: 78a0f3ee-0123-44b4-be2f-0e29c98bc3ed - File: dd6fd656-7953-49f1-b9d0-393e2bb96c68 - Memory: 6327776 / 9616216 [] []
[2025-03-27T12:02:44.667389+01:00] app.ERROR: Response: 4cff132b-53ca-4c66-bd48-43e6567dcf8b - File: 186a0868-8e4a-4446-a2b1-87371bd22b9f - Memory: 6327936 / 9616216 [] []
[2025-03-27T12:02:44.715629+01:00] app.ERROR: Response: 4cff132b-53ca-4c66-bd48-43e6567dcf8b - File: 5149b142-5411-4d5b-a5ca-850b10aac08c - Memory: 6328096 / 9616216 [] []
[2025-03-27T12:02:44.763261+01:00] app.ERROR: Response: 4cff132b-53ca-4c66-bd48-43e6567dcf8b - File: ce7b6d7e-e25d-406c-afa1-fc95e9f5852f - Memory: 6328256 / 9616216 [] []
[2025-03-27T12:02:44.807389+01:00] app.ERROR: Response: 4cff132b-53ca-4c66-bd48-43e6567dcf8b - File: 8b0c6dc1-7e43-4594-b2a1-9188974341aa - Memory: 6328416 / 9616216 [] []
[2025-03-27T12:02:44.911740+01:00] app.ERROR: Response: 4cff132b-53ca-4c66-bd48-43e6567dcf8b - File: 38a1d12f-6416-45d8-a2a3-1620ee3f34c2 - Memory: 7147752 / 12181408 [] []
[2025-03-27T12:02:44.914380+01:00] app.ERROR: Response: d01d124b-5b38-4b7f-baba-6b83ffac2084 - File: 99b5390e-a472-4424-870e-708de062c425 - Memory: 7147864 / 12181408 [] []
[2025-03-27T12:02:44.919397+01:00] app.ERROR: Response: d01d124b-5b38-4b7f-baba-6b83ffac2084 - File: c32c9ceb-f266-4939-8d1d-785785d7dadf - Memory: 7148280 / 12181408 [] []
[2025-03-27T12:02:44.933979+01:00] app.ERROR: Response: d01d124b-5b38-4b7f-baba-6b83ffac2084 - File: a41af13f-e5e4-434f-ae59-c666e4e8e5be - Memory: 7148376 / 12181408 [] []
[2025-03-27T12:02:44.939423+01:00] app.ERROR: Response: d01d124b-5b38-4b7f-baba-6b83ffac2084 - File: 59a55039-6606-4b73-84b6-9497bb417cae - Memory: 7148472 / 12181408 [] []
[2025-03-27T12:02:44.946074+01:00] app.ERROR: Response: d01d124b-5b38-4b7f-baba-6b83ffac2084 - File: 9fe2eb5a-f3da-4f22-9380-4296c8d52b51 - Memory: 7148568 / 12181408 [] []
[2025-03-27T12:02:44.959481+01:00] app.ERROR: Response: d01d124b-5b38-4b7f-baba-6b83ffac2084 - File: 93fed807-15be-40cf-ad1a-8d13a99b5a10 - Memory: 7148664 / 12181408 [] []
[2025-03-27T12:02:44.964321+01:00] app.ERROR: Response: d01d124b-5b38-4b7f-baba-6b83ffac2084 - File: 1e8e5c2b-6d7c-4b9a-b8ba-2a0889f5bd36 - Memory: 7148760 / 12181408 [] []
[2025-03-27T12:02:44.984172+01:00] app.ERROR: Response: d01d124b-5b38-4b7f-baba-6b83ffac2084 - File: cca3c797-1c6d-4958-a317-2a385eb25e51 - Memory: 7148856 / 12181408 [] []
[2025-03-27T12:02:45.001273+01:00] app.ERROR: Response: d01d124b-5b38-4b7f-baba-6b83ffac2084 - File: 3eef80cf-5192-487f-aac5-5ac1092d0226 - Memory: 7148952 / 12181408 [] []
[2025-03-27T12:02:45.134896+01:00] app.ERROR: Response: 73d405a6-769c-4e5b-9a9d-90c8d1158312 - File: 966980bd-f4aa-4178-ad21-90d88453cc51 - Memory: 8594936 / 15594680 [] []
[2025-03-27T12:02:45.139352+01:00] app.ERROR: Response: 73d405a6-769c-4e5b-9a9d-90c8d1158312 - File: 4d0addf2-e3fe-487b-82a4-a3fa678abdb3 - Memory: 8595048 / 15594680 [] []
[2025-03-27T12:02:45.404157+01:00] app.ERROR: Response: 15379a62-185e-4c18-95fe-16b1217370e1 - File: 7e8233eb-28b3-4008-8a45-5cbc5192fce0 - Memory: 9074392 / 18032016 [] []
[2025-03-27T12:02:45.466220+01:00] app.ERROR: Response: 15379a62-185e-4c18-95fe-16b1217370e1 - File: f223f472-25e6-4da4-938c-c896be8f26ea - Memory: 9074504 / 18032016 [] []
[2025-03-27T12:02:46.073783+01:00] app.ERROR: Response: 15379a62-185e-4c18-95fe-16b1217370e1 - File: 298b84ac-9f4e-408d-8c8f-7b19ed3a4710 - Memory: 9074632 / 18032016 [] []
[2025-03-27T12:02:46.142772+01:00] app.ERROR: Response: 15379a62-185e-4c18-95fe-16b1217370e1 - File: 7374b994-83b3-41bc-9256-891c39265455 - Memory: 9074760 / 18032016 [] []
[2025-03-27T12:02:47.145213+01:00] app.ERROR: Response: 404b5276-6af5-45bb-bb32-22ffa4862aa4 - File: 59a1a6b7-2554-4bdc-9ec4-5cab8752dc1e - Memory: 11385016 / 23156592 [] []
[2025-03-27T12:02:48.050270+01:00] app.ERROR: Response: 404b5276-6af5-45bb-bb32-22ffa4862aa4 - File: 94dbb793-4359-44e4-b5dc-13dbdf1e7773 - Memory: 11385128 / 23156592 [] []
[2025-03-27T12:02:48.837138+01:00] app.ERROR: Response: 404b5276-6af5-45bb-bb32-22ffa4862aa4 - File: f9f9cb81-7b13-4fc9-ab70-80fd05dc5626 - Memory: 11385880 / 24856656 [] []
[2025-03-27T12:02:49.396297+01:00] app.ERROR: Response: 404b5276-6af5-45bb-bb32-22ffa4862aa4 - File: 522592d9-1753-4ba8-ae17-38b0c8377913 - Memory: 11385992 / 24856656 [] []
[2025-03-27T12:02:49.438178+01:00] app.ERROR: Response: 8f9011ab-57d5-4e62-9949-14b4bd0474a8 - File: 3c053630-ba20-4eed-914b-7b5269ba8f9e - Memory: 11386120 / 24856656 [] []
[2025-03-27T12:02:49.754003+01:00] app.ERROR: Response: 8f9011ab-57d5-4e62-9949-14b4bd0474a8 - File: 7f976fa4-d9d4-4754-981d-1d98f34e9544 - Memory: 11386248 / 24856656 [] []
[2025-03-27T12:02:49.840072+01:00] app.ERROR: Response: 8f9011ab-57d5-4e62-9949-14b4bd0474a8 - File: 28503cee-9ac9-47a8-97af-91c59b6b154e - Memory: 11386376 / 24856656 [] []
[2025-03-27T12:02:50.242669+01:00] app.ERROR: Response: dd3948e4-9f69-4435-86b9-2602efb17f20 - File: b55316d5-97c8-4487-9c9c-daadae613662 - Memory: 11386472 / 24856656 [] []
[2025-03-27T12:02:50.550840+01:00] app.ERROR: Response: dd3948e4-9f69-4435-86b9-2602efb17f20 - File: 6c7f7ec3-aa1c-4923-a795-6908324f4723 - Memory: 11386568 / 24856656 [] []
[2025-03-27T12:02:50.850940+01:00] app.ERROR: Response: dd3948e4-9f69-4435-86b9-2602efb17f20 - File: 1ce72c92-105b-4385-889e-e27d8ad2bdd5 - Memory: 11386664 / 24856656 [] []
[2025-03-27T12:02:51.153220+01:00] app.ERROR: Response: dd3948e4-9f69-4435-86b9-2602efb17f20 - File: 9653e0c8-f91f-44bb-8172-d6e9210a339b - Memory: 11386760 / 24856656 [] []
[2025-03-27T12:02:51.455828+01:00] app.ERROR: Response: dd3948e4-9f69-4435-86b9-2602efb17f20 - File: 37e6b354-e3bb-442c-bd2f-78f7dacff6f6 - Memory: 11386856 / 24856656 [] []
[2025-03-27T12:02:51.597306+01:00] app.ERROR: Response: 9f8c5f71-1c07-42a5-867d-fa91a6f05af2 - File: cd183606-b018-487b-8bbe-e522c1a40740 - Memory: 11386968 / 24856656 [] []
[2025-03-27T12:02:51.602218+01:00] app.ERROR: Response: 9f8c5f71-1c07-42a5-867d-fa91a6f05af2 - File: 8e5dd129-d898-494b-9806-084aa6c1714c - Memory: 11387080 / 24856656 [] []
[2025-03-27T12:02:51.606714+01:00] app.ERROR: Response: 20690b7e-ab96-447a-94b2-c63814ad8fc1 - File: 30b56fbe-010e-44b4-93fb-507b771280f2 - Memory: 11387192 / 24856656 [] []
[2025-03-27T12:02:51.877391+01:00] app.ERROR: Response: 20690b7e-ab96-447a-94b2-c63814ad8fc1 - File: e088d18b-6328-4ee3-ad30-49d0234392f5 - Memory: 11387320 / 24856656 [] []
[2025-03-27T12:02:52.138475+01:00] app.ERROR: Response: 4db29a9b-c175-45f3-87fc-f697cc6f1c8f - File: c5bcee5e-e02b-41b1-a2c9-8c72a62b34d6 - Memory: 11387432 / 24856656 [] []
[2025-03-27T12:02:52.660067+01:00] app.ERROR: Response: 4db29a9b-c175-45f3-87fc-f697cc6f1c8f - File: 3aa541c8-4b36-4c2a-9d73-862444de2044 - Memory: 11387544 / 24856656 [] []
[2025-03-27T12:02:53.036064+01:00] app.ERROR: Response: 4db29a9b-c175-45f3-87fc-f697cc6f1c8f - File: c221a540-5c23-4a5d-9d90-07efe840b79b - Memory: 11387656 / 24856656 [] []
[2025-03-27T12:02:53.050820+01:00] app.ERROR: Response: 4db29a9b-c175-45f3-87fc-f697cc6f1c8f - File: 13c7f4ce-7083-4582-92c9-859afe338b26 - Memory: 11387768 / 24856656 [] []
[2025-03-27T12:02:53.271791+01:00] app.ERROR: Response: 36f255da-6be0-45ef-98eb-2aaf639e3919 - File: be1c87dd-66ed-4caf-9e1b-0ab4f0401c45 - Memory: 11387880 / 24856656 [] []
[2025-03-27T12:02:53.388613+01:00] app.ERROR: Response: 36f255da-6be0-45ef-98eb-2aaf639e3919 - File: 15f6da4c-fae4-402c-bef1-e2d4ad129087 - Memory: 11387992 / 24856656 [] []
[2025-03-27T12:02:53.638874+01:00] app.ERROR: Response: 36f255da-6be0-45ef-98eb-2aaf639e3919 - File: 1c8ec785-dda1-4061-9ac8-4d630ba71870 - Memory: 11388104 / 24856656 [] []
[2025-03-27T12:02:53.928452+01:00] app.ERROR: Response: 36f255da-6be0-45ef-98eb-2aaf639e3919 - File: 04421bea-e261-4066-ab8e-83b9f93ad46d - Memory: 11388216 / 24856656 [] []
[2025-03-27T12:02:54.212388+01:00] app.ERROR: Response: 36f255da-6be0-45ef-98eb-2aaf639e3919 - File: 67908714-de1a-4002-ab59-0ad380b12600 - Memory: 11388328 / 24856656 [] []
[2025-03-27T12:02:54.368005+01:00] app.ERROR: Response: d48ecafc-1799-4855-ac1c-fe41c25cc5b4 - File: 7d7883b6-4619-4701-973c-c4585cbcf6bb - Memory: 11388440 / 24856656 [] []
[2025-03-27T12:02:54.401499+01:00] app.ERROR: Response: e2178ae0-c420-492c-a96e-f0a91dfcb5e4 - File: d06bc3f5-0f52-4c92-8c0d-a9cc001a1046 - Memory: 11388552 / 24856656 [] []
[2025-03-27T12:02:54.440257+01:00] app.ERROR: Response: e2178ae0-c420-492c-a96e-f0a91dfcb5e4 - File: 1828af40-ce8b-483f-9c62-9bd4c9f44ee8 - Memory: 11388712 / 24856656 [] []
[2025-03-27T12:02:54.626897+01:00] app.ERROR: Response: e2178ae0-c420-492c-a96e-f0a91dfcb5e4 - File: b136fb51-8024-48eb-a3a1-4fff1cffb623 - Memory: 11388872 / 24856656 [] []
[2025-03-27T12:02:54.669445+01:00] app.ERROR: Response: e2178ae0-c420-492c-a96e-f0a91dfcb5e4 - File: 5b1d5c42-897c-41ec-8fad-071df957ee75 - Memory: 11389032 / 24856656 [] []
[2025-03-27T12:02:54.679837+01:00] app.ERROR: Response: 4ab43c11-b464-4921-83eb-6ea573715e0f - File: 56e82e4a-8e7a-472e-a3ae-501b4adce67f - Memory: 11389160 / 24856656 [] []
[2025-03-27T12:02:54.694196+01:00] app.ERROR: Response: 4ab43c11-b464-4921-83eb-6ea573715e0f - File: 5df27d39-21e0-4223-aa4e-6a0f34359cf4 - Memory: 11389288 / 24856656 [] []
[2025-03-27T12:02:54.705758+01:00] app.ERROR: Response: 4ab43c11-b464-4921-83eb-6ea573715e0f - File: feb78659-0471-426e-ba8f-418da50e76aa - Memory: 11389448 / 24856656 [] []
[2025-03-27T12:02:54.711966+01:00] app.ERROR: Response: 4ab43c11-b464-4921-83eb-6ea573715e0f - File: 0b118ea9-8577-4395-898b-5a84d76e9d45 - Memory: 11389560 / 24856656 [] []
[2025-03-27T12:02:54.718292+01:00] app.ERROR: Response: 4ab43c11-b464-4921-83eb-6ea573715e0f - File: 3dca17d1-1bee-4d13-b158-27c8a31ab1b8 - Memory: 11390952 / 24856656 [] []
[2025-03-27T12:02:54.840471+01:00] app.ERROR: Response: 4ab43c11-b464-4921-83eb-6ea573715e0f - File: f08f5d5b-3cc5-454a-99b2-20399c726fa2 - Memory: 11391080 / 24856656 [] []
[2025-03-27T12:02:54.854773+01:00] app.ERROR: Response: 4ab43c11-b464-4921-83eb-6ea573715e0f - File: 2df8ac52-a21c-44bd-ab3a-9548bcd0dc6c - Memory: 11391208 / 24856656 [] []
[2025-03-27T12:02:54.867816+01:00] app.ERROR: Response: 4ab43c11-b464-4921-83eb-6ea573715e0f - File: 9a1304d9-2766-43dd-8e84-b09defeba7ac - Memory: 11391336 / 24856656 [] []
[2025-03-27T12:02:54.875203+01:00] app.ERROR: Response: 4ab43c11-b464-4921-83eb-6ea573715e0f - File: 35e8d318-4b9e-4fe2-b59f-6cf22051f424 - Memory: 11391464 / 24856656 [] []
[2025-03-27T12:02:54.884763+01:00] app.ERROR: Response: 4ab43c11-b464-4921-83eb-6ea573715e0f - File: f1b68de2-36f2-4788-8304-0ef01d2b4a6c - Memory: 11391592 / 24856656 [] []
[2025-03-27T12:02:54.893797+01:00] app.ERROR: Response: 4ab43c11-b464-4921-83eb-6ea573715e0f - File: 7be11ba6-dfaf-43e5-9163-6a8026d6a856 - Memory: 11391704 / 24856656 [] []
[2025-03-27T12:02:54.986212+01:00] app.ERROR: Response: 2fbf02ad-c924-4f17-bbb6-4c117ecc33b6 - File: 255e5fab-d8f4-49a8-b206-beb0fb9ce100 - Memory: 11391832 / 24856656 [] []
[2025-03-27T12:02:54.989018+01:00] app.ERROR: Response: 2fbf02ad-c924-4f17-bbb6-4c117ecc33b6 - File: fd21a87d-7119-4b2f-a8f2-77238126b0c7 - Memory: 11391944 / 24856656 [] []
[2025-03-27T12:02:55.012991+01:00] app.ERROR: Response: dc660ca5-fef5-4218-a3bc-b3391dfcbdaa - File: 48467f01-8814-4ea1-b008-2e7abf87581a - Memory: 11392072 / 24856656 [] []
[2025-03-27T12:02:55.052114+01:00] app.ERROR: Response: dc660ca5-fef5-4218-a3bc-b3391dfcbdaa - File: 7e17f06a-5c32-40a0-9be8-683a08cb2a4f - Memory: 11392184 / 24856656 [] []
[2025-03-27T12:02:55.075201+01:00] app.ERROR: Response: dc660ca5-fef5-4218-a3bc-b3391dfcbdaa - File: 454ecd5c-25e4-4485-9e82-d3cec4992aa9 - Memory: 11392296 / 24856656 [] []
[2025-03-27T12:02:55.083829+01:00] app.ERROR: Response: dc660ca5-fef5-4218-a3bc-b3391dfcbdaa - File: dad8e806-39ee-4252-a2ca-147c3bca7ac1 - Memory: 11392408 / 24856656 [] []
[2025-03-27T12:02:55.252000+01:00] app.ERROR: Response: dc660ca5-fef5-4218-a3bc-b3391dfcbdaa - File: a8b9f60b-6df2-45f0-a9c9-04526ca80bcc - Memory: 11392520 / 24856656 [] []
[2025-03-27T12:02:56.252147+01:00] app.ERROR: Response: dc660ca5-fef5-4218-a3bc-b3391dfcbdaa - File: 80412201-0c77-4777-a285-bdcc4871ce73 - Memory: 20371064 / 43541816 [] []
[2025-03-27T12:03:00.066732+01:00] app.ERROR: Response: dc660ca5-fef5-4218-a3bc-b3391dfcbdaa - File: 9b02d5ef-a8e1-4b0c-9437-5625b83be261 - Memory: 21268200 / 54347176 [] []
[2025-03-27T12:03:00.280389+01:00] app.ERROR: Response: 1d2b7d00-f7b7-4ab6-ba27-c526c1ecebe7 - File: 9af6f362-821c-4a2e-b4ca-9b2932935e91 - Memory: 21268296 / 54347176 [] []
[2025-03-27T12:03:00.509996+01:00] app.ERROR: Response: 4d80446f-7146-4a06-9831-0c564fb364a4 - File: 460a16f0-bf5b-42e6-8cf9-48baf68e5f10 - Memory: 21268424 / 54347176 [] []
[2025-03-27T12:03:00.706819+01:00] app.ERROR: Response: 4d80446f-7146-4a06-9831-0c564fb364a4 - File: 5a5b3f83-4591-4e2f-b703-6ebfd14899ed - Memory: 21268552 / 54347176 [] []
[2025-03-27T12:03:00.915254+01:00] app.ERROR: Response: 4d80446f-7146-4a06-9831-0c564fb364a4 - File: 5097a609-49e5-440f-9aef-d64cbd09590a - Memory: 21268680 / 54347176 [] []
[2025-03-27T12:03:00.930653+01:00] app.ERROR: Response: 4d80446f-7146-4a06-9831-0c564fb364a4 - File: 148d6184-bfe2-45c6-b1f8-506bf19f4e15 - Memory: 21268792 / 54347176 [] []
[2025-03-27T12:03:00.953350+01:00] app.ERROR: Response: e38b2566-d60d-4363-9af2-f879992ae378 - File: 378044b5-4a66-432c-89cd-99bc6930f531 - Memory: 21268904 / 54347176 [] []
[2025-03-27T12:03:00.961428+01:00] app.ERROR: Response: e38b2566-d60d-4363-9af2-f879992ae378 - File: ce7a13ca-2e12-4aeb-8bc6-b5a4240850e0 - Memory: 21269016 / 54347176 [] []
[2025-03-27T12:03:01.313689+01:00] app.ERROR: Response: e38b2566-d60d-4363-9af2-f879992ae378 - File: 8601ebf3-0c17-4736-ba87-5759c1446b95 - Memory: 21269144 / 54347176 [] []
[2025-03-27T12:03:01.841085+01:00] app.ERROR: Response: ac9a5918-5112-4510-904f-b4e8fb66500c - File: 5c720460-3092-4084-aa37-5a9a8f391c85 - Memory: 21269256 / 54347176 [] []
[2025-03-27T12:03:01.843592+01:00] app.ERROR: Response: c896026e-3a41-4afb-86f6-56d10740be0e - File: 60f4110c-46ad-4c24-a4cd-f7af27166848 - Memory: 21269368 / 54347176 [] []
[2025-03-27T12:03:01.900453+01:00] app.ERROR: Response: b30c7b20-612e-41f5-936c-e9fa36b3d21c - File: b67dd2eb-6894-46b3-b098-eca3f75518b2 - Memory: 21269464 / 54347176 [] []
[2025-03-27T12:03:02.179191+01:00] app.ERROR: Response: b30c7b20-612e-41f5-936c-e9fa36b3d21c - File: de29c31d-977d-44cb-b9d3-d4fdcca36c89 - Memory: 21269560 / 54347176 [] []
[2025-03-27T12:03:02.672746+01:00] app.ERROR: Response: b30c7b20-612e-41f5-936c-e9fa36b3d21c - File: aa40534d-0521-43d1-87aa-f6e519b0b5da - Memory: 21269656 / 54347176 [] []
[2025-03-27T12:03:02.781070+01:00] app.ERROR: Response: b30c7b20-612e-41f5-936c-e9fa36b3d21c - File: 9b088bb5-de43-4db9-b4a7-2a9c63672530 - Memory: 21269752 / 54347176 [] []
[2025-03-27T12:03:03.153410+01:00] app.ERROR: Response: 59cab006-c2c8-42ec-a49a-fd9007b3f31e - File: 0799bd31-6ee5-48cd-a28f-e75fc360afe6 - Memory: 21269848 / 54347176 [] []
[2025-03-27T12:03:03.467372+01:00] app.ERROR: Response: 59cab006-c2c8-42ec-a49a-fd9007b3f31e - File: 3bed7a59-b472-4d05-99f7-a2a5ceba2e8f - Memory: 21269944 / 54347176 [] []
[2025-03-27T12:03:03.764448+01:00] app.ERROR: Response: 59cab006-c2c8-42ec-a49a-fd9007b3f31e - File: e69ce17d-fb98-4b11-a01a-58964d0ed60c - Memory: 21270040 / 54347176 [] []
[2025-03-27T12:03:04.185943+01:00] app.ERROR: Response: 59cab006-c2c8-42ec-a49a-fd9007b3f31e - File: eb297bea-d876-4bcb-8488-8a75e70788e4 - Memory: 21270136 / 54347176 [] []
[2025-03-27T12:03:04.326968+01:00] app.ERROR: Response: 59cab006-c2c8-42ec-a49a-fd9007b3f31e - File: af3fd3de-df7a-46fc-91e4-b1ae1e888247 - Memory: 21270232 / 54347176 [] []

Memory is current and peak usage and slowly creeping up and I just don't know why. Running my code without the ZIP parts the script consumes just 4 MB statically, so I'd say my code doesn't have an issue in general.

How to reproduce

I'm unable to create a standalone reproduction case. I've played around with all kind of number of files and sizes. It only breaks on the customer's deployment.

Expected behavior

No memory leak. :D

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions