DATATABLE unable to update after some iterations

partham

Active member
Joined
Dec 27, 2005
Messages
41
Location
Kolkata, India
Programming Experience
10+
Dear Sir,

I have developed a IVR Socket Server using VB.NEt (Microsoft Visual Studio .Net 2003). For this Server, I have devised a monitor which displays various statistics regarding the operations. The volume of calls is expected to be very huge on this Server. For being able to display the various kinds of requests received from the different clients and for showing how many of each kind could be processed and how many were rejected, I have used a DATATABLE. Every time a packet is received from the Client application, the Server will update the DATATABLE to record the various aspects of the processing of the packet. Now, the technique used to update the DATATABLE is that the present value of fetched from the column of the DATATABLE, some calculations are done and then the value is updated. For example, one of the data to be shown is the number of bytes received from the client. So, I fetch the row containing the data for that client. Then I obtain the value in the column containing the number of bytes received from the client. Add the number f onytes in the packet to it and then put the value back in the Data Row object.

Now, the program is performing its primary task as required. However, when I simultaneously open many clients or even if a single client pumps in huge number of requests within a short period of time, or after processing a certain number around (100,000) packets, the Socket Server gives an error stating that "The Version of the program is old" or "Object Reference is not found". The details of the error message states that the DATATABLE cannot detect the original state. Please find the error message dialog and the error screens attached alongwith. I am also attaching the Monitor program.

The text of the error message is
==========================================================================================
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Data.DataView.IsOriginalVersion(Int32 index)
at System.Data.DataRowView.GetColumnValue(DataColumn column)
at System.Data.DataColumnPropertyDescriptor.GetValue(Object component)
at System.Windows.Forms.DataGridColumnStyle.GetColumnValueAtRow(CurrencyManager source, Int32 rowNum)
at System.Windows.Forms.DataGridTextBoxColumn.Paint(Graphics g, Rectangle bounds, CurrencyManager source, Int32 rowNum, Brush backBrush, Brush foreBrush, Boolean alignToRight)
at System.Windows.Forms.DataGridRelationshipRow.PaintCellContents(Graphics g, Rectangle cellBounds, DataGridColumnStyle column, Brush backBr, Brush foreBrush, Boolean alignToRight)
at System.Windows.Forms.DataGridRow.PaintData(Graphics g, Rectangle bounds, Int32 firstVisibleColumn, Int32 columnCount, Boolean alignToRight)
at System.Windows.Forms.DataGridRelationshipRow.Paint(Graphics g, Rectangle bounds, Rectangle trueRowBounds, Int32 firstVisibleColumn, Int32 numVisibleColumns, Boolean alignToRight)
at System.Windows.Forms.DataGrid.PaintRows(Graphics g, Rectangle& boundingRect)
at System.Windows.Forms.DataGrid.PaintGrid(Graphics g, Rectangle gridBounds)
at System.Windows.Forms.DataGrid.OnPaint(PaintEventArgs pe)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
PPVSIVRSS
Assembly Version: 1.0.2414.29599
Win32 Version: 1.0.2414.29599
CodeBase: file:///C:/PPVS/PPVSIVRSS/PPVSIVRSS/bin/PPVSIVRSS.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.6001.4
CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
GeneralPurposeTools
Assembly Version: 0.0.0.0
Win32 Version: 0.0.0.0
CodeBase: file:///C:/PPVS/PPVSIVRSS/PPVSIVRSS/bin/GeneralPurposeTools.DLL
----------------------------------------
PPVSIVRSSComponents
Assembly Version: 1.0.2414.29551
Win32 Version: 1.0.2414.29551
CodeBase: file:///C:/PPVS/PPVSIVRSS/PPVSIVRSS/bin/PPVSIVRSSComponents.DLL
----------------------------------------
IPCTools
Assembly Version: 1.0.2414.29551
Win32 Version: 1.0.2414.29551
CodeBase: file:///C:/PPVS/PPVSIVRSS/PPVSIVRSS/bin/IPCTools.DLL
----------------------------------------
GeneralIVRSSComponents
Assembly Version: 1.0.2415.35266
Win32 Version: 1.0.2415.35266
CodeBase: file:///C:/PPVS/PPVSIVRSS/PPVSIVRSS/bin/GeneralIVRSSComponents.DLL
----------------------------------------
System.Data
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
==========================================================================================
I am requesting for providing me with the guidance as to how I could solve this problem.

Thanks in advance.

Regards,
Partha
 

Attachments

  • Monitor.zip
    210.4 KB · Views: 27
Last edited by a moderator:
You've got a NullReferenceException, which are usually fairly easily fixed. We don't need yourt entire project and we don't need all that information about the exception, just the message and where it occurred. Post the section of code in which the exception is thrown and point out the line on which it is thrown and the reference that is Nothing on that line.
 
Dear Sir,

Thank you for your kind response.

However, please note that the same piece of code is getting executed under the same circumstances (I am sending a fixed packet 100,000 number of times from each of the client applications). Why after a certain number of iterations, this Null Reference exception is thrown. If you notice the screen shot attached, you will notice that the debugger points to the class declaration for frmMonitor (the only window used in this program). How this this class not be referentiable.

Thank you for you time. Please provide some more light to the possible cause of the problem.

Regards,
 
Here's how you debug NullReferenceExceptions. You break on the line that threw the exception, which the debugger will do for you. Now you establish which reference is Nothing that thought would not be, then you use the Call Stack window to navigate backwards in the trail of execution to find the point at which that reference was either set to Nothing, or else where you thought it should been set to an object. if you find those places but you still don't know why there's an issue then you can place a breakpoint there so that you can assess the current context when execution passes through those points.
 
Dear Sir,

Thank you for your advice. Accordingly, I have eliminated a few potential Null Reference in the program. However, none of them seem to have addressed the real issue. I am getting the following Dialog Box displayed when I click on the DataGrid, while the program is running. After that the Dialog box is crossed in red colour, while the program continues.

I would remain ever grateful for your kind advice.

Regards,
 

Attachments

  • New Bitmap Image.JPG
    New Bitmap Image.JPG
    12.3 KB · Views: 37
Last edited by a moderator:
Dear Sir,

I would like to draw your attention to the fact that the error is occuring in a function whose code is supplied by Microsoft. I am unable to debug the same. I wanted to know when the stated error occurs, what needs to be done and what could be the possible cause.

Also, please note that the program continues to work. Only the datagrid stops updating and is marked with a red cross.

Awaiting you kind suggestions and advice.

Regards,
 
Dear Sir,

The problem is resolved. We applied SyncLock on the DataTable and now it behaves properly. AS multiple processes were trying to write to the DataTable, it was becoming unusable.

Regrds,
 
Back
Top