Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 551 [details]
Program to reproduce the bug
1. Download the attached file and name it 't.cs'
2. Compile with 'dmcs t.cs'
3. Run with 'mono-sgen t.exe'
program runs forever, printing "loop 0\nloop 1\n..."
program throws after ~250 iterations because an object disappeared from a ConditionalWeakTable that shouldn't have.
This bug only manifests with mono-sgen. If I run with mono (boehm), the program loops forever, as expected.
Ack..forgot to specify. I'm running mono 2.10.5 on OSX Lion.
Can't reproduce this with HEAD/mono 2.10 branch on linux.
I can not reproduce this on linux either.
I just checked out the git repository on an osx/lion machine + tried with both HEAD and 2.10. The bug is present in both.
This bug is looking osx specific.
I've tried with master/2.10 on OSX/lion and it works fine.
There has been a regression on this area that has been fixed since.
Just reproduced on commit d6be15f97bc5727a0dff04dd4cd288f9c99b1660
Here is an output of the test code: http://pastebin.com/ZKTpinu1
if i run the sample without sgen GC -- the test works as expected
Created attachment 929 [details]
A patch solving the problem
A patch solving the problem. It's against current mono-2.10 branch.
The patch is very simple -- it doesn't allow GC to skip scanning all ephemerons arrays basing only on an array address. Such skips are big mistake, bcs if an array allocated in different region it can contain references to the region we scanning. So it's necessary to scan all available arrays.
Applying patch fixes problem (test case passes well).
I've tested your patch out by hand against 2.10.6. It does indeed fix the problem. It also solves another sgen-related crash that I was having trouble making a small test case for. Great work!