Bug 36443

Summary: counter warning printed when two threads terminate with exceptions simultaneously
Product: [Mono] Runtime Reporter: Andi McClure <andi.mcclure>
Component: GeneralAssignee: Bugzilla <bugzilla>
Severity: normal CC: mono-bugs+mono, mono-bugs+runtime, vargaz
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: Minimal test. The name is not meaningful

Description Andi McClure 2015-12-01 20:34:28 UTC

Comment 1 Andi McClure 2015-12-01 20:35:54 UTC
Created attachment 14063 [details]
Minimal test. The name is not meaningful
Comment 2 Andi McClure 2015-12-01 20:47:41 UTC
While debugging something unrelated, I found that if I cause two threads to terminate with thrown exceptions at about the same time, I see a single message printed twice:

"you are registering twice the same counter address"

This is a g_warning in mono-counters.c.

To reproduce, I have attached a file "SignalTest.cs". I do not see the message every time, but if I run the test repeatedly I see it within a few iterations. I run it repeatedly with

while (mono SignalTest.exe; true); do :; done

If I modify mono-counters.c to print the name of the counter, I find the counter names are:

RGCTX template num allocted
RGCTX template bytes allocted

and, on VERY rare occasions:

RGCTX num lazy fetch trampolines
RGCTX unmanaged lookups

Expected behavior: I think g_warnings should not be triggered by anything that user code could reasonably do, and the included code is reasonable.
Comment 3 Zoltan Varga 2015-12-02 18:21:35 UTC
Fixed in master.