cloudfoundry / cloudfoundry/cf-java-client

`ApplicationManifestUtilsV3#write` is not threadsafe

Open
#1,245 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
334
Forks
319
PR merge metrics
No merged PRs in 30d

Description

The method ApplicationManifestUtilsV3#write uses a static snakeyaml Yaml dumper to write all manifests into a byte array. This operation is inheritly not threadsafe, as the deserializer is not.

This in itself may not a be problem. However, when using Applications#pushManifestv3 to push multiple Apps in parallel this can cause issues that manifest in the form of

  • Bad request: Manifest does not support Anchors and Aliases or
  • java.lang.NullPointerException: Nodes must be provided.

Snakeyaml recommends to create a singe instance per thread.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ApplicationManifestUtilsV3#write and the Snakeyaml usage described in the issue, then trace calls from Applications#pushManifestv3. Reproduce parallel manifest pushes and observe the reported anchor/alias or null-pointer failures. Done means concurrent pushes complete without those errors and the behavior is covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.