Forum > Unix

[SOLVED] TThread.WaitFor locks forever

<< < (2/2)

Gustavo 'Gus' Carreno:
Hey paweld !!


--- Quote from: paweld on September 04, 2023, 07:02:51 am ---Remove SetSize(0) from CriticalSection (in procedureTManagerThread.Clear) because "GetNextItem" already blocks CS. 

--- End quote ---

This is awesome !!! SOOOO MANY THANKS !!
I never suspected a deadlock and so I never went and find out :)


--- Quote from: paweld on September 04, 2023, 07:02:51 am ---And why so many critical sections? 

--- End quote ---

I asked myself the same question, but since the code is not mine and I dunno how to contact the author, I can't give you a good answer, sorry!!!
Some of them kinda make sense when you're moving items from the Waiting to the Processing, And the Processing to the Finished.
But with so many of them, one race condition would inevitably slip through!!
   

--- Quote from: paweld on September 04, 2023, 07:02:51 am ---Tested on Windows 10 and Debian 11

--- End quote ---

Again, many, so many thanks for this!!!

Cheers,
Gus

440bx:

--- Quote from: Gustavo 'Gus' Carreno on September 05, 2023, 01:05:43 am ---I never suspected a deadlock and so I never went and find out :)

--- End quote ---
Just as a matter of course, when you have something that uses more than one (1) synchronization object, the possibility of a deadlock should always be a consideration.

In this particular case, the last message is "waiting for worker 1" in spite of the fact that worker 1 has ended.  This strongly suggests that worker 1 ended without releasing a sync object.

Gustavo 'Gus' Carreno:
Hey 440bx,


--- Quote from: 440bx on September 05, 2023, 01:30:14 am ---
--- Quote from: Gustavo 'Gus' Carreno on September 05, 2023, 01:05:43 am ---I never suspected a deadlock and so I never went and find out :)

--- End quote ---
Just as a matter of course, when you have something that uses more than one (1) synchronization object, the possibility of a deadlock should always be a consideration.

--- End quote ---

You're absolutely correct on this one!!
When I saw that many CSs I asked the same question as @paweld, "Why so many?", and the next thing that came to mind was "This is probably cause some issues if not well managed".
But then I completely forgot about it and just kinda panicked when the thing hung !!


--- Quote from: 440bx on September 05, 2023, 01:30:14 am ---In this particular case, the last message is "waiting for worker 1" in spite of the fact that worker 1 has ended.  This strongly suggests that worker 1 ended without releasing a sync object.

--- End quote ---

From what @paweld mentioned on the above message, I think it's more of a re-entrant issue than something not releasing a CS.
I haven't had the opportunity to read @paweld's corrected code.

Cheers,
Gus

440bx:
Hi Gus,


--- Quote from: Gustavo 'Gus' Carreno on September 05, 2023, 08:12:43 pm ---From what @paweld mentioned on the above message, I think it's more of a re-entrant issue than something not releasing a CS.

--- End quote ---
That's possible too.  The last message displayed indicates there is, most likely, something "suspicious" going on with the sync objects.

Navigation

[0] Message Index

[*] Previous page

Go to full version