Possible memory leak?

question

#1

Has anyone observed a potential memory leak with lambdas in Ruby?

I have created the most simple controller in Jets:

class TestController < ApplicationController
  class_memory_size 3008

  def my_test
    render json: {data: 'test'}
  end

If I call this method via the api gateway url multiple time in a small lapse of time so the same process is reused, I can see in CloudWatch that the max memory used just keeps growing. After a while it will reach the max memory size (3008 MB) and the process will crash. A new process will be created and the same kind of memory leak will happen again.

Here is a small sample (it stops at 248 MB) from CloudWatch. The memory Used continues to grow till it reaches the max memory allowed which is 3008 MB :

REPORT RequestId: f29affbc-5df5-422d-95c7-f98d0c4b6392	Duration: 3.13 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 151 MB	Init Duration: 2253.70 ms	
REPORT RequestId: 7f135931-bdd4-4bcf-8c2a-234a69c2b724	Duration: 143.23 ms	Billed Duration: 200 ms	Memory Size: 3008 MB	Max Memory Used: 160 MB	
REPORT RequestId: 11f69c38-29d0-4411-a07c-cefa0e2d64eb	Duration: 52.76 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 161 MB	
REPORT RequestId: d7e5a2c4-1578-4a4f-8e7d-b2779fc1c101	Duration: 54.58 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 162 MB	
REPORT RequestId: 7780faec-4c01-48b8-bb95-6d80d3b14264	Duration: 56.24 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 162 MB	
REPORT RequestId: 4501198e-5c79-46c2-8d4d-4f580950512c	Duration: 56.37 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 163 MB	
REPORT RequestId: fed47229-ded8-4fa8-bf46-9289e4547871	Duration: 61.06 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 163 MB	
REPORT RequestId: d3ae63a1-28e9-45af-b1d2-5ef81ad6a54a	Duration: 67.16 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 163 MB	
REPORT RequestId: 569432f1-6fd0-4b5f-953e-f335ed45daa4	Duration: 55.49 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 164 MB	
REPORT RequestId: 629e8747-4dbf-48df-a4b3-06411e69dfed	Duration: 52.14 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 164 MB	
REPORT RequestId: 4a85ac77-c9ac-486e-8a4d-d9790cda3a41	Duration: 54.39 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 165 MB	
REPORT RequestId: a70297d8-9d61-4b64-993f-0c8d9b40cb58	Duration: 56.98 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 165 MB	
REPORT RequestId: 95475084-f229-4088-84b0-07723897dbc7	Duration: 52.78 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 166 MB	
REPORT RequestId: 4832b969-2fd0-4f4f-a512-f8f7bcc2a327	Duration: 57.59 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 166 MB	
REPORT RequestId: 2189773f-a311-4cd2-b560-63ca08a92404	Duration: 57.40 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 167 MB	
REPORT RequestId: 2ba01e1e-2f9f-46ba-bb5c-3918c28906b1	Duration: 54.78 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 167 MB	
REPORT RequestId: 58e14ad3-fbd4-42f3-855d-22606e39d7b7	Duration: 60.57 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 168 MB	
REPORT RequestId: 3b3f60ff-99d1-48ef-8547-3673ae0d3f99	Duration: 54.65 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 168 MB	
REPORT RequestId: 0c7ab994-dc55-4084-b0af-0d95c50e6648	Duration: 58.22 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 168 MB	
REPORT RequestId: c3d5f97f-adf5-43b4-a2b3-f3ac75668a3b	Duration: 56.30 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 169 MB	
REPORT RequestId: d541b93e-9cb1-4331-ab43-f41c1012dc55	Duration: 61.91 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 169 MB	
REPORT RequestId: 92cdbfec-b0b3-4aed-b4a0-6acef97acc3a	Duration: 54.98 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 170 MB	
REPORT RequestId: f93c6ed2-9eda-411f-893f-c2259e848eb5	Duration: 61.89 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 170 MB	
REPORT RequestId: dd726024-af56-44f2-85e4-72a8f4b44900	Duration: 60.59 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 171 MB	
REPORT RequestId: 3d77c808-9c10-4f35-9907-4500f898bf75	Duration: 52.36 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 171 MB	
REPORT RequestId: c29c7ef0-8560-47f6-b315-5fcaa961bf7f	Duration: 59.79 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 172 MB	
REPORT RequestId: 7d91f511-a910-420b-8d9d-6210273f879d	Duration: 74.02 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 172 MB	
REPORT RequestId: d4771c35-aae1-41c5-ba29-567a2407eadc	Duration: 57.77 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 173 MB	
REPORT RequestId: a1ff1075-3fad-4661-90bb-863685bb77d3	Duration: 60.07 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 173 MB	
REPORT RequestId: ab723f9f-2bed-4fdc-b04e-dd59eb90327c	Duration: 63.96 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 174 MB	
REPORT RequestId: c020d7f9-c3c5-40c2-8516-9561fe7adc48	Duration: 55.84 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 174 MB	
REPORT RequestId: 7614622d-3b93-4344-a357-2d7b241bd323	Duration: 53.51 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 174 MB	
REPORT RequestId: 27ef338b-f3bc-4cda-9662-8a85b9aba74e	Duration: 52.40 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 174 MB	
REPORT RequestId: 49d50919-eaff-4890-8834-80536fef3532	Duration: 60.68 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 175 MB	
REPORT RequestId: 31a115ae-3663-430e-bfba-78e35396a0b2	Duration: 59.46 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 175 MB	
REPORT RequestId: 2b4f1433-43d2-4b6a-8dc6-00959d3c7457	Duration: 84.63 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 178 MB	
REPORT RequestId: b544ab05-c52a-46cf-9bb0-9b4d7cfc55ac	Duration: 66.35 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 178 MB	
REPORT RequestId: ada5206f-0068-4a68-a4b7-f479ba8b23ee	Duration: 48.17 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 178 MB	
REPORT RequestId: e4dfb4e7-4320-4f9a-8ba0-860c738c65bd	Duration: 61.06 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 178 MB	
REPORT RequestId: a822a5db-6878-40c6-8aa0-7749e68ca185	Duration: 58.44 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 178 MB	
REPORT RequestId: 2e40c009-7aa1-439b-add4-cbd301813c9a	Duration: 70.09 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 178 MB	
REPORT RequestId: b81fb054-d963-4983-bf8f-584e934bd980	Duration: 52.84 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 178 MB	
REPORT RequestId: 761e4efb-21e3-4d41-a06a-1d06d8f348fa	Duration: 59.73 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 179 MB	
REPORT RequestId: 0a16764b-48ea-4e52-9f9b-b9ac26fe05ba	Duration: 60.83 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 179 MB	
REPORT RequestId: 2d1a6200-80ed-4a69-bb26-a660dec04264	Duration: 87.60 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 180 MB	
REPORT RequestId: ac07bfb1-ed0c-4398-817e-20d2a7672856	Duration: 72.94 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 180 MB	
REPORT RequestId: f794ea62-6d66-4b8b-a202-fb5e70fe88f3	Duration: 55.52 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 180 MB	
REPORT RequestId: e1fad0df-3fe8-4e33-b80b-bddb61ac6724	Duration: 69.49 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 181 MB	
REPORT RequestId: 4ba53a5d-9423-4c30-af1e-9805b7b209d5	Duration: 53.69 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 181 MB	
REPORT RequestId: 96c1e23c-6e56-4045-a43f-7fcf759e037d	Duration: 61.88 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 181 MB	
REPORT RequestId: 7828fd27-c59a-46cf-afe3-e686e68fa74e	Duration: 64.19 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 182 MB	
REPORT RequestId: 1b93aa47-fa80-4d56-ab62-59afd69a6170	Duration: 57.18 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 182 MB	
REPORT RequestId: 0dfe98fb-91ad-4863-9ed3-1e8c070f7f78	Duration: 70.64 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 183 MB	
REPORT RequestId: 0dd17483-0778-4893-b776-15b8abd931b4	Duration: 61.73 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 184 MB	
REPORT RequestId: 5c52c2e7-3307-48eb-9145-5f1f47c6b545	Duration: 55.72 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 184 MB	
REPORT RequestId: dcf25bc3-f534-4395-adde-dd9395cda238	Duration: 55.91 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 184 MB	
REPORT RequestId: 44378d8d-8bf4-4f22-9bc9-86effdd964ee	Duration: 62.89 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 184 MB	
REPORT RequestId: 228df696-8143-41e8-b557-0c3b68e5617e	Duration: 55.17 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 185 MB	
REPORT RequestId: a677a4ad-2b4b-469f-9ff2-07d47d77daeb	Duration: 68.23 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 185 MB	
REPORT RequestId: 48c9929f-e14a-4fce-ab81-27466aeb3064	Duration: 55.56 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 186 MB	
REPORT RequestId: aa9fdd2c-fb54-4940-b114-edba53158eba	Duration: 60.92 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 186 MB	
REPORT RequestId: 8e30f636-ad33-4054-935f-00a4604c380f	Duration: 61.31 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 186 MB	
REPORT RequestId: a5abca1a-cebc-4129-ab1b-43ae97ad92a2	Duration: 56.68 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 187 MB	
REPORT RequestId: 0d73de03-e1e8-4792-a4d8-bf0d2001802b	Duration: 58.30 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 187 MB	
REPORT RequestId: 8c15e233-7a09-4d76-b95f-ff20e5cb7a4e	Duration: 65.22 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 188 MB	
REPORT RequestId: dab7fef4-8ac4-457f-81b2-f6f7066d40af	Duration: 64.43 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 188 MB	
REPORT RequestId: 44fc0832-ea7e-4ea7-9dd4-e46bf373df48	Duration: 74.39 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 189 MB	
REPORT RequestId: d0c677c9-6e30-4ae7-83ea-3c800cdd3403	Duration: 66.76 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 189 MB	
REPORT RequestId: a395f687-b834-4754-835b-5c081166cc13	Duration: 55.50 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 189 MB	
REPORT RequestId: c1a3243e-8a66-4069-9e64-157d14528641	Duration: 64.38 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 190 MB	
REPORT RequestId: d0fa0817-a75a-40d6-9eb7-dc3f24e23604	Duration: 64.61 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 190 MB	
REPORT RequestId: d9900865-fbd0-4ab6-926e-119e9cc7d958	Duration: 60.72 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 191 MB	
REPORT RequestId: 9f45e92f-e36d-4a5b-b32b-30f24e56f84e	Duration: 62.09 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 191 MB	
REPORT RequestId: aa005cb3-5b9b-459c-afc7-71eae6835661	Duration: 50.02 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 192 MB	
REPORT RequestId: 055bd21d-4408-4360-9eea-61f56f20b3db	Duration: 80.20 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 193 MB	
REPORT RequestId: 80757bc8-ace0-46c7-80ed-8e8ed52252a9	Duration: 64.90 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 194 MB	
REPORT RequestId: ed2d4263-5a03-4359-a5a6-b70498a37470	Duration: 60.15 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 194 MB	
REPORT RequestId: 68e71232-b54b-45c5-a7fe-dd7f7c187112	Duration: 65.72 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 194 MB	
REPORT RequestId: db54727f-4fa6-4187-ba3a-24b05f8ca7bb	Duration: 60.20 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 194 MB	
REPORT RequestId: edbda29e-52e8-4471-979c-c2bc523e6daf	Duration: 63.42 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 194 MB	
REPORT RequestId: f779a771-354e-4fe1-93c1-41213467535a	Duration: 59.66 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 194 MB	
REPORT RequestId: 80bd6310-1f7a-4917-ba18-e9159045baf3	Duration: 63.48 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 195 MB	
REPORT RequestId: 67832fd3-abb0-4ee8-bac2-439055c72b69	Duration: 65.29 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 195 MB	
REPORT RequestId: be1e5931-f2cc-4cb1-9498-cf9ff1a63118	Duration: 60.45 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 196 MB	
REPORT RequestId: 48f65e95-8be4-41f5-9336-d83e56eca645	Duration: 58.69 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 196 MB	
REPORT RequestId: ebe92966-0934-495e-b654-dddf58061989	Duration: 64.50 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 196 MB	
REPORT RequestId: 6e2e92e3-265f-4fea-9a64-307d6272c61e	Duration: 63.63 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 197 MB	
REPORT RequestId: 8e4fac78-fea0-4dd8-8aba-100aa4fd6720	Duration: 67.16 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 198 MB	
REPORT RequestId: 245e12f8-3325-4342-8e5d-e2504ce53f4b	Duration: 58.84 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 198 MB	
REPORT RequestId: 6525b9ae-4ac1-41c3-b95c-b33cc47f1651	Duration: 80.12 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 199 MB	
REPORT RequestId: 52be69cc-8889-44aa-bb29-20f89fba0c29	Duration: 58.08 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 199 MB	
REPORT RequestId: 1affbe4b-93be-4c44-a52f-cc142cf31679	Duration: 56.94 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 199 MB	
REPORT RequestId: cfb83747-5559-4096-8e87-034f5e06a18c	Duration: 68.32 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 199 MB	
REPORT RequestId: f339d6ed-7d66-4ecd-a2ba-4db9c7fefc2b	Duration: 125.73 ms	Billed Duration: 200 ms	Memory Size: 3008 MB	Max Memory Used: 199 MB	
REPORT RequestId: 66f872ff-8abc-4f3b-b86d-42f71dffa78f	Duration: 56.54 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 200 MB	
REPORT RequestId: 277ec9d7-50ee-4c67-9cd3-cf626e727775	Duration: 66.58 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 200 MB	
REPORT RequestId: 5d112384-4759-488a-9a11-5b6081153138	Duration: 62.72 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 200 MB	
REPORT RequestId: 99d4c49f-103b-4356-803c-690c82d850ea	Duration: 63.58 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 200 MB	
REPORT RequestId: 7fd639cd-eb77-4a1b-a7ff-6dbd3fff77b7	Duration: 59.52 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 200 MB	
REPORT RequestId: 00cf96bd-247a-41c3-8cf2-8bbe2c426fbb	Duration: 67.50 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 200 MB	
REPORT RequestId: 41447d11-67aa-4fbd-a33f-98644f337163	Duration: 61.80 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 201 MB	
REPORT RequestId: 6b58b84f-9943-4cf4-aecf-497fe16b4655	Duration: 63.92 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 201 MB	
REPORT RequestId: ff3b53e5-2d86-449e-b06d-53f761bd03ec	Duration: 64.81 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 201 MB	
REPORT RequestId: 24b661d7-346e-4dfc-8508-795bca9e50f6	Duration: 57.13 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 202 MB	
REPORT RequestId: d4080367-807a-4a02-b0ae-1cfb7ac6db5a	Duration: 81.49 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 203 MB	
REPORT RequestId: 428f5185-2aeb-408b-a348-b1ea5a71596b	Duration: 58.07 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 204 MB	
REPORT RequestId: c36a7ccd-46e3-4974-b6cf-58f9430c03c3	Duration: 61.32 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 204 MB	
REPORT RequestId: c5b04213-1daa-4f2b-93c5-87b1f71a79fd	Duration: 155.42 ms	Billed Duration: 200 ms	Memory Size: 3008 MB	Max Memory Used: 207 MB	
REPORT RequestId: e8e114b5-df14-48a6-94e9-177f0fe8eb9f	Duration: 58.04 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 209 MB	
REPORT RequestId: 3d6935ae-063c-4ba4-a181-c62e4b039bcd	Duration: 65.58 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 213 MB	
REPORT RequestId: 66cc7bba-b4c2-487c-a674-955a4e37729a	Duration: 52.30 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 216 MB	
REPORT RequestId: 9c217383-936a-4b17-9265-ca35743a1236	Duration: 54.68 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 218 MB	
REPORT RequestId: eea8670b-ad45-4172-bf84-2de291329285	Duration: 56.95 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 219 MB	
REPORT RequestId: ddf51237-e2b0-443d-997e-dabe31c88241	Duration: 49.78 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 219 MB	
REPORT RequestId: 03279afa-f6de-4c6a-b5a7-4db6f769b14f	Duration: 63.82 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 220 MB	
REPORT RequestId: 816e693d-f99e-4a02-9a9b-44c1ce63b61a	Duration: 57.14 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 220 MB	
REPORT RequestId: 6aa117c3-c71f-484c-b99f-be8cbfbc8110	Duration: 53.55 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 220 MB	
REPORT RequestId: 74df3f36-d041-457f-98f1-e4f1e95939fb	Duration: 62.89 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 220 MB	
REPORT RequestId: d3d298b5-b9e8-4a9f-aae2-1c0e416a17c1	Duration: 78.44 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 221 MB	
REPORT RequestId: 1b4baa8c-fed6-4a51-904c-a559fb7c7c8a	Duration: 57.86 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 221 MB	
REPORT RequestId: 740468de-e351-482e-ad40-4695ede859c5	Duration: 61.58 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 221 MB	
REPORT RequestId: 7c7565e3-0712-4217-a727-fb16d6ecf953	Duration: 68.84 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 222 MB	
REPORT RequestId: 8f049447-a268-4330-8f9d-5e0db8bd1bb5	Duration: 59.98 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 223 MB	
REPORT RequestId: 3f549cc9-fd72-4e81-b4ed-4c1b5e76c820	Duration: 81.48 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 224 MB	
REPORT RequestId: 84afb47c-e3d3-46e3-925e-681858a85131	Duration: 58.66 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 225 MB	
REPORT RequestId: a4d979a1-4b6f-477f-8fff-c83ce931ba4c	Duration: 54.17 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 225 MB	
REPORT RequestId: 9f3917b2-5f7a-4b75-a4cd-12feb2a7a0e9	Duration: 59.30 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 225 MB	
REPORT RequestId: fd5249f4-530b-470f-afa9-016688f20d44	Duration: 66.86 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 225 MB	
REPORT RequestId: 955adf7c-a391-4b3f-b9c3-40f1cd19a57d	Duration: 55.66 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 225 MB	
REPORT RequestId: c597b3ef-9adf-4a65-9ec7-cd278d2061f7	Duration: 60.56 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 225 MB	
REPORT RequestId: 2e394d81-57b9-4dc8-9f04-5d4367603601	Duration: 68.23 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 226 MB	
REPORT RequestId: f3419dc6-9afb-47d6-a526-a51567a52517	Duration: 57.57 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 226 MB	
REPORT RequestId: dbd7fe31-aa2c-4daa-9f50-035bf5cd977d	Duration: 56.77 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 227 MB	
REPORT RequestId: 8b0b3151-339c-4703-ad3c-015cafa4d4cd	Duration: 57.38 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 227 MB	
REPORT RequestId: 27b1140f-b5d8-445a-a551-67ddd3da8f5f	Duration: 56.40 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 227 MB	
REPORT RequestId: 09d5ba4a-0dba-4199-a1a4-871d518ec127	Duration: 56.54 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 227 MB	
REPORT RequestId: 816de638-c990-4b88-a7ea-87214abe3817	Duration: 64.51 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 227 MB	
REPORT RequestId: c40911d0-bce0-4bb9-8068-bf1b853d85e2	Duration: 79.14 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 228 MB	
REPORT RequestId: 73ac4481-5aa9-4007-86f8-50bd9d4538a0	Duration: 62.17 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 229 MB	
REPORT RequestId: bb6d6ad5-11c7-4818-9fa8-61e48c76b4f2	Duration: 64.01 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 230 MB	
REPORT RequestId: defda3e6-b90b-482a-889b-47a0b03dcfd4	Duration: 69.78 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 230 MB	
REPORT RequestId: 95328daf-a005-4454-932d-3608e8575b4c	Duration: 59.04 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 230 MB	
REPORT RequestId: 1171aef6-4ae1-4405-92b5-8a528b1e26e5	Duration: 97.27 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 235 MB	
REPORT RequestId: 2a9b1a22-c533-4245-bb07-ba3d05cdc3ed	Duration: 95.62 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 237 MB	
REPORT RequestId: ae94627b-1bc3-4ac8-956c-8fa4b89a6558	Duration: 58.07 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 237 MB	
REPORT RequestId: 4c3a5d88-1b6c-423c-ad55-49d15d5e5770	Duration: 66.07 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 237 MB	
REPORT RequestId: b2aa264d-e475-487d-b2c0-fdf7988c5d35	Duration: 62.71 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 237 MB	
REPORT RequestId: da7238fa-56ae-4e4b-aa54-62ec0cd5c919	Duration: 59.60 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 237 MB	
REPORT RequestId: 130af8e5-e718-4e85-809d-e5ace374d121	Duration: 63.38 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 237 MB	
REPORT RequestId: 9b3246c0-2539-4fa2-8157-4f6ee41442a0	Duration: 58.21 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 237 MB	
REPORT RequestId: ac15a2c1-50f8-407a-974b-4e5d1de0ec70	Duration: 54.75 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 237 MB	
REPORT RequestId: f4a32f00-71eb-4a07-8dcb-4222e4061a07	Duration: 67.81 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 237 MB	
REPORT RequestId: a70b3ec4-3241-4ff9-b22e-a35ff28be431	Duration: 61.15 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 237 MB	
REPORT RequestId: 647ef504-6e95-4c57-80c7-0ba2c9d5c60b	Duration: 55.79 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 237 MB	
REPORT RequestId: 415077c8-4cd2-4247-93ce-26aed3d942ec	Duration: 55.58 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 238 MB	
REPORT RequestId: a0331502-d828-4ac4-a96b-f275bdd6309d	Duration: 57.94 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 238 MB	
REPORT RequestId: 3eeb2609-b6a0-48b3-975c-e4c0d719be51	Duration: 59.96 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 238 MB	
REPORT RequestId: 6945be5e-9520-4051-97be-ce1b27ce58e9	Duration: 55.98 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 238 MB	
REPORT RequestId: 802dee4b-9d91-4af2-bb5b-d6b1355e0018	Duration: 56.84 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 238 MB	
REPORT RequestId: 14a4cdd6-ca7d-4126-8d63-c36736c66812	Duration: 57.58 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 238 MB	
REPORT RequestId: 31d166dc-098f-447f-8a8d-97dcd4e62aa6	Duration: 64.94 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 238 MB	
REPORT RequestId: 0e7ecfdf-552f-4db4-82ff-353c9a7bcb8e	Duration: 68.39 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 239 MB	
REPORT RequestId: 37fa5a7e-0fa8-4e79-9445-85446ed110dd	Duration: 59.20 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 239 MB	
REPORT RequestId: b1e9a9ed-2715-438b-bf12-4753c907f2fd	Duration: 60.40 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 240 MB	
REPORT RequestId: 828d08e2-9319-4f37-9a9d-95cb728d7a4d	Duration: 77.41 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 240 MB	
REPORT RequestId: df73c4af-25d7-4e5d-94f3-05154ab7c090	Duration: 60.52 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 240 MB	
REPORT RequestId: bd6042a5-3f48-4a1b-a9fb-d37a313d7fce	Duration: 63.27 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 240 MB	
REPORT RequestId: b9beef3b-25d7-4f4c-8104-f817b10c22ad	Duration: 58.05 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 240 MB	
REPORT RequestId: 45794d52-1ba5-43c5-b145-732f97abba68	Duration: 59.73 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 241 MB	
REPORT RequestId: 500c93b7-d863-4d7e-b5c4-042e4076a890	Duration: 64.11 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 241 MB	
REPORT RequestId: 8cf95085-06b0-4e07-afbe-9ecfe78f4c88	Duration: 74.42 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 241 MB	
REPORT RequestId: e658ccfa-1e4e-48c3-a018-87a0d10c49ac	Duration: 85.61 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 241 MB	
REPORT RequestId: b13866da-15c8-4673-a385-a60e13f3fe18	Duration: 80.46 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 241 MB	
REPORT RequestId: bf733e13-f574-4029-bda0-b8f3c7d02d3e	Duration: 82.03 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 242 MB	
REPORT RequestId: eaccbe11-4bb0-44ea-a681-dd882fee0bfe	Duration: 54.94 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 243 MB	
REPORT RequestId: cb251ae7-2f85-47a5-b764-4065bd11092a	Duration: 58.91 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 243 MB	
REPORT RequestId: aa99c682-c58c-4e39-a0c5-eaad9fa6793d	Duration: 73.47 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 244 MB	
REPORT RequestId: c05d6c5c-31e7-4822-b0b4-e29bd404f24b	Duration: 62.85 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 244 MB	
REPORT RequestId: 3fedaaad-1a9f-40e6-80aa-6a3578b4b83f	Duration: 57.31 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 244 MB	
REPORT RequestId: da1927dd-5e52-46d2-84d7-176e35fe1d45	Duration: 66.51 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 244 MB	
REPORT RequestId: 688f2d99-168d-470f-a551-d1201cf43f95	Duration: 59.51 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 244 MB	
REPORT RequestId: 7cd956a2-fc50-46bd-b156-a5aa60adc1b9	Duration: 60.96 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 244 MB	
REPORT RequestId: 5b4a4027-baf5-44ac-9af6-b7323a7b490e	Duration: 70.57 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 246 MB	
REPORT RequestId: 7e0c7335-0f72-44b9-bc52-d1bdf1000b24	Duration: 77.86 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 247 MB	
REPORT RequestId: 60b02ca9-a28d-4578-b0c7-2075990a43c5	Duration: 59.11 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 247 MB	
REPORT RequestId: 520e0dad-bad0-4390-aadb-d6c2bb505261	Duration: 57.45 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 247 MB	
REPORT RequestId: 80d424d2-e8c0-437c-a264-486905118bf7	Duration: 57.50 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 247 MB	
REPORT RequestId: 7164cf60-9f17-4a70-9ee5-b70e8a852315	Duration: 63.44 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 247 MB	
REPORT RequestId: f5c366f8-03dd-486b-a844-c514c46e2446	Duration: 65.48 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 248 MB	
REPORT RequestId: 0cdb4327-475f-467b-938a-b8735c04f317	Duration: 61.58 ms	Billed Duration: 100 ms	Memory Size: 3008 MB	Max Memory Used: 248 MB	
...

#2

Interesting and Bummer! Will have to investigate. Unsure when though. Am interested in what others find too. Code is rarely perfect, including Jets.

Here’s an article that talks about handling memory leaks on more traditional servers. https://blog.codeship.com/debugging-a-memory-leak-on-heroku/

The puma_worker_killer is a pragmatic bandaid. Previously have added things like unicorn killers on traditional servers. Funny story. My young daughter was like “unicorn what?” when she happened to overhear me at the time.

This is also one of the reasons Heroku recycles their dynos every 24 hours. Imagine running your MacBook for 3 months without a restart. It’ll probably have some memory bloat.

At least it takes some time, and Lambda essentially self heals it. Lambda function cycling is already like a puma_worker_killer or dyno restart. Don’t have as much control over it, though.

In any case, should try to have memory usage flatline like in the charts of the article. Not good to have memory grow too quickly that it hits the limit before Lambda cycles the function, IE: cold start. Think cold states occur every 5-6 hours for active apps. On idle apps it can be as fast as 45m. It varies.

Wondering how long does it take and how many requests before it hits the memory limit in your observation? That data point may be helpful. Wondering what percentage of requests are affected.


#3

I can easily reproduce the memory problem locally by starting the jets server (bundle exec jets server) and doing curl calls with the watch utility (watch -n 0.1 curl http://...) on my TestController. The memory used just keeps going up.