06-03-2019, 02:10 AM
(This post was last modified: 06-03-2019, 02:55 AM by Alexandre Machado.)
I think IW 10 was released more than 10 years ago. You should have in mind that multi-core computing was just starting to crawl in 2009. Most computers had 1-2 cores (Intel released its first quad core on 2008).
I'm sure that around that time most Delphi "multi-threading" code would actually run serialized and very few issues regarding multi-threading would surface. Code running in a Core 2 Duo in 2009 would never present the same issues (race conditions and *specially* dead locks) as it would running in a new 32-core Ryzen Threadripper CPU.
I don't have any simple answer for you, but here are my comments on each link you mentioned:
Yes, this is a major problem which can be reproduced in test environment. Our fix introduces a new critical section object in order to avoid an application crash. This fix has been redesigned in newer IW 15.1.0 (currently being tested) and won't use any critical sections. I have never found issues with race conditions, but when 3rd party and user code is involved, certainly a dead lock is a possibility. I don't see how an exception or an application crash could come from this, though.
There are some other places in RTL where you can find potential problems (which would never happen on a Core 2-Duo but can definitely appear on a 32-core CPU, like DFM steraming)
Retrieving all sessions in one locked list is a bad idea. Really. It might "work" for a tiny application with 5 users, but not more than this. We have also redesigned this "feature" completely in newer IW 15.1.0. BTW, it doesn't involve any critical sections to retrieve a session list.
About the SRW lock (Slim Reader Writer), it replaced the session list critical section since latest IW 12 versions. It is faster than a std critical section and scales much better because allow multiple readers with the drawback that it can't be used recursively (something we don't do anyway in IW code)
This specific critical section object doesn't exist in IW 10 (or 11 and 12 either). It was introduced in IW 14. A recent change in design made it unnecessary.
This fix has been applied to IW since version 12, IIRC. The article doesn't explain it deeply but that's definitely a problem that should be addressed.
I'm sure that around that time most Delphi "multi-threading" code would actually run serialized and very few issues regarding multi-threading would surface. Code running in a Core 2 Duo in 2009 would never present the same issues (race conditions and *specially* dead locks) as it would running in a new 32-core Ryzen Threadripper CPU.
I don't have any simple answer for you, but here are my comments on each link you mentioned:
Quote:https://www.atozed.com/2012/01/20121030-en/)
Yes, this is a major problem which can be reproduced in test environment. Our fix introduces a new critical section object in order to avoid an application crash. This fix has been redesigned in newer IW 15.1.0 (currently being tested) and won't use any critical sections. I have never found issues with race conditions, but when 3rd party and user code is involved, certainly a dead lock is a possibility. I don't see how an exception or an application crash could come from this, though.
There are some other places in RTL where you can find potential problems (which would never happen on a Core 2-Duo but can definitely appear on a 32-core CPU, like DFM steraming)
Quote:https://forums.embarcadero.com/thread.js...eID=763497
Retrieving all sessions in one locked list is a bad idea. Really. It might "work" for a tiny application with 5 users, but not more than this. We have also redesigned this "feature" completely in newer IW 15.1.0. BTW, it doesn't involve any critical sections to retrieve a session list.
About the SRW lock (Slim Reader Writer), it replaced the session list critical section since latest IW 12 versions. It is faster than a std critical section and scales much better because allow multiple readers with the drawback that it can't be used recursively (something we don't do anyway in IW code)
Quote:https://www.atozed.com/2019/04/15-0-21-version-history/
This specific critical section object doesn't exist in IW 10 (or 11 and 12 either). It was introduced in IW 14. A recent change in design made it unnecessary.
Quote:https://www.delphitools.info/2011/11/30/...alsection/
This fix has been applied to IW since version 12, IIRC. The article doesn't explain it deeply but that's definitely a problem that should be addressed.

