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
EStringListError inside ConstructURL
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: EStringListError inside ConstructURL
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
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
Re: EStringListError inside ConstructURL
it caused by calling Connect in thread maybe DriverManager should be protected by mutex or FURL should be method var or something like that
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: EStringListError inside ConstructURL
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
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
Re: EStringListError inside ConstructURL
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
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
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: EStringListError inside ConstructURL
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
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
Re: EStringListError inside ConstructURL
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
https://gist.github.com/Sorien/fda8c65c ... e4dc7fd7b4
TLock just encapsulate TRTLCriticalSection