Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

[fix] Use thread-safe list in TransactionMarkerChannelManager #1602

Merged

Conversation

michaeljmarshall
Copy link
Contributor

Motivation

The TransactionMarkerChannelManager#addTxnMarkersToBrokerQueue method modifies an ArrayList from callbacks on futures, which could result in unsafe modification of the list.

Modifications

  • Replace ArrayList with CopyOnWriteArrayList. I chose CopyOnWriteArrayList since it is simple and the expected number of writes to the list is low.

Verifying this change

This change is a trivial rework / code cleanup without any test coverage.

Documentation

  • no-need-doc

This is a simple fix.

@CLAassistant
Copy link

CLAassistant commented Dec 2, 2022

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the no-need-doc This pr does not need any document label Dec 2, 2022
@codecov
Copy link

codecov bot commented Dec 2, 2022

Codecov Report

Merging #1602 (56b51dc) into master (6970ed5) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1602   +/-   ##
=========================================
  Coverage     15.34%   15.34%           
  Complexity      592      592           
=========================================
  Files           164      164           
  Lines         11913    11913           
  Branches       1102     1102           
=========================================
  Hits           1828     1828           
  Misses         9931     9931           
  Partials        154      154           
Impacted Files Coverage Δ
...r/transaction/TransactionMarkerChannelManager.java 0.00% <0.00%> (ø)

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@Demogorgon314 Demogorgon314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@BewareMyPower BewareMyPower merged commit 8cddbf3 into streamnative:master Dec 5, 2022
@michaeljmarshall michaeljmarshall deleted the use-threadsafe-list branch December 8, 2022 06:52
michaeljmarshall added a commit to michaeljmarshall/kop that referenced this pull request Dec 13, 2022
…native#1602)

### Motivation

The `TransactionMarkerChannelManager#addTxnMarkersToBrokerQueue` method
modifies an `ArrayList` from callbacks on futures, which could result in
unsafe modification of the list.

### Modifications

* Replace `ArrayList` with `CopyOnWriteArrayList`. I chose
`CopyOnWriteArrayList` since it is simple and the expected number of
writes to the list is low.

(cherry picked from commit 8cddbf3)
Demogorgon314 pushed a commit that referenced this pull request Feb 7, 2023
### Motivation

The `TransactionMarkerChannelManager#addTxnMarkersToBrokerQueue` method
modifies an `ArrayList` from callbacks on futures, which could result in
unsafe modification of the list.

### Modifications

* Replace `ArrayList` with `CopyOnWriteArrayList`. I chose
`CopyOnWriteArrayList` since it is simple and the expected number of
writes to the list is low.

(cherry picked from commit 8cddbf3)
Demogorgon314 pushed a commit that referenced this pull request Feb 7, 2023
### Motivation

The `TransactionMarkerChannelManager#addTxnMarkersToBrokerQueue` method
modifies an `ArrayList` from callbacks on futures, which could result in
unsafe modification of the list.

### Modifications

* Replace `ArrayList` with `CopyOnWriteArrayList`. I chose
`CopyOnWriteArrayList` since it is simple and the expected number of
writes to the list is low.

(cherry picked from commit 8cddbf3)
Demogorgon314 pushed a commit that referenced this pull request Feb 27, 2023
### Motivation

The `TransactionMarkerChannelManager#addTxnMarkersToBrokerQueue` method
modifies an `ArrayList` from callbacks on futures, which could result in
unsafe modification of the list.

### Modifications

* Replace `ArrayList` with `CopyOnWriteArrayList`. I chose
`CopyOnWriteArrayList` since it is simple and the expected number of
writes to the list is low.

(cherry picked from commit 8cddbf3)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants