WiIIiam278 / PAPIProxyBridge

A bridge library plugin for using PlaceholderAPI on proxy servers
https://william278.net/project/papiproxybridge
Apache License 2.0
37 stars 11 forks source link

Retries are broken #131

Closed Apehum closed 2 months ago

Apehum commented 4 months ago

If the backend server doesn't have the PAPIProxyBridge plugin installed, formatPlaceholders will get stuck forever due to a deadlock caused by retries

You can reproduce this deadlock using the following example (using Kotlin):

import java.util.concurrent.CompletableFuture
import java.util.concurrent.TimeUnit

fun main() {
    test(3).get()
}

fun test(times: Int): CompletableFuture<Void> =
    CompletableFuture<Void>()
        .orTimeout(50L, TimeUnit.MILLISECONDS)
        .exceptionally {
            println("Test $times")
            test(times - 1).get()
        }

The easiest fix is to use exceptionallyAsync instead of exceptionally, but maybe you have better ideas on how to fix it

WiIIiam278 commented 2 months ago

Fixed in #141