Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-15 Thread Luca Olivetti
El 15/2/19 a les 12:27, J. Gareth Moreton ha escrit: I dare say, I would consider elevating this, especially as it's a feature being used by an end user and is pretty serious if a multi-threaded program can sometimes freeze due to a race hazard. The problem is, as I said before, I cannot

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-15 Thread J. Gareth Moreton
I dare say, I would consider elevating this, especially as it's a feature being used by an end user and is pretty serious if a multi-threaded program can sometimes freeze due to a race hazard. Unfortunately, I don't use threads enough to know for sure how the underlying classes work, otherwise

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-07 Thread Luca Olivetti
El 7/2/19 a les 0:10, Martin Frb ha escrit: On 06/02/2019 23:38, Luca Olivetti wrote: and the exception logged (though the logging in turn uses synchronize). What OS? On Windows you can use  LazLogger.  (in Laz 2.0.0) It uses TThread.Queue by default, but you can replace

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-06 Thread Martin Frb
On 06/02/2019 23:38, Luca Olivetti wrote: and the exception logged (though the logging in turn uses synchronize). What OS? On Windows you can use  LazLogger.  (in Laz 2.0.0) It uses TThread.Queue by default, but you can replace TLazLoggerFileHandleMainThread with

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-06 Thread Luca Olivetti
El 6/2/19 a les 22:26, Martin Frb ha escrit: On 06/02/2019 22:04, Martin Frb wrote: Actually from a further review of the source, there may be another issue: https://bugs.freepascal.org/view.php?id=35027 The fact that FSynchronizeEntry^.Next was set to nil after the call to

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-06 Thread Martin Frb
On 06/02/2019 22:04, Martin Frb wrote: Actually from a further review of the source, there may be another issue: https://bugs.freepascal.org/view.php?id=35027 ___ fpc-devel maillist - fpc-devel@lists.freepascal.org

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-06 Thread Martin Frb
Actually from a further review of the source, there may be another issue: TThread.Synchronize will call   ThreadQueueAppend(AThread.FSynchronizeEntry); AThread.FSynchronizeEntry is the re-usable entry (which is fine, only one synchronize call can be active in any given thread. (Unless you are

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-06 Thread Luca Olivetti
El 6/2/19 a les 19:19, Luca Olivetti ha escrit: El 6/2/19 a les 18:51, Sven Barth via fpc-devel ha escrit: Would you nevertheless try with 3.2, please? Just in case it happens to be the problem I had fixed in regards to Queue(). The branch is fixes_3_2? Apart from the issue reported by

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-06 Thread Luca Olivetti
El 6/2/19 a les 19:29, Martin Frb ha escrit: On 06/02/2019 16:19, Luca Olivetti wrote: . In my case the problem is with Synchronize, the synchronized method is never called and the thread gets stuck there. "synchronized method is never called" So is the main thread running, and either idle,

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-06 Thread Luca Olivetti
El 6/2/19 a les 18:51, Sven Barth via fpc-devel ha escrit: Would you nevertheless try with 3.2, please? Just in case it happens to be the problem I had fixed in regards to Queue(). The branch is fixes_3_2? Apart from the issue reported by Martin

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-06 Thread Martin Frb
On 06/02/2019 16:19, Luca Olivetti wrote: . In my case the problem is with Synchronize, the synchronized method is never called and the thread gets stuck there. "synchronized method is never called" So is the main thread running, and either idle, app.ProcessMessages, or CheckSynchronize? The

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-06 Thread Sven Barth via fpc-devel
Am Mi., 6. Feb. 2019, 18:45 hat Luca Olivetti geschrieben: > El 6/2/19 a les 17:05, Sven Barth via fpc-devel ha escrit: > > Am Mi., 6. Feb. 2019, 11:27 hat Luca Olivetti > > geschrieben: > > > > Of course I cannot reproduce the issue with a simpler test program >

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-06 Thread Luca Olivetti
El 6/2/19 a les 17:05, Sven Barth via fpc-devel ha escrit: Am Mi., 6. Feb. 2019, 11:27 hat Luca Olivetti > geschrieben: Of course I cannot reproduce the issue with a simpler test program :-/ Without a way to test it I can't do anything. So either you need to find

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-06 Thread Sven Barth via fpc-devel
Am Mi., 6. Feb. 2019, 11:27 hat Luca Olivetti geschrieben: > Of course I cannot reproduce the issue with a simpler test program :-/ > Without a way to test it I can't do anything. So either you need to find the issue yourself or you need to manage to create a simpler example. Regards, Sven >

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-06 Thread Luca Olivetti
El 6/2/19 a les 14:08, Martin Frb ha escrit: On 06/02/2019 09:01, Luca Olivetti wrote: I still think there's something wrong with thread in fpc 3.0.4. There is https://bugs.freepascal.org/view.php?id=34640 FIxed in 3.2 branch I'm not sure it's the same issue. The comment in the commit

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-06 Thread Martin Frb
On 06/02/2019 09:01, Luca Olivetti wrote: I still think there's something wrong with thread in fpc 3.0.4. There is https://bugs.freepascal.org/view.php?id=34640 FIxed in 3.2 branch If you can compile your app for linux, run it under valgrind, especially the helgrind tool.

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-06 Thread Luca Olivetti
El 6/2/19 a les 9:01, Luca Olivetti ha escrit: Debugging the program here, I see the thread is stopped inside a synchronize call that is never executed. [] so that, by putting a breakpoint in the main program when it checks if the thread has finished its job, I can examine the thread

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-06 Thread Martin Frb
On 06/02/2019 09:01, Luca Olivetti wrote: I still think there's something wrong with thread in fpc 3.0.4. There is https://bugs.freepascal.org/view.php?id=34640 FIxed in 3.2 branch If you can compile your app for linux, run it under valgrind, especially the helgrind tool.

Re: [fpc-devel] Suspicion about TThread.Synchronize

2019-02-06 Thread Luca Olivetti
El 4/2/18 a les 20:17, Sven Barth via fpc-devel ha escrit: What happens if - thread 1, has just finished the line ThreadQueueAppend(AThread.FSynchronizeEntry); - thread 2 now calls synchronize, and    - as soon as thread1 leaves the CriticalSection in ThreadQueueAppend => thread2 enters that

Re: [fpc-devel] Suspicion about TThread.Synchronize

2018-02-05 Thread Sven Barth via fpc-devel
On 05.02.2018 03:03, Martin wrote: > Ok, I got it again in the debugger. > > Since it is nor reproducible all the times, I am using auto continue > breakpoints, and just record that they were hit. So I have limited data. > > - After a long series of syncs ThreadQueueTail is nil. > - A thread

Re: [fpc-devel] Suspicion about TThread.Synchronize

2018-02-04 Thread Martin
Ok, I got it again in the debugger. Since it is nor reproducible all the times, I am using auto continue breakpoints, and just record that they were hit. So I have limited data. - After a long series of syncs ThreadQueueTail is nil. - A thread calls ThreadQueueAppend (from within Syncronize)

Re: [fpc-devel] Suspicion about TThread.Synchronize

2018-02-04 Thread Martin
On 04/02/2018 20:33, Martin wrote: On 04/02/2018 20:23, Sven Barth via fpc-devel wrote: Would you please test whether my change in r38115 (applied to 3.0.2) makes any difference? Calling RemoveQueuedEvents() with a thread, but no method (which happens during a thread's destruction) was up to

Re: [fpc-devel] Suspicion about TThread.Synchronize

2018-02-04 Thread Martin
On 04/02/2018 20:23, Sven Barth via fpc-devel wrote: Would you please test whether my change in r38115 (applied to 3.0.2) makes any difference? Calling RemoveQueuedEvents() with a thread, but no method (which happens during a thread's destruction) was up to then a way to corrupt the queue.

Re: [fpc-devel] Suspicion about TThread.Synchronize

2018-02-04 Thread Sven Barth via fpc-devel
On 04.02.2018 20:37, Martin wrote: > On 04/02/2018 19:17, Sven Barth via fpc-devel wrote: >> On 03.02.2018 17:39, Martin wrote: >>> All based on win32 >>> >>> Pretext: >>> I have an issue with a crash in PopThreadQueueHead called by >>> CheckSynchronize.  (3.0.2) >>> It happens in the Lazarus IDE,

Re: [fpc-devel] Suspicion about TThread.Synchronize

2018-02-04 Thread Martin
On 04/02/2018 19:17, Sven Barth via fpc-devel wrote: On 03.02.2018 17:39, Martin wrote: All based on win32 Pretext: I have an issue with a crash in PopThreadQueueHead called by CheckSynchronize.  (3.0.2) It happens in the Lazarus IDE, but at a low percentage only. (And not yet in the debugger)

Re: [fpc-devel] Suspicion about TThread.Synchronize

2018-02-04 Thread Sven Barth via fpc-devel
On 03.02.2018 17:39, Martin wrote: > All based on win32 > > Pretext: > I have an issue with a crash in PopThreadQueueHead called by > CheckSynchronize.  (3.0.2) > It happens in the Lazarus IDE, but at a low percentage only. (And not > yet in the debugger) > I don't think the below is related, but