Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publishing a module which has a submodule without a source field fails and causes Citizen to spike to 100% CPU usage until restarted. #131

Open
xRokco opened this issue Jan 31, 2024 · 0 comments

Comments

@xRokco
Copy link

xRokco commented Jan 31, 2024

Hi,

I have an issue which is causing some Citizen degradation as well as failed module publishing.

Consider the following main.tf:

module "submodule" {}

It includes a module block missing the required source parameter. This is invalid Terraform (it passes terraform fmt but fails terraform validate), however when I try to publish this is causes the publish to hang before eventually failing:

WARNING:root:2024-01-31T10:25:27.056Z citizen:client Target citizen registry server: [REDACTED]
- compress the terraform module
2024-01-31T10:25:27.079Z citizen:client files to compress: [ 'main.tf' ]
✔ compress the terraform module
- publish managed-elasticsearch/test/preview/202401.31.37523-dev0
2024-01-31T10:25:27.083Z citizen:client send post request to : [REDACTED]
✖ publish managed-elasticsearch/test/preview/202401.31.37523-dev0
RequestError: Unexpected token < in JSON at position 0
    at Request._error (/snapshot/citizen/node_modules/got/dist/source/core/index.js:1194:21)
    at /snapshot/citizen/node_modules/got/dist/source/core/index.js:1276:23
    at JSON.parse (<anonymous>)
    at /snapshot/citizen/lib/module/module.js
    at Request._error (/snapshot/citizen/node_modules/got/dist/source/core/index.js:1190:31)
    at /snapshot/citizen/node_modules/got/dist/source/core/index.js:1276:23
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 'ERR_GOT_REQUEST_ERROR',
  timings: {
    start: 1706696727090,
    socket: 1706696727092,
    lookup: 1706696727096,
    connect: 1706696727097,
    secureConnect: 1706696727816,
    upload: 1706696727825,
    response: 1706696788087,
    end: 1706696788097,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 2,
      dns: 4,
      tcp: 1,
      tls: 719,
      request: 9,
      firstByte: 60262,
      download: 10,
      total: 61007
    }
  }
}

It also causes the Citizen server to essentially crash:
image

Requiring a terraform validate pass before a module can be published could be argued to be reasonable, but being able to DDOS the server with a dodgy publish is probably an issue.

We're still on version 0.5 of Citizen but I will try to upgrade to version 0.6 to test if this still happens there.

@xRokco xRokco changed the title Publishing a module which has a submodule without a source field fails and causes Citizen to spike to 100% usage until restarted. Publishing a module which has a submodule without a source field fails and causes Citizen to spike to 100% CPU usage until restarted. Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant