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

Bug on UpdateAssociatedObjectList(add) #433

Open
jihoon-seo opened this issue Apr 1, 2021 · 0 comments
Open

Bug on UpdateAssociatedObjectList(add) #433

jihoon-seo opened this issue Apr 1, 2021 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@jihoon-seo
Copy link
Member

현재 test/official/sequentialFullTest/testAll-mcis-mcir-ns-cloud.sh 스크립트는
3개의 VM으로 구성되는 1개의 MCIS를 생성합니다.

❯ ./testAll-mcis-mcir-ns-cloud.sh mock 1 jhseo

...
      "targetStatus" : "None",
      "installMonAgent" : "no",
      "masterVmId" : "mock-seoul-jhseo-0",
      "masterIp" : "4.3.2.1",
      "status" : "Running-(3/3)",
      "name" : "mock-seoul-jhseo",
      "targetAction" : "None",
      "id" : "mock-seoul-jhseo"
   }
}

이 스크립트를 실행하면, 먼저

  • vNet
  • securityGroup
  • sshKey
  • image
  • spec

5종류의 CB-Tumblebug MCIR object 를 1개씩 생성하고,
이후 3개의 VM으로 구성되는 1개의 MCIS를 생성하면서
위에서 생성한 MCIR 들의 associatedObjectList 필드를 업데이트 합니다.

What you expected to happen
:

그러므로, associatedObjectList 필드에는 VM 3개의 key가 기록되어 있어야 정상입니다.

❯ ./list-image.sh

{
         "id" : "mock-seoul-jhseo",
         "name" : "mock-seoul-jhseo",
         "cspImageId" : "mock-vmimage-01",
         "associatedObjectList" : [
            "/ns/ns-01/mcis/mock-seoul-jhseo/vm/mock-seoul-jhseo-1",
            "/ns/ns-01/mcis/mock-seoul-jhseo/vm/mock-seoul-jhseo-2",
            "/ns/ns-01/mcis/mock-seoul-jhseo/vm/mock-seoul-jhseo-0"
         ],
         "guestOS" : "Ubuntu",
         "connectionName" : "mock-seoul",
         "keyValueList" : [
            {
               "Key" : "",
               "Value" : ""
            },
            {
               "Key" : "",
               "Value" : ""
            }
         ],
         "isAutoGenerated" : false,
         "description" : "Canonical, Ubuntu, 18.04 LTS, amd64 bionic"
      }
   ]
}

What happened
:
문제는, key가 3개 기록되는 경우도 있고, 간헐적으로 key가 2개 기록되는 경우도 있다는 것입니다.

❯ ./list-image.sh

{
   "image" : [
      {
         "guestOS" : "Ubuntu",
         "description" : "Canonical, Ubuntu, 18.04 LTS, amd64 bionic",
         "cspImageName" : "",
         "name" : "mock-seoul-jhseo",
         "connectionName" : "mock-seoul",
         "id" : "mock-seoul-jhseo",
         "cspImageId" : "mock-vmimage-01",
         "keyValueList" : [
            {
               "Value" : "",
               "Key" : ""
            },
            {
               "Value" : "",
               "Key" : ""
            }
         ],
         "associatedObjectList" : [
            "/ns/ns-01/mcis/mock-seoul-jhseo/vm/mock-seoul-jhseo-0",
            "/ns/ns-01/mcis/mock-seoul-jhseo/vm/mock-seoul-jhseo-2"
         ],
         "isAutoGenerated" : false
      }
   ]
}

[다른 회차]
❯ ./list-image.sh

{
   "image" : [
      {
         "cspImageName" : "",
         "cspImageId" : "mock-vmimage-01",
         "name" : "mock-seoul-jhseo",
         "associatedObjectList" : [
            "/ns/ns-01/mcis/mock-seoul-jhseo/vm/mock-seoul-jhseo-1",
            "/ns/ns-01/mcis/mock-seoul-jhseo/vm/mock-seoul-jhseo-2"
         ],
         "guestOS" : "Ubuntu",
         "keyValueList" : [
            {
               "Value" : "",
               "Key" : ""
            },
            {
               "Key" : "",
               "Value" : ""
            }
         ],
         "description" : "Canonical, Ubuntu, 18.04 LTS, amd64 bionic",
         "isAutoGenerated" : false,
         "connectionName" : "mock-seoul",
         "id" : "mock-seoul-jhseo"
      }
   ]
}

How to reproduce it (as minimally and precisely as possible)
:

❯ ./testAll-mcis-mcir-ns-cloud.sh mock 1 jhseo
❯ ./cleanAll-mcis-mcir-ns-cloud.sh mock 1 jhseo

❯ ./testAll-mcis-mcir-ns-cloud.sh mock 1 jhseo
❯ ./cleanAll-mcis-mcir-ns-cloud.sh mock 1 jhseo
... (repeat)

Anything else we need to know?
:
[추정]

  • CreateMcis 함수는 goroutine 을 사용하여 AddVmToMcis 함수를 실행합니다.
  • AddVmToMcis => CreateVm => UpdateAssociatedObjectList 의 콜체인이 있습니다.
  • UpdateAssociatedObjectList 의 "add" 부분 안에, associatedObjectList 리스트를 읽고 쓰는 동작이 있습니다.
  • 이 때, associatedObjectList 리스트에 대한 락이 없기 때문에, 이런 현상이 생기는 것으로 추정합니다.
    • 예: 거의 동시에 jhseo-0jhseo-1 을 기록하려고 하면,
      거의 동시에 UpdateAssociatedObjectList 함수가 실행되고,
      이 함수 인스턴스에서 associatedObjectList 리스트를 Key-Value store 에서 읽으면
      두 함수 인스턴스 모두에서 associatedObjectList 리스트가 비어 있는 것으로 나옴.
      두 함수 인스턴스가 각각 jhseo-0jhseo-1 을 기록하고 Key-Value store 에 저장하면,
      둘 중 빨리 수행된 쪽의 결과만 남게 됨

Environment

  • Source version or branch:
  • OS:
  • Others:

Proposed solution
:

  • lock ?
  • critical section ?

Any other context
:

@jihoon-seo jihoon-seo added the bug Something isn't working label Apr 1, 2021
@seokho-son seokho-son added the enhancement New feature or request label Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Development

No branches or pull requests

2 participants