Bug 6155 – thread message boxes block infinitely with OnCrowding.block

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-06-14T13:28:00Z
Last change time
2011-07-08T13:36:16Z
Keywords
patch
Assigned to
code
Creator
edelkind+puremagic

Attachments

IDFilenameSummaryContent-TypeSize
997messagebox.dCode to demonstrate OnCrowding.block deadlockapplication/octet-stream430
998m_count-fix.patchpatch to fix OnCrowding.block deadlock issuetext/plain513

Comments

Comment #0 by edelkind+puremagic — 2011-06-14T13:28:21Z
Created attachment 997 Code to demonstrate OnCrowding.block deadlock When std.concurrency.setMaxMailboxSize(..., OnCrowding.block) is used, and the mailbox fills (thus calling m_notFull.wait() ), the corresponding notify procedure is never called, and the threads deadlock. This is due to the fact that m_count is not always incremented correctly, and can become 0xffffffff (-1). When mboxFull() checks the length of the list, it sees an astronomical size, thus never returns false. A test case is attached (messagebox.d). I will attach a patch as well.
Comment #1 by edelkind+puremagic — 2011-06-14T13:33:11Z
Created attachment 998 patch to fix OnCrowding.block deadlock issue
Comment #2 by edelkind+puremagic — 2011-07-08T13:19:51Z
Since the github commit doesn't reference this issue number, it should be noted that the bug has been fixed in this git revision: https://github.com/klickverbot/phobos/commit/10243e8110ce6303f7abe5b8f149f3ff2b8a2cd1
Comment #3 by code — 2011-07-08T13:36:16Z
Oh, sorry, I must have somehow forgotten to close your bug report, as I have independently discovered it as well…