RecordSave() crashes
Aldevinas Katkus
1-27-22
Operating system: Windows
version 8.5 2021-04-18 (build 85360453)


I cannot figure out why
NewContactCUDsmRemote() crashes in my import procedure, but it does not if I create subcontact manually.
I am using this in the Periodic Task.

I digged out to the CUVcRecordDefaults() which uses
wn = CurWindow;
if (wn!=5) then begin
CUr.CustCat = CSb.DefCustCat;
end;

I thought, CurWindow does not work in the background thread and If I use RecordClear(ContactCUr) instead of RecordNew(ContactCUr) in the NewContactCUDsmRemote() I would get rid of this crash, but it did not help. Export-import did not help either.


updating function Boolean NewContactCUDsmRemote(record CUVc CUr,var record CUVc ContactCUr)
...
lCUr.Code = ContactCUr.Code;
if (ReadFirstMain(lCUr,1,true)==false) then begin
LogText(0,"NewContactCUDsmRemote 3 will store ContactCUr.Code=" & ContactCUr.Code);
if (RecordStore(ContactCUr,false)) then begin
LogText(0,"NewContactCUDsmRemote store success");//never executes

end else begin
LogText(0,"NewContactCUDsmRemote fail");//never executes
end;

and the results in the log are:


2022-01-27 18:28:10 /THREAD(14) NewContactCUDsmRemote 3 will store ContactCUr.Code=AK5
2022-01-27 18:28:10 /THREAD(14) Damaged database: D4DiskStore dvp!=gp->MasterDVp
2022-01-27 18:28:10 /THREAD(14) D4DiskStore
2022-01-27 18:28:10 /THREAD(14) dump of call stack
2022-01-27 18:28:10 /THREAD(14) 0000000008769C90 + 2452 halpatch\CUVcWActionTool.hal: NEWCONTACTCUDSMREMOTE
2022-01-27 18:28:10 /THREAD(14) Damaged database: D4DiskStore failed
2022-01-27 18:28:10 /THREAD(14) fide = CUVc
2022-01-27 18:28:10 /THREAD(14) D4SegmentStore failed


same with 2021-12-28 version, except the last line in the log is
2022-01-27 18:48:13 /THREAD(13) holding wrong DV

Aldevinas Katkus
1-28-22
Update:
the same procedure works if I use tecnics>>settings>>Timed Operations>>Background tasks>>Hal routine and crashes if I use NewPeriodicTask2() to run the same procedure every 60/180 seconds (interval does not matter, crashes on the first run).
What I can see, RecordSave() is beging executed in both cases, but RecordStore(ContactCUr,false) fails with crash in Periodic task.


Any ideas why this happens?


With tecnics>>settings>>Timed Operations>>Background tasks>>Hal routine:
2022-01-28 12:12:22 MyNewContactCUDsmRemote 2 GetNextCustNr=AK5

2022-01-28 12:12:22 MyNewContactCUDsmRemote 3 will store ContactCUr.Code=AK5
2022-01-28 12:12:22 CUVcRecordSave AK5
2022-01-28 12:12:22 MyNewContactCUDsmRemote store success


With periodic tasks:
2022-01-28 11:44:37 /THREAD(13) MyNewContactCUDsmRemote 2 GetNextCustNr=AK5
2022-01-28 11:44:37 /THREAD(13) MyNewContactCUDsmRemote 3 will store ContactCUr.Code=AK5
2022-01-28 11:44:37 /THREAD(13) CUVcRecordSave AK5
2022-01-28 11:44:37 /THREAD(13) Damaged database: D4DiskStore dvp!=gp->MasterDVp

2022-01-28 11:44:37 /THREAD(13) D4DiskStore

2022-01-28 11:44:37 /THREAD(13) dump of call stack


David Delač
1-28-22
Hi Aldevinas,

Please create a bug report containing text backup, halcust and steps to reproduce the issue and let me know when It's done. I have to debug it myself to get better idea of what could be wrong.

Best Regards,
David D.
Aldevinas Katkus
2-1-22
I could not repeat it in a separate hal.


I am not sure what I did so it does not crash anymore. It could be I made a queued function call like this:

external updating procedure IVImportIn();

global
procedure DoIVImportTask(string args)
begin

queued.IVImportIn; //call a function which has some qupdating function calls
return;

end;

global
procedure InitIVImportTask()
begin
//used to crash in NewContactCUDsmRemote() when used as Periodic Task: Damaged database: D4DiskStore dvp!=gp->MasterDVp D4DiskStore
NewPeriodicTask2("IVImportTask","IVImportTask","DoIVImportTask","",60,"");

return;
end;
Leave Comment
You can subscribe to notifications for this post by selecting the 'star' icon on the top right corner of the post.
Back to the list
Latest Posts
Afternoon, Some of our customers haven't changed their passwords for a while but they're not getting any password expiry message. If I copy their Standard ID into a new user on some test ...
17:22 25 Apr 2024
Andis Blicāns, Grasko
Hi, We have client using 8.5 2021-09-26 (build 85400383). The fields "Max Web Users" and "Max Sessions" ar blank. Server is closing itself almost every day. Message in hansa....
13:09 25 Apr 2024