Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

About that c0000005 error again 7

Status
Not open for further replies.

herbstgy

Programmer
Jan 30, 2018
54
HU
Greetings, Everyone...

there's an application I'm developing and when I was stuck, you guys were very helpful in the earlier cases.
so, here I am again.
currently with that good old c0000005 exception error that has been our good friend for a long time.
I've read back and forth this forum and others what to do with it but no avail.
so, here's the thing.
there's a form with a grid in it.
it looks like this:
1_qmhpdh.png

the grid is readonly from the user's side, but constantly updates from network side (it's a log reader)
the c0000005 error usually occurs at grid update, but quite randomly. sometimes it goes without it for a half day, sometimes it pops out its ugly head after half an hour.
I've been trying the following:
- patched the VFP version to the latest - it's Visual FoxPro 09.00.0000.7423
- got rid of the WITH/ENDWITH constructs
- turned SET RESOURCE OFF - it didn't solve the problem, but raised others, so I turned back on
- the tables shown in the grid have no memo fields. it consists fields from multiple relational tables, but no memo field
- the form runs in its own private data session with only opened the needed tables
- the error only appears in the compiled EXE, but never in the IDE

I have the vfp9Rerr.log, it shows multiple locations as the source of the error but they're always somewhere around the grid.



Fatal error: Exception code=C0000005 @ 2020.11.09 08:43:15. Error log file: N:\Naplo\VFP9Rerr.log
Called from - watchman.timer1.timer line 22 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.09 11:34:48. Error log file: N:\Naplo\VFP9Rerr.log
Called from - watchman.init line 65 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - geplist.commandgroup2.lekerwm.click line 2 {n:\naplo\geplist.sct n:\naplo\geplist.sct}
Called from - geplist.keypress line 19 {n:\naplo\geplist.sct n:\naplo\geplist.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.09 13:05:20. Error log file: \\Auth4\auth4f\Naplo\VFP9Rerr.log
Called from - watchman.grid1.afterrowcolchange line 3 {\\auth4\auth4f\naplo\watchman.sct \\auth4\auth4f\naplo\watchman.sct}
Called from - main line 5 {\\Auth4\auth4f\Naplo\main.prg \\auth4\auth4f\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.09 23:51:37. Error log file: N:\Naplo\VFP9Rerr.log


Fatal error: Exception code=C0000005 @ 2020.11.10 00:38:44. Error log file: N:\Naplo\VFP9Rerr.log


Fatal error: Exception code=C0000005 @ 2020.11.10 02:29:42. Error log file: N:\Naplo\VFP9Rerr.log


Fatal error: Exception code=C0000005 @ 2020.11.10 13:50:19. Error log file: N:\Naplo\VFP9Rerr.log
Called from - geplist.commandgroup2.lekerwm.click line 2 {n:\naplo\geplist.sct n:\naplo\geplist.sct}
Called from - geplist.keypress line 19 {n:\naplo\geplist.sct n:\naplo\geplist.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.10 13:52:46. Error log file: N:\Naplo\VFP9Rerr.log
Called from - watchman.grid1.afterrowcolchange line 3 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - watchman.grid1.mousemove line 7 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.10 17:57:36. Error log file: N:\Naplo\VFP9Rerr.log
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.11 10:56:14. Error log file: \\Auth4\auth4f\Naplo\VFP9Rerr.log
Called from - geplist.commandgroup2.lekerwm.click line 2 {\\auth4\auth4f\naplo\geplist.sct \\auth4\auth4f\naplo\geplist.sct}
Called from - geplist.keypress line 19 {\\auth4\auth4f\naplo\geplist.sct \\auth4\auth4f\naplo\geplist.sct}
Called from - main line 5 {\\Auth4\auth4f\Naplo\main.prg \\auth4\auth4f\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.11 12:02:21. Error log file: N:\Naplo\VFP9Rerr.log
Called from - watchman_main.refreshyellow line 18 {n:\naplo\watchman_main.sct n:\naplo\watchman_main.sct}
Called from - watchman_main.timer1.timer line 43 {n:\naplo\watchman_main.sct n:\naplo\watchman_main.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.11 13:57:56. Error log file: N:\Naplo\VFP9Rerr.log
Called from - watchman.timer1.timer line 22 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.11 14:47:31. Error log file: N:\Naplo\VFP9Rerr.log
Called from - watchman.grid1.afterrowcolchange line 3 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - watchman.grid1.mousemove line 7 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.11 15:33:55. Error log file: N:\Naplo\VFP9Rerr.log
Called from - watchman.grid1.afterrowcolchange line 3 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - watchman.grid1.mousemove line 7 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.12 09:51:22. Error log file: N:\Naplo\VFP9Rerr.log
Called from - geplist.commandgroup2.lekerwm.click line 2 {n:\naplo\geplist.sct n:\naplo\geplist.sct}
Called from - geplist.keypress line 19 {n:\naplo\geplist.sct n:\naplo\geplist.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.12 11:51:03. Error log file: N:\Naplo\VFP9Rerr.log
Called from - geplist.commandgroup2.lekerwm.click line 2 {n:\naplo\geplist.sct n:\naplo\geplist.sct}
Called from - geplist.keypress line 19 {n:\naplo\geplist.sct n:\naplo\geplist.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.12 15:39:24. Error log file: \\Auth4\auth4f\Naplo\VFP9Rerr.log
Called from - watchman.grid1.afterrowcolchange line 3 {\\auth4\auth4f\naplo\watchman.sct \\auth4\auth4f\naplo\watchman.sct}
Called from - watchman.grid1.mousemove line 7 {\\auth4\auth4f\naplo\watchman.sct \\auth4\auth4f\naplo\watchman.sct}
Called from - main line 5 {\\Auth4\auth4f\Naplo\main.prg \\auth4\auth4f\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.13 16:18:50. Error log file: N:\Naplo\VFP9Rerr.log
Called from - watchman.grid1.afterrowcolchange line 3 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - watchman.grid1.mousemove line 7 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.15 07:32:01. Error log file: N:\Naplo\VFP9Rerr.log
Called from - watchman.grid1.afterrowcolchange line 3 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.16 12:40:34. Error log file: N:\Naplo\VFP9Rerr.log
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.18 11:58:55. Error log file: N:\Naplo\VFP9Rerr.log
Called from - geplist.commandgroup2.lekerwm.click line 2 {n:\naplo\geplist.sct n:\naplo\geplist.sct}
Called from - geplist.keypress line 19 {n:\naplo\geplist.sct n:\naplo\geplist.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.19 14:13:58. Error log file: N:\Naplo\VFP9Rerr.log
Called from - watchman.init line 65 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - geplist.commandgroup2.lekerwm.click line 2 {n:\naplo\geplist.sct n:\naplo\geplist.sct}
Called from - geplist.keypress line 19 {n:\naplo\geplist.sct n:\naplo\geplist.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.20 10:35:26. Error log file: N:\Naplo\VFP9Rerr.log
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.21 08:00:51. Error log file: N:\Naplo\VFP9Rerr.log
Called from - watchman.timer1.timer line 22 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.21 08:15:55. Error log file: N:\Naplo\VFP9Rerr.log
Called from - watchman_main.refreshcyan line 18 {n:\naplo\watchman_main.sct n:\naplo\watchman_main.sct}
Called from - watchman_main.timer1.timer line 11 {n:\naplo\watchman_main.sct n:\naplo\watchman_main.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.21 12:16:05. Error log file: N:\Naplo\VFP9Rerr.log
Called from - watchman.timer1.timer line 8 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.21 13:35:48. Error log file: N:\Naplo\VFP9Rerr.log
Called from - watchman.grid1.afterrowcolchange line 3 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - watchman.grid1.mousemove line 7 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.24 11:11:07. Error log file: N:\Naplo\VFP9Rerr.log
Called from - watchman.grid1.afterrowcolchange line 3 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - watchman.grid1.mousemove line 7 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Fatal error: Exception code=C0000005 @ 2020.11.24 12:18:26. Error log file: N:\Naplo\VFP9Rerr.log
Called from - watchman.timer1.timer line 8 {n:\naplo\watchman.sct n:\naplo\watchman.sct}
Called from - main line 5 {N:\Naplo\main.prg n:\naplo\proj1.exe}


Any ideas?
 
Hi,

In order to illustrate the parameterized view approach, please have a look at the code below. The ATM table has at start 100 000 records, the timer INTERVAL is set to 3 seconds - at that pace it adds a record to the table. The grid shows the records (20) added during the last 60 seconds. The speed of the REQUERY() (20 records out of > 100 000) is on may machine 0,02 seconds - I think fast enough.

Enjoy

Code:
PUBLIC go_Form 

IF FILE("ATM.DBC")
	OPEN DATABASE ATM

ELSE 
	CREATE DATABASE "ATM"
	
	CREATE TABLE "tblATM" (iAutoInc i AUTOINC NEXTVALUE 1, cName C(20), tDateTime t)

	FOR i = 1 TO 100000
		INSERT INTO tblATM (cName, tDateTime) VALUES ("T" + SYS(2015), DATETIME())
	ENDFOR 
	
	CREATE SQL VIEW vueATM as ;
		select * from tblATM where DATETIME() - tDateTime < 60

ENDIF

IF USED("vueATM")
	SELECT vueATM
ELSE 
	USE vueATM
ENDIF 

go_Form = CreateObject("frmForm")
go_Form.Visible = .T.
go_Form.Show

READ Events

CLOSE ALL
CLEAR ALL

*****

DEFINE CLASS frmForm As Form
	Width = 600
	Height = 360
	MinWidth = This.Width
	MinHeight = This.Height
	AutoCenter = .T.
	Themes = .F.
	
	ADD OBJECT timRequery as Timer WITH ;
		Interval = 3000
		
		PROCEDURE timRequery.Timer()
			INSERT INTO tblATM (cName, tDateTime) VALUES ("T" + SYS(2015), DATETIME())
			REQUERY()
			ThisForm.Refresh()

		ENDPROC 
	
	Add Object grdATM as Grid with;
		Top = 66, ;
		Left = 18, ;
		Height = 360 - 120, ;
		Width = 600 - 36, ;
		RowHeight = 30, ;
		AllowRowSizing = .F., ;
		DeleteMark = .F., ;
		Anchor = 15, ;
		Visible = .T., ;
		ColumnCount = -1, ;
		RecordSource = "vueATM"
    	
		PROCEDURE grdATM.Init()
			WITH This 
				.Column1.Header1.Caption = "Auto"
				.Column1.Header1.FontBold = .T.
				.Column1.Width = 60

				.Column2.Header1.Caption = "Name"
				.Column2.Header1.FontBold = .T.
				.Column2.Width = 120

				.Column3.Header1.Caption = "Date and Time"
				.Column3.Header1.FontBold = .T.
				.Column3.Width = 120

			ENDWITH 
		ENDPROC 
	
	PROCEDURE Destroy()
		CLEAR Events
		ThisForm.Release
	ENDPROC
ENDDEFINE

*****

hth

marK
 
There's just one thing, that would annoy me, but it also happens when you bind the grid to a DBF instead of a view: The grid jumps to the new record, once it is inserted. I guess you already have a mechanism to account for that, like putting the record pointer back to where it was after an INSERT or APPEND.

Now it just depends on what better fits your needs and whether it actually helps to prevent the C5 errors.

Chriss
 
Dear Mark,

thank you for your example, it's amazing. simple, understandable, and it shows how many things I DON'T know about Visual FoxPro. :)
this SQL View mode I never tried but it seem so simple and flexible...

anyway, sorry for the late answer, it comes from my shift schedule: I can only work on my program on night shifts in every 4th week, and I can't even take the source home with me, so it slows down development. :)

sooo... I took y'all's advice and let go the million-record main log-dbf viewing and created a SQL view for the grid.
basically I had to rewrite the form. :)
now I do a filtered SQL selection into a temporary cursor to show in the grid.
then in the timer event I SQL only the differences into an array and insert the content of the array into the cursor...
I compiled it...
AND NOW WE WAIT.
 
Dear All,

I'd like to thank you all for your ideas and advices. Querying the DBF into a temporary cursor did the trick. the c0000005 error is gone. :)

now I have another problem, but I'll be back with that later.

thank you all.
 
Having recently (and coincidentally in the same timeframe as this thread) started experiencing the dreaded C5 error in a compiled VFP9 .exe that I produce, I have found this forum extremely helpful for researching this and other questions I've had. In the spirit of what Tamar wrote yesterday, I thought it would be useful to join this illustrious group and to contribute just a tiny bit in return!

One user of my program reported that, quite suddenly, and after using for many months without trouble, it had started crashing with a C0000005 error. The crash was triggered only by vertical scrolling of the grid that provides a view of underlying table data (in this case ca. 200k records).

One of the columns in the grid has a control source that is a memo field in the main table, but without fully thinking it through I had just set the column control source to be the memo field. This grid column only has space to view around 32 chars, but the underlying memo field could of course be considerably larger (I have put a 'click on cell' pop-up to display the entire memo field contents when required). Of course it worked fine like this for a long time... Then some user records crept in where the memo length was >600 chars and boom, C5 time when scrolling! It would seem that the combination of a large number of records (~250k) and an unexpectedly long memo field as a column control source was not at all to VFP's liking. I haven't tried to exactly quantify the exact threshold for C5's, but the crash is entirely repeatable.

The solution? Just set the control source to about as many chars from the memo field as would actually be visible in the visible grid column width, i.e.
Code:
grid.column.controlsource='left(tablename.memofield,32)'

May seem obvious to the more battle hardened developers here not to do something this stupid, but without limiting the ControlSource length then C5's can be produced on demand!

Perhaps this may help somebody in the future. I just wish VFP was still a supported product, though despite it's age it still rocks!

Chris

 
now I found another interesting phenomenon.
if the grid source is empty (reccount()=0) and I press PgDown, the grid drops the grid source and gives a "Record is out of range" error message.
there is no any specific key handling on PgDown, nor ON KEY, neither in the form's or the grid's Keypress method.
tried to explicitly handle PgDown in both mentioned Keypress methods by simply stating
"IF nKeyCode=3
RETURN​
ENDIF"
but the error occurs anyway.

any idea about that?

 
Hi,

You may want to hide the grid if RECCOUNT() = 0 and add this code to the REFRESH() and AFTERROWCOLCHANGE() events of the grid. The code below hides the grid if MOD(RECNO(), 5) = 0 (every fifth record)

Code:
PUBLIC go_Form

go_Form = CreateObject ("frmForm")
go_Form.Visible = .T.
go_Form.Show

READ Events
CLOSE ALL
CLEAR ALL


DEFINE CLASS frmForm As Form
	Width = 360
	MaxWidth = 360
	MinWidth = 360
	Height = 480
	MaxHeight = 480
	MinHeight = 480
	AutoCenter = .T.

	Add Object grdNames as Grid with;
	    RecordSource = "curNames", ColumnCount = -1, Visible = .T., Top = 24, Left = 24, Height = 480 - (24 + 12 + 30 + 12), Width = 312
	    
	    PROCEDURE grdNames.Refresh()
	    
	    	IF MOD(RECNO(), 5) = 0
	    		This.Visible = .F.
	    	ELSE
	    		This.Visible = .T.
	    	ENDIF 
	    ENDPROC 
	    
	    PROCEDURE grdNames.AfterRowColChange()
			LPARAMETERS nColIndex
	    	
	    	This.Refresh()
	    ENDPROC 


	ADD OBJECT cmdBack as CommandButton WITH ;
		Width = 60, Height = 30, Left = 24, Top = 480 - 42, Caption = "Back"
		
		PROCEDURE cmdBack.Click()
		
			IF !BOF()
				SKIP - 1
				
			ELSE
				LOCATE 

			ENDIF 
			
			go_Form.grdNames.Refresh()
			
		ENDPROC 
		
	ADD OBJECT cmdNext as CommandButton WITH ;
		Width = 60, Height = 30, Left = 90, Top = 480 - 42, Caption = "Next"
		
		PROCEDURE cmdNext.Click()
		
			IF !EOF()
				SKIP 1
				
			ELSE
				GOTO bottom
				
			ENDIF 
			
			go_Form.grdNames.Refresh()
			
		ENDPROC 
		
	ADD OBJECT cmdExit As CommandButton WITH ;
    	Width = 60, Height = 30, Left = 156, Top = 480 - 42, Caption = "Exit"
    
		PROCEDURE cmdExit.Click()
			CLEAR Events
			ThisForm.Release
		ENDPROC
	  

		PROCEDURE Destroy()
			CLEAR Events
			ThisForm.Release
		ENDPROC
	    
		PROCEDURE Load
			Create Cursor curNames (cName Character(20))
				For li_I = 1 to 100
					INSERT INTO curNames (cName) VALUES ("X" + SYS(2015))
				Next li_I   
			
			LOCATE  
		ENDPROC

ENDDEFINE

hth

marK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top