EStringListError inside ConstructURL

The forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
Post Reply
DPStano
Junior Boarder
Junior Boarder
Posts: 39
Joined: 16.05.2016, 09:21

EStringListError inside ConstructURL

Post by DPStano »

I'm getting this error callstack from multiple users anyone have idea whats wrong, connect is called in thread, each thread has own connection

Delphi 2009

EStringListError: List index out of bounds (1)
Classes: 0 TStringList.Get
Classes: 0 TStrings.Error
Classes: 0 TStringList.Get
Classes: 0 TStrings.IndexOfName
Classes: 0 TStrings.GetValue
ZURL: 435 TZURL.DoOnPropertiesChange
Classes: 0 TStringList.Changed
Classes: 0 TStringList.SetUpdateState
Classes: 0 TStrings.EndUpdate
Classes: 0 TStrings.SetTextStr
ZURL: 133 TZURLStringList.SetTextStr
ZDbcIntfs: 1389 TZDriverManager.ConstructURL
ZAbstractConnection: 722 TZAbstractConnection.ConstructURL
ZAbstractConnection: 849 TZAbstractConnection.Connect
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: EStringListError inside ConstructURL

Post by marsupilami »

Hello DPStano,

to me this look like it either is a bug in the TStringList / TStrings or like a memory corruption. Most probably the latter one since exactly the same call succeeded two lines earlier.

Some databases (MySQL?) require you to have only one call to the connect method at a time. So it might make sense to make sure that only one thread calls the connect method of its TZConnection object at the same time.

With best regards,

Jan
DPStano
Junior Boarder
Junior Boarder
Posts: 39
Joined: 16.05.2016, 09:21

Re: EStringListError inside ConstructURL

Post by DPStano »

it caused by calling Connect in thread maybe DriverManager should be protected by mutex or FURL should be method var or something like that
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: EStringListError inside ConstructURL

Post by marsupilami »

Hello DPStano,

do you have a suggestion on hot to do that? Honestly I don't have much time for doing imporovements currently.

With best regards,

Jan
DPStano
Junior Boarder
Junior Boarder
Posts: 39
Joined: 16.05.2016, 09:21

Re: EStringListError inside ConstructURL

Post by DPStano »

TZDriverManager as global object has to be threadsafe so all access to its private members has to be locked by some Lock TCriticalSection or some Mutex

i'd remove private FURL and add it as var in ConstructURL, ResolveDatabaseUrl, ResolveDatabaseUrl
FDrivers should not change during program runtime so it does need locking, probably
FLoggingListeners updates (AddLoggingListener,RemoveLoggingListener, HasLoggingListener) have to be locked
FLoginTimeout and FHasLoggingListener are atomic
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: EStringListError inside ConstructURL

Post by marsupilami »

Hello DPStano,

could you possibly prepare a patch for this? I am still working on other bugs and don't have as much time for Zeos as I would like to have...

With best regards,

Jan
DPStano
Junior Boarder
Junior Boarder
Posts: 39
Joined: 16.05.2016, 09:21

Re: EStringListError inside ConstructURL

Post by DPStano »

i'll let my implementation here, really do not know if it's absolutely correct but i do not have reported errors so far

https://gist.github.com/Sorien/fda8c65c ... e4dc7fd7b4

TLock just encapsulate TRTLCriticalSection
Post Reply