[Mono-dev] Garbage collection breaks Oracle client
Veerapuram Varadhan
vvaradhan at novell.com
Wed Sep 30 12:09:52 EDT 2009
Hi Warren,
Attached patch works fine for the test program. Can you apply this
patch and try once? If things go fine, would you mind filing a bug - so
that I can commit the patch to other branches as well.
TIA,
V. Varadhan
On Wed, 2009-09-30 at 15:05 +0100, warren.puziewicz at realtimeworlds.com
wrote:
> Hello,
>
>
>
> We are building an application on Mono with an Oracle database. We
> are currently using Mono 2.5 built from source in June. We recently
> started testing the most recent build from source, and have discovered
> an issue between garbage collection and the Oracle client. After a
> number of operations, a bind parameter will have a few extra bytes of
> garbage appended. This does not happen on the earlier build. It can
> be prevented on the latest build if the environment variable
> GC_DONT_GC is set. Below is information on our environment, a section
> of an Oracle client side trace file with the bad data highlighted,
> code to reproduce the error.
>
>
>
> Our platform is:
>
> $ uname -s -r -v -p -i -o
>
> Linux 2.6.18-92.1.13.el5 #1 SMP Wed Sep 24 19:32:05 EDT 2008 x86_64
> x86_64 GNU/Linux
>
>
>
> (Failure occurs on this version of Mono)
>
> $ mono -V
>
> Mono JIT compiler version 2.5 (/trunk/mono r142988 Wed Sep 30 13:19:23
> BST 2009)
>
> Copyright (C) 2002-2008 Novell, Inc and Contributors.
> www.mono-project.com
>
> TLS: __thread
>
> GC: Included Boehm (with typed GC and Parallel
> Mark)
>
> SIGSEGV: altstack
>
> Notifications: epoll
>
> Architecture: amd64
>
> Disabled: none
>
>
>
> (Works fine on this version of Mono)
>
> $ mono -V
>
> Mono JIT compiler version 2.5 (/trunk/mono r137147 Tue Jun 30 14:46:43
> BST 2009)
>
> Copyright (C) 2002-2008 Novell, Inc and Contributors.
> www.mono-project.com
>
> TLS: __thread
>
> GC: Included Boehm (with typed GC and Parallel
> Mark)
>
> SIGSEGV: altstack
>
> Notifications: epoll
>
> Architecture: amd64
>
> Disabled: none
>
>
>
> Oracle client libraries are: Instant Client 11.1.0.7.0 (x64)
>
>
>
> ==== The exception generated ====
>
> Unhandled Exception: System.Data.OracleClient.OracleException:
> ORA-01722: invalid number
>
>
>
> at System.Data.OracleClient.Oci.OciStatementHandle.Execute (Boolean
> nonQuery, Boolean useAutoCommit, Boolean schemaOnly) [0x00000]
>
> at System.Data.OracleClient.Oci.OciStatementHandle.ExecuteNonQuery
> (Boolean useAutoCommit) [0x00000]
>
> at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal
> (System.Data.OracleClient.Oci.OciStatementHandle statement, Boolean
> useAutoCommit) [0x00000]
>
> at System.Data.OracleClient.OracleCommand.ExecuteNonQuery ()
> [0x00000]
>
> at (wrapper remoting-invoke-with-check)
> System.Data.OracleClient.OracleCommand:ExecuteNonQuery ()
>
> at ADOTest.Program.ExecSQLTest2 (Int32 numRows) [0x00000]
>
> at ADOTest.Program.Main (System.String[] args) [0x00000]
>
>
>
> ==== Snippet from Oracle client trace file ====
>
> 2009-09-30 14:28:30.013678 : nsbasic_bsd:00 00 00 00 FE 40 49 4E
> |....þ@IN|
>
> 2009-09-30 14:28:30.013696 : nsbasic_bsd:53 45 52 54 20 49 4E 54 |
> SERT.INT|
>
> 2009-09-30 14:28:30.013723 : nsbasic_bsd:4F 20 64 61 74 61 5F 74 |
> O.data_t|
>
> 2009-09-30 14:28:30.013742 : nsbasic_bsd:65 73 74 20 28 63 6F 6C |
> est.(col|
>
> 2009-09-30 14:28:30.013770 : nsbasic_bsd:5F 6F 6E 65 2C 20 63 6F |
> _one,.co|
>
> 2009-09-30 14:28:30.013788 : nsbasic_bsd:6C 5F 74 77 6F 2C 20 63 |
> l_two,.c|
>
> 2009-09-30 14:28:30.013806 : nsbasic_bsd:6F 6C 5F 74 68 72 65 65 |
> ol_three|
>
> 2009-09-30 14:28:30.013824 : nsbasic_bsd:29 20 56 41 4C 55 45 53
> |).VALUES|
>
> 2009-09-30 14:28:30.013842 : nsbasic_bsd:20 28 3A 70 31 2C 0A 20
> |.(:p1,..|
>
> 2009-09-30 14:28:30.013860 : nsbasic_bsd:3A 70 32 2C 20 3A 70 33
> |:p2,.:p3|
>
> 2009-09-30 14:28:30.013878 : nsbasic_bsd:29 00 01 00 00 00 01 00
> |).......|
>
> [snipped]
>
> 2009-09-30 14:28:30.014297 : nsbasic_bsd:00 07 03 31 32 33 04 34
> |...123.4| <= length of bind var includes the bad byte
>
> 2009-09-30 14:28:30.014315 : nsbasic_bsd:35 36 16 03 37 38 39 |
> 56..789 | <= extra byte of garbage data
>
>
>
> Starting at the 3rd byte of the next to last line:
>
> “03 31 32 33” = 3 bytes, values “123”
>
> “04 34 35 36 16” = 4 bytes, values “456” + 1 garbage byte
>
> “37 38 39” = 3 bytes, values “789”
>
> In this case, the second parameter (value ‘456’) had an extra byte
> (0x16) appended.
>
>
>
>
>
> ==== To reproduce ====
>
> using System;
>
> using System.Data.OracleClient;
>
> /* Inserts requested number of rows into a table.
>
>
>
> CREATE TABLE data_test (
>
> col_one NUMBER(10,0),
>
> col_two NUMBER(10,0),
>
> col_three NUMBER(10,0)
>
> )
>
>
>
> Compiled with:
>
> mcs program.cs -r:System.Data.OracleClient
>
>
>
> Execute (fail):
>
> mono program.exe 500
>
>
>
> Execute (succeed):
>
> GC_DONT_GC=YES mono program.exe 500
>
>
>
> */
>
> namespace ADOTest
>
> {
>
> class Program
>
> {
>
> private const string ConnStr = "SERVER=dev;User
> ID=testuser;Password=testuser;";
>
>
>
> static void ExecSQLTest2(int numRows)
>
> {
>
> OracleConnection conn = new OracleConnection(ConnStr);
>
> conn.Open();
>
>
>
> for (int i = 0; i < numRows; i++)
>
> {
>
> if ((i % 100) == 0)
>
> {
>
> Console.Write(".");
>
> }
>
> OracleCommand cmd = conn.CreateCommand();
>
> cmd.CommandText = "INSERT INTO data_test (col_one,
> col_two, col_three) VALUES (:p1, :p2, :p3)";
>
>
>
> OracleParameter p1 = new OracleParameter("p1",
> OracleType.Number);
>
> OracleParameter p2 = new OracleParameter("p2",
> OracleType.Number);
>
> OracleParameter p3 = new OracleParameter("p3",
> OracleType.Number);
>
>
>
> p1.Value = 1;
>
> p2.Value = 1;
>
> p3.Value = 1;
>
> cmd.Parameters.Add(p1);
>
> cmd.Parameters.Add(p2);
>
> cmd.Parameters.Add(p3);
>
>
>
> cmd.ExecuteNonQuery();
>
> }
>
> conn.Close();
>
> }
>
>
>
> static void Main(string[] args)
>
> {
>
> int numRows = System.Convert.ToInt16(args[0]);
>
> ExecSQLTest2(numRows);
>
> Console.WriteLine("Done.");
>
> }
>
> }
>
> }
>
>
>
> Warren Puziewicz
>
> Database Architect
>
> Realtime Worlds, Ltd
>
> 152 West Marketgait
>
> Dundee DD1 1NJ
>
> +44 (0) 01382 202821
>
>
>
>
>
> ____________________________________________________________________
> Check out NEoN, a ground-breaking digital arts festival taking place
> in Dundee on 13th-14th November 2009
> http://www.northeastofnorth.ning.com
>
>
>
> DISCLAIMER
>
> This message and any attachments contain privileged and confidential
> information intended for the use of the addressee named above. If you
> are not the intended recipient of this message, you are hereby
> notified that any use, dissemination, distribution or reproduction of
> this message is prohibited. Please note that we cannot guarantee that
> this message or any attachment is virus free or that it has not been
> intercepted and amended. The views of the author may not necessarily
> reflect those of Realtime Worlds Ltd.
>
>
>
> Realtime Worlds Ltd is registered in Scotland, number 225628.
> Registered Office: 152 West Marketgait, Dundee, DD1 1NJ.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bind-corrupt-gc.fix
Type: text/x-patch
Size: 689 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090930/cbc4ad85/attachment.bin
More information about the Mono-devel-list
mailing list