Skip to content

CloudHSM JavaSDK5 - Connecting to the cluster

0

Summary: The client attempts to connect when any node is DELETE_IN_PROGRESS. Details: Before initializing CloudHsmProvider (cloudhsm-jce-5.16.1.jar), we invoke DescribeClustersRequest (cloudhsmv2) and filter the endpoints to include only ACTIVE HSMs. Despite that, the connection manager initiates and persists with long-running connection attempts to HSMs that are in the deletion state. OptionalParameters.KEY_AVAILABILITY_CHECK = true Expected behavior: Only connect to ACTIVE HSMs; ignore nodes in DELETE_IN_PROGRESS. Actual behavior: Long-running connection attempts are made to HSMs in DELETE_IN_PROGRESS, impacting initialization.

2025-09-23T14:03:09.155Z WARN [1] ThreadId(4) [cloudhsm_utils::retry][0]["CloudHSM-04ef5877-c28c-410c-a7b6-a0f04fe90e6e"] Receive error: Timeout trying to establish connection with the server.. For Operation tls_connect_with_timeout. Going to retry. Attempts 0/3

The initialization seems normal when we're adding a new node (2 -> 3) Can I configure the client somehow to make it connected to available nodes?

1 Answer
0

This issue occurs when the CloudHSM client attempts to connect to HSMs that are in DELETE_IN_PROGRESS state, causing delays and connection timeouts during initialization.

There are a few approaches you can take to address this:

  1. Disable the key availability check by using the --disable-key-availability-check parameter in your configure tool. This can be set in the configuration file for your JCE provider. When using the configure-jce tool, you can specify this option to disable key availability checks during key use.

  2. The key availability check is likely causing the client to attempt connections to all HSMs in the cluster, including those in DELETE_IN_PROGRESS state. By disabling this check, you may avoid these connection attempts.

  3. If you're using Client SDK 5.8 or above but below 5.16.2, be aware that there was a known issue where the SDK would not retry some HSM throttled operations. This has been resolved in Client SDK 5.16.2 and later, so upgrading to at least this version might help with connection handling.

  4. As a best practice, maintain at least three HSMs in your cluster. This provides better availability and can help mitigate issues when one HSM is being deleted or replaced.

  5. If you're using the JCE provider, you could try creating your CloudHsmProviderConfig with specific configuration options that might help control connection behavior.

The long-running connection attempts to HSMs in DELETE_IN_PROGRESS state are likely related to how the client handles key availability checks across the cluster. By disabling these checks or ensuring you have enough active HSMs, you should be able to improve the initialization experience.
Sources
AWS CloudHSM error seen during key availability check - AWS CloudHSM
AWS CloudHSM Client SDK 5 configuration syntax - AWS CloudHSM
Known issues for AWS CloudHSM hsm2m.medium instances - AWS CloudHSM

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.