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

terraform-provider-azurerm plugin crashed with out of memory error while there is ~6 Gbyte of free RAM #21414

Open
1 task done
szpeter80 opened this issue Apr 13, 2023 · 0 comments

Comments

@szpeter80
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.4.5

AzureRM Provider Version

3.51.0

Affected Resource(s)/Data Source(s)

azurerm_storage_blob

Terraform Configuration Files

resource "azurerm_storage_account" "clustersto" {
  name                     = "clustersto"
  location                 = var.location
  resource_group_name      = var.resource_group_name
  
  account_tier             = "Standard"
  account_replication_type = "LRS"

  tags = var.tags
}

resource "azurerm_storage_container" "container--artifacts" {
  name                  = "artifacts"
  storage_account_name  = azurerm_storage_account.clustersto.name
  #container_access_type = "private"
}

# https://thomasthornton.cloud/2022/07/11/uploading-contents-of-a-folder-to-azure-blob-storage-using-terraform/
resource "azurerm_storage_blob" "fcos-vhd" {
  timeouts {
    create = "5m"
    update = "5m"
    delete = "5m"
  }

  name                   = "fcos.vhd"
  storage_account_name   = azurerm_storage_account.clustersto.name
  storage_container_name = azurerm_storage_container.container--artifacts.name
  type                   = "Block"
  source                 = "../fcos.vhd"
  #content_md5            = filemd5("../fcos.vhd") 
}

Debug Output/Panic Output

Stack trace from the terraform-provider-azurerm_v3.51.0_x5 plugin:

fatal error: runtime: out of memory

<snip>

goroutine 54 [running]:
runtime.systemstack_switch()
        runtime/asm_amd64.s:459 fp=0xc00852b5f8 sp=0xc00852b5f0 pc=0x464860
runtime.(*mheap).alloc(0x0?, 0x0?, 0x88?)
        runtime/mheap.go:904 +0x65 fp=0xc00852b640 sp=0xc00852b5f8 pc=0x427f05
runtime.(*mcache).allocLarge(0x4d4e11?, 0x280000200, 0x1)
        runtime/mcache.go:233 +0x85 fp=0xc00852b690 sp=0xc00852b640 pc=0x417245
runtime.mallocgc(0x280000200, 0x60827e0, 0x1)
        runtime/malloc.go:1029 +0x57e fp=0xc00852b708 sp=0xc00852b690 pc=0x40d49e
runtime.makeslice(0xc001bef408?, 0xc00852b790?, 0x4610ff?)
        runtime/slice.go:103 +0x52 fp=0xc00852b730 sp=0xc00852b708 pc=0x44cef2
github.com/tombuildsstuff/giovanni/storage/2019-12-12/blob/blobs.Client.PutBlockBlobFromFile({{{0x7619bc0, 0xc008702a00}, {0x761bee0, 0xc003b37b90}, 0x0, 0x0, 0x6fc23ac00, 0xd18c2e2800, 0x3, 0x6fc23ac00, ...}, ...}, ...)
        github.com/tombuildsstuff/giovanni@v0.20.0/storage/2019-12-12/blob/blobs/put_block_blob_file.go:18 +0x10a fp=0xc00852b8a0 sp=0xc00852b730 pc=0x3f5c42a
github.com/hashicorp/terraform-provider-azurerm/internal/services/storage.BlobUpload.uploadBlockBlob({0xc008752960, {0xc00030aa60, 0xa}, {0xc00030aa00, 0x8}, {0xc00030aa70, 0x9}, {0xc00030aab0, 0x5}, {0x0, ...}, ...}, ...)
        github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/blobs.go:161 +0x2e6 fp=0xc00852bb10 sp=0xc00852b8a0 pc=0x5b06a26
github.com/hashicorp/terraform-provider-azurerm/internal/services/storage.BlobUpload.Create({0xc008752960, {0xc00030aa60, 0xa}, {0xc00030aa00, 0x8}, {0xc00030aa70, 0x9}, {0xc00030aab0, 0x5}, {0x0, ...}, ...}, ...)
        github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/blobs.go:65 +0x1c8 fp=0xc00852bc00 sp=0xc00852bb10 pc=0x5b059a8
github.com/hashicorp/terraform-provider-azurerm/internal/services/storage.resourceStorageBlobCreate(0xc00030ef80, {0x61d4be0?, 0xc003a64800})
        github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_blob_resource.go:219 +0x1068 fp=0xc00852ce70 sp=0xc00852bc00 pc=0x5b41048
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x762b1c0?, {0x762b1c0?, 0xc003e8ed50?}, 0xd?, {0x61d4be0?, 0xc003a64800?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/resource.go:695 +0x178 fp=0xc00852cee8 sp=0xc00852ce70 pc=0xaa5378
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc002346fc0, {0x762b1c0, 0xc003e8ed50}, 0xc000333ba0, 0xc00030ee00, {0x61d4be0, 0xc003a64800})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/resource.go:837 +0xa85 fp=0xc00852d268 sp=0xc00852cee8 pc=0xaa6685
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0023b2510, {0x762b1c0?, 0xc003e8ec30?}, 0xc0003193b0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/grpc_provider.go:1021 +0xe8d fp=0xc00852d508 sp=0xc00852d268 pc=0xa9ef2d
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0022a7720, {0x762b1c0?, 0xc003e8e420?}, 0xc00033ea10)
        github.com/hashicorp/terraform-plugin-go@v0.14.3/tfprotov5/tf5server/server.go:818 +0x574 fp=0xc00852d9d8 sp=0xc00852d508 pc=0x960274
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x69311c0?, 0xc0022a7720}, {0x762b1c0, 0xc003e8e420}, 0xc00033e9a0, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.14.3/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170 fp=0xc00852da30 sp=0xc00852d9d8 pc=0x946350
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00055c000, {0x763b6e0, 0xc000102d00}, 0xc000378b40, 0xc002465f20, 0xbb8d320, 0x0)
        google.golang.org/grpc@v1.51.0/server.go:1340 +0xd23 fp=0xc00852de48 sp=0xc00852da30 pc=0x8ac9c3
google.golang.org/grpc.(*Server).handleStream(0xc00055c000, {0x763b6e0, 0xc000102d00}, 0xc000378b40, 0x0)
        google.golang.org/grpc@v1.51.0/server.go:1713 +0xa2f fp=0xc00852df68 sp=0xc00852de48 pc=0x8b1a6f
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/grpc@v1.51.0/server.go:965 +0x98 fp=0xc00852dfe0 sp=0xc00852df68 pc=0x8aa458
runtime.goexit()
        runtime/asm_amd64.s:1594 +0x1 fp=0xc00852dfe8 sp=0xc00852dfe0 pc=0x466941
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.51.0/server.go:963 +0x28a

Expected Behaviour

The large file "../fcos.vhd" should be present in the destination container

Actual Behaviour

Terraform apply results in OOM stack trace. The "../fcos.vhd" is a Fedora Core OS image and ~10Gbyte in size, the machine has ~7Gbyte of free memory. It seems that the resource provider tries to pull the file into memory before upload and rightfully crashes trying to do so.

If this is a by-design limitation then it would be nice to receive a hint (eg. "The current amount of memory might not be large enough to sucessfully execute the operation") during "terraform plan".

Steps to Reproduce

No response

Important Factoids

none

References

No response

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

No branches or pull requests

3 participants