Skip to content

Reaching maximum amount of containers after upgrade from 3.3.0 to 3.5.0 #1745

Closed

Description

@xtreme-peter-iskandar

Bug Report

  • Concourse version: 3.5.0
  • Deployment type (BOSH/Docker/binary): BOSH
  • Infrastructure/IaaS: AWS
  • Did this used to work?: Yes

We upgraded our concourse from version 3.3 to 3.5 and then our concourse deployment would quickly fill up the number of containers that its creating.
We did the upgrade about a week ago actually, and the auto migration seemed to work. then we recreated and did the backup and restore flow described in https://docs.pivotal.io/p-concourse/backing-up.html

In a day we went from 800 containers to over 2500. Our concourse is now saying "max containers reached" and we cannot run our builds. We tried recreating our workers bosh recreate worker and that cleaned up the containers but they were all quickly recreated.

The output when we run fly containers is as follows:

0011ac5f-e246-4ee1-4cc2-ffcca6332c35  5766c8c0-c7b3-4daa-a656-0f402b44c66a  none                          none                                 none  none   check  none                          n/a
0038a6be-e426-414f-4b1b-0fc45a2dc299  c5509744-c9ae-4e7b-b148-fc9e3c4b33fc  none                          none                                 none  none   check  none                          n/a
0040b484-53cc-475e-772d-c97ec1896922  06390bf1-c338-40a8-972a-2a276e4d0627  none                          none                                 none  none   check  none                          n/a
0063bf3d-5174-4f2e-43eb-3ed7f48f7567  06390bf1-c338-40a8-972a-2a276e4d0627  none                          none                                 none  none   check  none                          n/a
0072dc30-8a7c-4155-6914-139c23284ed6  06390bf1-c338-40a8-972a-2a276e4d0627  none                          none                                 none  none   check  none                          n/a
0083623d-55b4-4aef-53fc-709532e52639  beb3e740-f7bd-4369-bc10-0d2bd844169d  none                          none                                 none  none   check  none                          n/a
0084aa97-f242-48e5-7f07-aafe8630814f  d328178f-0143-409c-8151-4e156e191590  none                          none                                 none  none   check  none                          n/a
0087aa2b-e39d-452f-719a-4adbc786e04c  c5509744-c9ae-4e7b-b148-fc9e3c4b33fc  none                          none                                 none  none   check  none                          n/a
00a217b2-ebe3-4f86-56bb-c5a4eddd1cdd  06390bf1-c338-40a8-972a-2a276e4d0627  none                          none                                 none  none   check  none                          n/a
00b95eb5-8287-4bb0-42ba-dababeefa519  beb3e740-f7bd-4369-bc10-0d2bd844169d  none                          none                                 none  none   check  none                          n/a
00d86c85-5bb4-46cb-4ddf-99c192003c52  5766c8c0-c7b3-4daa-a656-0f402b44c66a  none                          none                                 none  none   check  none                          n/a
00eefced-1159-4909-4dd9-4b82834170eb  06390bf1-c338-40a8-972a-2a276e4d0627  none                          none                                 none  none   check  none                          n/a
00ffa4f2-a35a-4b49-6eec-048d753dbaf5  c5509744-c9ae-4e7b-b148-fc9e3c4b33fc  none                          none                                 none  none   check  none                          n/a
014550db-fda0-4a79-5ea2-3290a562a2ec  beb3e740-f7bd-4369-bc10-0d2bd844169d  none                          none                                 none  none   check  none                          n/a
0162f264-db96-4124-4e7f-963cf4e612fb  beb3e740-f7bd-4369-bc10-0d2bd844169d  none                          none                                 none  none   check  none                          n/a
018cf27f-3c42-40e3-60af-ffdf94e4a7bf  beb3e740-f7bd-4369-bc10-0d2bd844169d  none                          none                                 none  none   check  none                          n/a
01bc8d80-abe3-4f4e-6252-e1ff1a707cd8  d328178f-0143-409c-8151-4e156e191590  none                          none                                 none  none   check  none                          n/a
01e0b6a5-86ce-45b3-6649-53a1574307b6  06390bf1-c338-40a8-972a-2a276e4d0627  none                          none                                 none  none   check  none                          n/a
01e1310e-2a57-4eea-5299-95e1a58e5572  06390bf1-c338-40a8-972a-2a276e4d0627  none                          none                                 none  none   check  none                          n/a
0206b516-e117-44f0-4f7d-633078fb6abc  5766c8c0-c7b3-4daa-a656-0f402b44c66a  none                          none                                 none  none   check  none                          n/a
02091f1a-7fc9-4f9b-417d-d9acfd649248  06390bf1-c338-40a8-972a-2a276e4d0627  none                          none                                 none  none   check  none                          n/a
0223494a-c47e-4f34-402b-83369bf4cec9  c5509744-c9ae-4e7b-b148-fc9e3c4b33fc  none                          none                                 none  none   check  none                          n/a
0229d160-4a36-4cc3-7b63-fa1f5ef0db4f  beb3e740-f7bd-4369-bc10-0d2bd844169d  none                          none                                 none  none   check  none                          n/a
023e1c19-6bc3-4a24-4369-a918eecadba3  d328178f-0143-409c-8151-4e156e191590  none                          none                                 none  none   check  none                          n/a
024dad93-af86-4a12-566a-e80c86eb0d9a  beb3e740-f7bd-4369-bc10-0d2bd844169d  none                          none                                 none  none   check  none                          n/a
025ee7f5-5679-43ed-6549-c448048572d4  d328178f-0143-409c-8151-4e156e191590  none                          none                                 none  none   check  none                          n/a
0267b932-fdce-4272-7fc1-1e951134e28d  c5509744-c9ae-4e7b-b148-fc9e3c4b33fc  none                          none                                 none  none   check  none                          n/a
02714774-0170-4669-60fd-626056ec43b6  5766c8c0-c7b3-4daa-a656-0f402b44c66a  none                          none                                 none  none   check  none                          n/a
028fa1ef-eaff-442a-7ea8-70c78eed9c42  c5509744-c9ae-4e7b-b148-fc9e3c4b33fc  none                          none                                 none  none   check  none                          n/a
029b92f5-6df3-44cf-6df4-ae4162f530c0  d328178f-0143-409c-8151-4e156e191590  none                          none                                 none  none   check  none                          n/a
02be535e-3994-49f8-61f4-9c3a088c7550  06390bf1-c338-40a8-972a-2a276e4d0627  none                          none                                 none  none   check  none                          n/a
02ccd0d8-6bad-4a5a-6e90-ca15203a2afd  c5509744-c9ae-4e7b-b148-fc9e3c4b33fc  none                          none                                 none  none   check  none                          n/a
02dedeb7-33a5-4aaa-60d2-3e8d10fe04a7  06390bf1-c338-40a8-972a-2a276e4d0627  none                          none                                 none  none   check  none                          n/a
02e8150a-5d4d-4943-4df8-de9899bc28c5  c5509744-c9ae-4e7b-b148-fc9e3c4b33fc  none                          none                                 none  none   check  none                          n/a
03062590-8506-4794-4c81-3c871bc6c05f  c5509744-c9ae-4e7b-b148-fc9e3c4b33fc  none                          none                                 none  none   check  none                          n/a
030b4ca9-b2f8-4eb9-46dc-29d3db4b7c5e  d328178f-0143-409c-8151-4e156e191590  none                          none                                 none  none   check  none                          n/a
0355d13a-9549-4bc7-4efc-86bbda625a65  d328178f-0143-409c-8151-4e156e191590  none                          none                                 none  none   check  none                          n/a
038ce17a-ae5b-4b34-58a2-9b71554bd5fb  5766c8c0-c7b3-4daa-a656-0f402b44c66a  none                          none                                 none  none   check  none                          n/a
040cd23e-e24b-4984-5de9-99e32caf3ebd  c5509744-c9ae-4e7b-b148-fc9e3c4b33fc  none                          none                                 none  none   check  none                          n/a
0411d95f-080a-4d90-5b9b-25c2be9776ae  06390bf1-c338-40a8-972a-2a276e4d0627  none                          none                                 none  none   check  none                          n/a
0419f11a-2ee7-4657-4686-a5b1e7827355  beb3e740-f7bd-4369-bc10-0d2bd844169d  none                          none                                 none  none   check  none                          n/a
044ebba6-9255-47c9-6a0e-e34b05b10d62  d328178f-0143-409c-8151-4e156e191590  none                          none                                 none  none   check  none                          n/a
0464f7a4-a96c-43ed-4ab6-ba87dce6c441  06390bf1-c338-40a8-972a-2a276e4d0627  none                          none                                 none  none   check  none                          n/a
046839ee-65f1-40c4-6811-285f17230f13  d328178f-0143-409c-8151-4e156e191590  none                          none                                 none  none   check  none                          n/a
048758ed-783d-4cd6-405c-3dbebebed700  c5509744-c9ae-4e7b-b148-fc9e3c4b33fc  none                          none                                 none  none   check  none                          n/a
0488bc26-db20-4718-6c20-021e99898a5c  beb3e740-f7bd-4369-bc10-0d2bd844169d  none                          none                                 none  none   check  none                          n/a
049fb135-5270-4c8f-51c0-8fd26c355255  c5509744-c9ae-4e7b-b148-fc9e3c4b33fc  none                          none                                 none  none   check  none                          n/a
04b76e50-4e26-4a90-68ae-55ec0de3230c  d328178f-0143-409c-8151-4e156e191590  none                          none                                 none  none   check  none                          n/a
04dff4e4-92f7-4e65-40a3-8a1d1894f2fc  d328178f-0143-409c-8151-4e156e191590  none                          none                                 none  none   check  none                          n/a
04e0573f-c77b-4619-657d-f192e869bf6b  beb3e740-f7bd-4369-bc10-0d2bd844169d  none                          none                                 none  none   check  none                          n/a
050094e8-8b56-42af-4174-8fde6ba67307  c5509744-c9ae-4e7b-b148-fc9e3c4b33fc  none                          none                                 none  none   check  none                          n/a
054540e1-36fc-4be3-576d-398b93b7e429  c5509744-c9ae-4e7b-b148-fc9e3c4b33fc  none                          none                                 none  none   check  none                          n/a

Activity

  1. vito commented on Oct 26, 2017

    @vito
    Contributor

    Do you have a metrics stack configured? It may help in monitoring cases like this.

    You would need to:

    • Deploy InfluxDB and Grafana and optionally Telegraf co-located on each job (you could do this with a runtime-config).
    • Configure the ATC's influxdb properties.
    • Set up a Grafana data source pointing to InfluxDB, and put together a dashboard. You can steal our Dashboard JSON and switch the data source to the one you created.

    (Sorry we don't have a great doc outlining these steps.)

  2. vito commented on Oct 26, 2017

    @vito
    Contributor

    @xtreme-peter-iskandar Can you check in the ATC logs (/var/vcap/sys/log/atc/atc.stdout.log) for any recurring failures? (grep failed or "log_level":2 should be a good start).

    Just to estimate the numbers, can you also provide some idea of how many containers there should be? I doubt there would legitimately that many, but it helps to know what order of magnitude to expect (like, 20 -> 2500 would be a pretty quick leak). There should be one per resource across all pipelines, plus ones for in-flight builds (one per get, put, task).

  3. vito commented on Oct 27, 2017

    @vito
    Contributor

    Resolved in-person. This one was 👻 spooky👻 .

    Similar to #1542, there was a foreign key constraint missing. On a different table though. The missing constraint was worker_resource_config_check_sessions (resource_config_check_session_id) => resource_config_check_sessions (id).

    Make note of how long that is.

    With no foreign key constraint, expiring resource_config_check_sessions will not cascade to deleting the worker_resource_config_check_session, which is what check containers point to. This happens every hour for every resource. This means that the number of check countainers would increase by (N check containers) every hour.

    Here's the theory:

    • The upgrade to Postgres 9.5 was performed. I'd be surprised if this dropped the constraint, as we've performed the upgrade without this issue.
    • Later, a full database dump and restore was performed. I think this is when the leak began.
    • Postgres has a length limit on identifiers of 63. Looking at the schema, we saw an index called worker_resource_config_check_sessions_resource_config_check_ses, but no foreign key.
    • The foreign key should totally be there, and it would have the same name, as both the generated fkey name and the index name are the same when truncated to 63 characters.

    My theory is that the pg_dump mistakenly only dumped one of them, because they had the same name.

    We fixed it by simply adding the foreign key back, but I would recommend that anyone in a similar scenario do a dump of just the data, deploy a fresh concourse, let it initialize the schema, and then restore the data.

  4. jhohiii commented on Mar 23, 2018

    @jhohiii

    @vito
    I am having this issue. Do you recall the commands you issued to 'add the foreign key back'?
    Also, how do you 'dump just the data'? I may be able to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions