[antlr-interest] ANTLR 2.7.6 C# race condition fix

Micheal J open.zone at virgin.net
Wed Mar 1 07:49:27 PST 2006


> Hi all,

Philip,

> We are using ANTLR in an ASP.NET (C#) application with great 
> success. However, we are experiencing some random crashes in 
> situations with high memory usage, where the stack trace 
> indicates that the crash originated in
> 
> antlr.ASTFactory.makeASTRoot(ASTPair currentAST, AST root)

Any more info about the crash?. A stack trace?. What version of .NET?. OS?.
Is this on multi-CPU hardware?. Are you running many parsers in parallel on
separate threads?....

> We've been tracking the problem for some time now without any 
> ideas to what might be causing it besides the fact that the 
> servers are being stressed when the problem occurs. The 
> general consensus so far has been, that the problem is 
> because of the high memory usage rather than ANTLR (even 
> though the exception originates here).
> 
> However, we are at v2.7.5 and I've just noticed the following 
> entry in the 2.7.6 changelog regarding C#-specific changes:
>  
> ***BREAKING CHANGE*** ASTPair object pool had a race 
> condition in multi-threaded environments. ASTPair is now a struct.

The only report of this race-condition was in a multi-CPU environent. Under
heavy stress testing conditions iirc.

> I wanted to hear if anyone could give some more information 
> on this fix before I get my hopes up.

http://www.antlr.org/pipermail/antlr-interest/2005-April/011838.html

And search the archives for "ASTPair".

> Does our problem sound 
> like it might be caused by the race condition mentioned in 
> this fix? We'll be testing 2.7.6 shortly, but I hope to hear 
> any comments you might have. Thanks! 

Possibly, couldn't say. In Jim's case, it manifested as an infinite loop in
ASTPair.advanceChildToEnd().


Cheers,

Micheal



More information about the antlr-interest mailing list