Add information about async tasks to CrashReports. Addresses BUKKIT-2491
Async tasks are notorious for causing CMEs and corrupted data when accessing the API. This change makes a linked list to track recent tasks that may no longer be running. It is accessed via the toString method on the scheduler. This behavior is not guaranteed, but it is accessible as such currently. Although toString is located in the scheduler, its contract does not guarantee an accurate or up to date call when accessed from a second thread.
This commit is contained in:
@@ -28,7 +28,7 @@ public class CraftCrashReport implements Callable {
|
||||
for (Map.Entry<Thread, ? extends Object[]> entry : Thread.getAllStackTraces().entrySet()) {
|
||||
value.append(' ').append(entry.getKey().getState().name()).append(' ').append(entry.getKey().getName()).append(": ").append(Arrays.toString(entry.getValue())).append(',');
|
||||
}
|
||||
value.append('}');
|
||||
value.append("}\n ").append(Bukkit.getScheduler().toString());
|
||||
} catch (Throwable t) {
|
||||
value.append("\n Failed to handle CraftCrashReport:\n");
|
||||
PrintWriter writer = new PrintWriter(value);
|
||||
|
||||
Reference in New Issue
Block a user