Skip to content

Conversation

@rionmonster
Copy link
Contributor

@rionmonster rionmonster commented Oct 27, 2025

Purpose

Linked Issue: Close #1855

Per Issue #1855, this pull request addresses a potential issue that could arise during the remove() operation for TimerTaskEntry that could result in a null pointer exception being thrown. This was possible as the underlying object to support the internal list was volatile and subject to operations from other threads.

Brief change log

Update the logic within the TimerTaskEntry.remove() operation to use a more concurrency-safe single-read snapshot pattern to avoid separate reads (e.g., reading during iteration and within the body as well). These changes were originally reproduced via a newly added unit test and retained to ensure the issue was resolved as expected.

Tests

Added a new TimerTaskEntryTest class along with an associated TimerTaskEntryTest.testRemoveEnsuresCurrentListNullSafety case that originally reproduced this issue (via concurrent, oscillating add/removals across separate threads) which was eventually updated after the fix was applied to confirm the exception will no longer be thrown.

API and Format

N/A

Documentation

N/A

[server] Added test to reproduce NPE during TimerTaskEntry removal

[server] Added test to reproduce NPE during TimerTaskEntry removal
[server] Added Safety Check for TimerTaskEntry Removal to Avoid NPE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Npe occur when remove entry from TimerTaskEntry

1 participant