zakgof / actr

Simple, fast and typesafe Java actor model implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Concurrency: `ForkJoinPoolScheduler#schedule(..)` can intermittently lose messages

SereneAnt opened this issue · comments

commented

In ForkJoinPoolScheduler#schedule(..), an actor can intermittently skip messages.

Possible scenarios (others possible):
1.

  • The single actr created;
  • Thread A adds a runnable to the actr's mailbox;
  • Thread A locks the mailbox and runs the runnable;
  • Thread B adds a runnable, the actor's mailbox is still locked, so the 'runnable.run()' is skipped.
  • Thread A unlocks the mailbox;
  • The single actr created;
  • Thread A adds a runnable to the actr's mailbox;
  • Thread A locks the malebox and runs the runnable;
  • Thread B adds a runnable to the same mailbox;
  • Thread A removes the last runnable (from thread B) without execution.

The result: The message (runnable) from thread B is lost.

Fixed in actr 0.1.0