Using clientV2. What does `merge-config-service BROKEN` and how does one resolve it?

0

I have been learning GreenGrass. Rough time. I finally learned how to publish a message to IOT Core and started working on subscribing to a change in shadow. It looks like I have some kind of configuration issue. I dropped all my code and added code from this page at the area:

import sys
import time
import traceback

from awsiot.greengrasscoreipc.clientv2 import GreengrassCoreIPCClientV2
from awsiot.greengrasscoreipc.model import (
    SubscriptionResponseMessage,
    UnauthorizedError
)


def main():

    try:
        ipc_client = GreengrassCoreIPCClientV2()
        # Subscription operations return a tuple with the response and the operation.
        _, operation = ipc_client.subscribe_to_topic(topic='', on_stream_event=on_stream_event,
                                                     on_stream_error=on_stream_error, on_stream_closed=on_stream_closed)
        print('Successfully subscribed to topic: ')

        # Keep the main thread alive, or the process will exit.
        try:
            while True:
                time.sleep(10)
        except InterruptedError:
            print('Subscribe interrupted.')

        # To stop subscribing, close the stream.
        operation.close()
    except UnauthorizedError:
        print('Unauthorized error while subscribing to topic: ')
        traceback.print_exc()
        exit(1)
    except Exception:
        print('Exception occurred', file=sys.stderr)
        traceback.print_exc()
        exit(1)


def on_stream_event(event: SubscriptionResponseMessage) -> None:
    try:
        message = str(event.binary_message.message, 'utf-8')
        topic = event.binary_message.context.topic
        print('Received new message on topic %s: %s' % (topic, message))
    except:
        traceback.print_exc()


def on_stream_error(error: Exception) -> bool:
    print('Received a stream error.', file=sys.stderr)
    traceback.print_exc()
    return False  # Return True to close stream, False to keep stream open.


def on_stream_closed() -> None:
    print('Subscribe to topic stream closed.')


if __name__ == '__main__':
    main()

I started getting these errors:

2022-09-26T22:00:59.732Z [WARN] (pool-2-thread-93) com.aws.greengrass.deployment.DeploymentConfigMerger: merge-config. merge-config-service BROKEN. {serviceName=com.xxxxxxxx.productivity.cycle_count}
2022-09-26T22:00:59.732Z [ERROR] (pool-2-thread-93) com.aws.greengrass.deployment.activator.DeploymentActivator: merge-config. Deployment failed. {deploymentId=085885ea-145f-4b04-86cb-1fac50c84443}
com.aws.greengrass.deployment.exceptions.ServiceUpdateException: Service com.xxxxxxxx.productivity.cycle_count in broken state after deployment
        at com.aws.greengrass.deployment.DeploymentConfigMerger.waitForServicesToStart(DeploymentConfigMerger.java:194)
        at com.aws.greengrass.deployment.activator.DefaultActivator.activate(DefaultActivator.java:84)
        at com.aws.greengrass.deployment.DeploymentConfigMerger.updateActionForDeployment(DeploymentConfigMerger.java:150)
        at com.aws.greengrass.deployment.DeploymentConfigMerger.lambda$mergeInNewConfig$0(DeploymentConfigMerger.java:102)
        at com.aws.greengrass.lifecyclemanager.UpdateSystemPolicyService.runUpdateActions(UpdateSystemPolicyService.java:95)
        at com.aws.greengrass.lifecyclemanager.UpdateSystemPolicyService.lambda$startup$0(UpdateSystemPolicyService.java:169)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

My component configuration looks like this:

{
  "RecipeFormatVersion": "2020-01-25",
  "ComponentName": "com.xxxxxxx.productivity.cycle_count",
  "ComponentVersion": "1.0.091",
  "ComponentType": "aws.greengrass.generic",
  "ComponentDescription": "Simple cycle counting",
  "ComponentPublisher": "xxxxxxxx",
  "ComponentConfiguration": {
    "DefaultConfiguration": {
      "accessControl": {
        "aws.greengrass.ipc.pubsub": {
          "com.xxxxxxxx.productivity.cycle_count:pubsub:1": {
            "policyDescription": "Allows access to publish/subscribe to all topics.",
            "operations": [
              "aws.greengrass#PublishToTopic",
              "aws.greengrass#SubscribeToTopic"
            ],
            "resources": [
              "*"
            ]
          }
        }
      }
    }
  },
  "Manifests": [
    {
      "Platform": {
        "os": "linux"
      },
      "Name": "Linux",
      "Lifecycle": {
        "Run": "python3 -u {artifacts:path}/cycle_count.py"
      },
      "Artifacts": [
        {
          "Uri": "s3://xxxxxxxx/cycle_count.py",
          "Digest": "aRieZLEFNe9fcYrfmMhnLjApeNjop8bn9WlXlzftrpg=",
          "Algorithm": "SHA-256",
          "Unarchive": "NONE",
          "Permission": {
            "Read": "OWNER",
            "Execute": "NONE"
          }
        }
      ]
    }
  ],
  "Lifecycle": {}
}

What is my error here?

flycast
gefragt vor 2 Jahren215 Aufrufe
1 Antwort
1
Akzeptierte Antwort

Hi @flycast,

The service being in the BROKEN state means that the process which your component is running failed and exited with a non-zero exit code 3 times. You should look at the component log file in /greengrass/v2/logs/<component name>.log to know why it is failing.

Cheers, Michael

AWS
EXPERTE
beantwortet vor 2 Jahren
profile pictureAWS
EXPERTE
Greg_B
überprüft vor 2 Jahren
  • That helped. Thank you!

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen