View Issue Details

IDProjectCategoryView StatusLast Update
0033252FPCDatabasepublic2018-04-23 10:02
ReporterPascal RiekenbergAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformi386OSWindows 10 x64OS Version1709
Product Version3.1.1Product Build38356 
Target Version3.2.0Fixed in Version3.1.1 
Summary0033252: AV in BufDataset due to latest changes for multiple indexes
DescriptionWhen calling Refresh on an active dataset an AV happens in

TDataSet.Refresh
TCustomSQLQuery.InternalRefresh
TCustomBufDataset.InternalRefresh
TCustomBufDataset.InternalOpen
TCustomBufDataset.InitUserIndexes
TCustomBufDataset.BuildIndex
TCustomBufDataset.InternalCreateIndex:
  ...
  DblLinkIndex:=(AIndex as TDoubleLinkedBufIndex);
>>Index0:=DefaultIndex.BufferIndex as TDoubleLinkedBufIndex;
  myIdx:=DblLinkIndex.IndNr;
  ...
Additional Informationrelated https://bugs.freepascal.org/view.php?id=32962
TagsNo tags attached.
Fixed in Revision38804
FPCOldBugId
FPCTarget
Attached Files

Activities

Pascal Riekenberg

2018-02-27 15:03

reporter   ~0106676

Last edited: 2018-02-27 15:19

View 2 revisions

If i do:

Active := False;
Active := True;

instead of

Refresh

everything works as expected.

Michael Van Canneyt

2018-03-22 21:38

administrator   ~0107343

Fixed. Thanks for reporting!

Pascal Riekenberg

2018-03-23 11:09

reporter   ~0107363

Last edited: 2018-03-23 11:16

View 3 revisions

No, still doesn't work for my MySQL database. Now (not always) it crashes in


TDataSet.Refresh
TCustomSQLQuery.InternalRefresh
TCustomBufDataset.InternalRefresh
TCustomSQLQuery.InternalOpen
TCustomBufDataset.InternalOpen
TCustomBufDataset.InitDefaultIndexes
TCustomBufDataset.InternalAddIndex
TCustomBufDataset.InternalCreateIndex
TCustomBufDataset.FetchAll
TCustomBufDataset.getnextpacket
  ...
>>CurrentIndexBuf.BeginUpdate;
  ...

CurrentIndexBuf delivers garbage due to an invalid(freed?) FCurrentIndexDef

Michael Van Canneyt

2018-03-23 11:21

administrator   ~0107369

Please give a complete reproducable example.

Pascal Riekenberg

2018-03-23 12:58

reporter   ~0107373

Set up a TSQLQuery with param.
Set param so that no data will be avilable.
Set Active to True.
Set param so that data will be available.
Call Refresh -> Crash

If you set the initial param so that data will be found
calls to Refresh never crash.

Pascal Riekenberg

2018-04-10 12:52

reporter   ~0107733

There also seems to be a mem leak:

Call trace for block $0000000011E30D20 size 236
  $000000010001365C SYSALLOCMEM, line 1324 of ../inc/heap.inc
  $000000010001A71A TRACEALLOCMEM, line 1271 of ../inc/heaptrc.pp
  $000000010001257B ALLOCMEM, line 344 of ../inc/heap.inc
  $000000010048169E INTALLOCRECORDBUFFER, line 1327 of fcl-db/src/base/bufdataset.pas
  $0000000100482F39 INTERNALCREATEINDEX, line 2239 of fcl-db/src/base/bufdataset.pas
  $0000000100482E7A INTERNALADDINDEX, line 2217 of fcl-db/src/base/bufdataset.pas
  $0000000100482CAE INITDEFAULTINDEXES, line 2177 of fcl-db/src/base/bufdataset.pas
  $00000001004818F0 INTERNALOPEN, line 1405 of fcl-db/src/base/bufdataset.pas

Pascal Riekenberg

2018-04-16 12:33

reporter  

Test.zip (1,066,320 bytes)

Pascal Riekenberg

2018-04-16 12:35

reporter   ~0107807

Michael,

i've uploaded a test project to reproduce the bug.
test.sql is an sqldump of table test which is used in the app.
App uses user test with password test and database test with table test.

Michael Van Canneyt

2018-04-22 10:05

administrator   ~0107906

Fixed, thanks for the test program.

Pascal Riekenberg

2018-04-23 08:47

reporter   ~0107944

Works now! Thanks. But memory leak still exists:

Call trace for block $0000000014B1F4B0 size 236
  $000000010001365C SYSALLOCMEM, line 1324 of ../inc/heap.inc
  $000000010001A71A TRACEALLOCMEM, line 1271 of ../inc/heaptrc.pp
  $000000010001257B ALLOCMEM, line 344 of ../inc/heap.inc
  $0000000100481AFE INTALLOCRECORDBUFFER, line 1328 of fcl-db/src/base/bufdataset.pas
  $00000001004833B1 INTERNALCREATEINDEX, line 2243 of fcl-db/src/base/bufdataset.pas
  $00000001004832EA INTERNALADDINDEX, line 2220 of fcl-db/src/base/bufdataset.pas
  $00000001004830C0 INITDEFAULTINDEXES, line 2169 of fcl-db/src/base/bufdataset.pas
  $0000000100481D50 INTERNALOPEN, line 1406 of fcl-db/src/base/bufdataset.pas

Michael Van Canneyt

2018-04-23 09:20

administrator   ~0107946

Fixed in rev 38817.

Pascal Riekenberg

2018-04-23 10:02

reporter   ~0107947

Perfect!

Issue History

Date Modified Username Field Change
2018-02-27 13:13 Pascal Riekenberg New Issue
2018-02-27 15:03 Pascal Riekenberg Note Added: 0106676
2018-02-27 15:19 Pascal Riekenberg Note Edited: 0106676 View Revisions
2018-03-18 18:26 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-03-18 18:26 Michael Van Canneyt Status new => assigned
2018-03-22 21:38 Michael Van Canneyt Fixed in Revision => 38597
2018-03-22 21:38 Michael Van Canneyt Note Added: 0107343
2018-03-22 21:38 Michael Van Canneyt Status assigned => resolved
2018-03-22 21:38 Michael Van Canneyt Fixed in Version => 3.1.1
2018-03-22 21:38 Michael Van Canneyt Resolution open => fixed
2018-03-22 21:38 Michael Van Canneyt Target Version => 3.2.0
2018-03-23 11:09 Pascal Riekenberg Note Added: 0107363
2018-03-23 11:09 Pascal Riekenberg Status resolved => feedback
2018-03-23 11:09 Pascal Riekenberg Resolution fixed => reopened
2018-03-23 11:09 Pascal Riekenberg Note Edited: 0107363 View Revisions
2018-03-23 11:16 Pascal Riekenberg Note Edited: 0107363 View Revisions
2018-03-23 11:21 Michael Van Canneyt Note Added: 0107369
2018-03-23 12:58 Pascal Riekenberg Note Added: 0107373
2018-03-23 12:58 Pascal Riekenberg Status feedback => assigned
2018-04-10 12:52 Pascal Riekenberg Note Added: 0107733
2018-04-16 12:33 Pascal Riekenberg File Added: Test.zip
2018-04-16 12:35 Pascal Riekenberg Note Added: 0107807
2018-04-22 10:05 Michael Van Canneyt Fixed in Revision 38597 => 38804
2018-04-22 10:05 Michael Van Canneyt Note Added: 0107906
2018-04-22 10:05 Michael Van Canneyt Status assigned => resolved
2018-04-22 10:05 Michael Van Canneyt Resolution reopened => fixed
2018-04-23 08:47 Pascal Riekenberg Note Added: 0107944
2018-04-23 08:47 Pascal Riekenberg Status resolved => feedback
2018-04-23 08:47 Pascal Riekenberg Resolution fixed => reopened
2018-04-23 09:20 Michael Van Canneyt Note Added: 0107946
2018-04-23 09:20 Michael Van Canneyt Status feedback => resolved
2018-04-23 09:20 Michael Van Canneyt Resolution reopened => fixed
2018-04-23 10:02 Pascal Riekenberg Note Added: 0107947
2018-04-23 10:02 Pascal Riekenberg Status resolved => closed