This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug java/21524] New: Cancelling a TimerTask puts Timer binary heap in inconsistent state
- From: "jradel at 2wire dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 May 2005 23:38:23 -0000
- Subject: [Bug java/21524] New: Cancelling a TimerTask puts Timer binary heap in inconsistent state
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
java/util/Timer uses a binary heap for its TimerTasks, using task.scheduled as
the key. Calling task.cancel() sets task.scheduled=-1, but doesn't update the
Timer binary heap. This can leave the binary heap in an inconsistent state --
the key shouldn't be modified while the task is in the binary heap. This can
lead to situations where newly scheduled TimerTasks aren't moved to the
appropriate position in the heap, so tasks might fire late (since they are stuck
behind tasks that aren't scheduled to fire for a while).
Attaching a proposed fix.
--
Summary: Cancelling a TimerTask puts Timer binary heap in
inconsistent state
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jradel at 2wire dot com
CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21524