-
Bug
-
Resolution: Fixed
-
P4
-
None
-
b25
The HttpClient uses synchronized at places where it is not needed - or potentially harmful.
The Utils.remaining(List<ByteBuffer> list) method assumes that it can and should synchronize on the given list to prevent concurrent modification. In 99% of the cases this assumption is wrong. There's only one such list (the SSLFlowDelegate writeList) that requires this synchronization.
In some circumstances, the list operated on can be one returned by List.of() which could become value-based - and that could stop working once value-based lists are implemented.
The `SequentialScheduler.synchronizedScheduler` uses `synchronized` for visibility. It could use a Lock for the same purpose and this would make it possible to assert that there is no contention (since the logic of the SequentialScheduler should prevent contention from occurring at this place).
The Utils.remaining(List<ByteBuffer> list) method assumes that it can and should synchronize on the given list to prevent concurrent modification. In 99% of the cases this assumption is wrong. There's only one such list (the SSLFlowDelegate writeList) that requires this synchronization.
In some circumstances, the list operated on can be one returned by List.of() which could become value-based - and that could stop working once value-based lists are implemented.
The `SequentialScheduler.synchronizedScheduler` uses `synchronized` for visibility. It could use a Lock for the same purpose and this would make it possible to assert that there is no contention (since the logic of the SequentialScheduler should prevent contention from occurring at this place).