[Mono-bugs] [Bug 341986] New: Thread safety problem with regexp on 1.2.6

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Nov 15 11:49:17 EST 2007


https://bugzilla.novell.com/show_bug.cgi?id=341986

           Summary: Thread safety problem with regexp on 1.2.6
           Product: Mono: Class Libraries
           Version: 1.2.6
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: informatique.internet at fiducial.fr
         QAContact: mono-bugs at ximian.com
          Found By: ---


The Regexp object is supposed to be thread safe : cf
http://msdn2.microsoft.com/en-us/library/system.text.regularexpressions.regex(vs.71).aspx

Try this program with mono 1.2.6 (branch) or svn 
using System;
using System.Text.RegularExpressions;
using System.Text;
using System.Threading;

class MainClass
{

        public static void Main(string[] args)
        {
                Console.WriteLine("Hello World!");
                //string
resultat=ReplaceParameterValue(query,":pTRA_LIBELLE_LONG","$1::text");
                regexpthreadtest();

        }

        private static Regex parameterReplace = new Regex(@"([:@][\w\.]*)",
RegexOptions.Singleline);

        private static void regexpthreadtest()
        {
                MainClass main=new MainClass();
                ThreadStart job = new ThreadStart(main.regexp_test);
                Thread thread = new Thread(job);
                thread.Start();
                Thread thread1 = new Thread(job);
                thread1.Start();

        }

        private void regexp_test()
        {
                string command="SELECT READ_WRITE FROM PERMISSIONS WHERE
USERID=:puserid AND CALENDARID=:pcalendarid";
                string[] parames=parameterReplace.Split(command);
                foreach (string param in parames)
                        Console.WriteLine(param);
        }
}

this fails with mono 1.2.6 or svn with :
Unhandled Exception: System.NullReferenceException: Object reference not set to 
an instance of an object
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32&
r
ef_ptr, Int32 pc) [0x0101d] in
/home/hubert/mono/mcs/class/System/System.Text.Re
gularExpressions/interpreter.cs:700 
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32&
r
ef_ptr, Int32 pc) [0x00ecc] in
/home/hubert/mono/mcs/class/System/System.Text.Re
gularExpressions/interpreter.cs:653 
  at System.Text.RegularExpressions.Interpreter.TryMatch (System.Int32&
ref_ptr,
 Int32 pc) [0x00022] in
/home/hubert/mono/mcs/class/System/System.Text.RegularEx
pressions/interpreter.cs:829 
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32&
r
ef_ptr, Int32 pc) [0x003e1] in
/home/hubert/mono/mcs/class/System/System.Text.Re
gularExpressions/interpreter.cs:211 
  at System.Text.RegularExpressions.Interpreter.Scan
(System.Text.RegularExpress
ions.Regex regex, System.String text, Int32 start, Int32 end) [0x00016] in
/home
/hubert/mono/mcs/class/System/System.Text.RegularExpressions/interpreter.cs:69 
  at System.Text.RegularExpressions.Regex.Match (System.String input, Int32
star
tat) [0x00000] in
/home/hubert/mono/mcs/class/System/System.Text.RegularExpressi
ons/Regex.cs:339 
  at System.Text.RegularExpressions.BaseMachine.Split
(System.Text.RegularExpres
sions.Regex regex, System.String input, Int32 count, Int32 startat) [0x0002f]
in

/home/hubert/mono/mcs/class/System/System.Text.RegularExpressions/BaseMachine.c
s:62 
  at System.Text.RegularExpressions.Regex.Split (System.String input, Int32
coun
t, Int32 startat) [0x00000] in
/home/hubert/mono/mcs/class/System/System.Text.Re
gularExpressions/Regex.cs:419 
  at System.Text.RegularExpressions.Regex.Split (System.String input) [0x00010] 
in
/home/hubert/mono/mcs/class/System/System.Text.RegularExpressions/Regex.cs:40
9 
  at MainClass.regexp_test () [0x00006] in
/home/hubert/Projects/regexp/Main.cs:
37 
  at (wrapper delegate-invoke) System.MulticastDelegate:invoke_void ()


This works for mono 1.2.5, 1.2.4, 1.1.17 (tested)

I hope this could be fixed for 1.2.6 release... because this breaks all our
programs...

Thanks


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list