CloudNetService / CloudNet

A modern application that can dynamically and easily deliver Minecraft oriented software
https://cloudnetservice.eu
Apache License 2.0
376 stars 119 forks source link

fix: use high timeout for query packets instead of weak values #1500

Closed 0utplay closed 1 month ago

0utplay commented 1 month ago

Motivation

The new implementation of query packets resulted in possible dead locks. The dead locks were caused, when the QueryPacketManager lost the reference to the stored future, because the answer to the query would never be handled as the entry in the map is lost.

Modification

Removed the weakValues option from the backing cache and use a really high timeout of 8 hours for cache invalidation. Usually the cache should be empty so the high timeout value is not a problem.

Result

No more deadlocks with query packets.

Other context

Fixes #1480

github-actions[bot] commented 1 month ago

Test Results

 48 files  ±0   48 suites  ±0   1m 48s :stopwatch: +2s 420 tests ±0  420 :white_check_mark: ±0  0 :zzz: ±0  0 :x: ±0  751 runs  ±0  751 :white_check_mark: ±0  0 :zzz: ±0  0 :x: ±0 

Results for commit bff46262. ± Comparison against base commit 1ef60bed.

This pull request removes 38 and adds 38 tests. Note that renamed tests count towards both. ``` eu.cloudnetservice.driver.document.DocumentSerialisationTest ‑ [4] {"b":1,"s":2,"i":3,"l":4,"f":5.0,"d":6.0,"c":"/","string":"Hello, World!","bol":true,"cloud":["Ben?","Yes","No","HoHoHoHo"],"world":{"this":"is","hello":"world","insane":"!"}}, PRETTY eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [14] 2024-08-30 eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [23] 22:04:34.738252958 eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [28] 22:04:34.738398119Z eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [29] 22:04:34.738422675Z eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [30] 22:04:34.738445197+05:00 eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [31] 22:04:34.738465044-03:00 eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [34] 2024-08-30T22:04:34.738486614 eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [39] 2024-08-30T22:04:34.738606378Z eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [4] 2024-08-30T22:04:34.738013952Z … ``` ``` eu.cloudnetservice.driver.document.DocumentSerialisationTest ‑ [4] {"b":1,"s":2,"i":3,"l":4,"f":5.0,"d":6.0,"c":"/","string":"Hello, World!","bol":true,"cloud":["Ben?","Yes","No","HoHoHoHo"],"world":{"this":"is","insane":"!","hello":"world"}}, PRETTY eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [14] 2024-09-06 eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [23] 17:56:00.536280523 eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [28] 17:56:00.536418720Z eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [29] 17:56:00.536441062Z eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [30] 17:56:00.536460278+05:00 eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [31] 17:56:00.536495744-03:00 eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [34] 2024-09-06T17:56:00.536514849 eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [39] 2024-09-06T17:56:00.536628200Z eu.cloudnetservice.driver.document.gson.JavaTimeSerializerTest ‑ [4] 2024-09-06T17:56:00.536185515Z … ```