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

Philip Heede philip at catinet.dk
Wed Mar 1 08:21:34 PST 2006


Micheal,

>> 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?....

The exception is a null pointer exception with varying starting points,
but
all in ASTFactory:

[NullReferenceException: Object reference not set to an instance of an
object.]
   antlr.ASTFactory.addASTChild(ASTPair currentAST, AST child) +12
   (... previous function calls are from our own internal classes,
beginning 
   with the ANTLR generated parser)

[NullReferenceException: Object reference not set to an instance of an
object.]
   antlr.ASTFactory.makeASTRoot(ASTPair currentAST, AST root) +12
   (... previous function calls are from our own internal classes,
beginning 
   with the ANTLR generated parser)

are two examples.

The application is compiled with VS.NET 2002 (.NET 1.0) but is run under
ASP.NET with the .NET 1.1 runtime. OS is Windows 2003 (with SP1).
The hardware is running a configuration with dual-cpu Intel Xeon
processors
with hyperthreading (two physical cpus, four logical cores).
The parser may be called several times in parallel on separate incoming
web requests.

>> 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().

Sincerely,
Philip


More information about the antlr-interest mailing list