May 29, 2022
On 5/29/22 13:53, Christian Köstlin wrote:

> According to
> https://www.schveiguy.com/blog/2022/05/comparing-exceptions-and-errors-in-d/ 

> its bad to catch Errors ...

Correct in the sense that the program should not continue after catching Error.

> so dowork should catch only Exception?

It should catch Error as well. Otherwise you will have no idea why a thread disappeared. You may agree with me here:

  https://youtu.be/dRORNQIB2wA?t=1950

I catch'ed Throwable in the code just because it's a quick little experiment.

> it might be better
> to crash directly ...

Sounds good but only after leaving the reason behind somehow.

Ali

May 29, 2022
On 5/29/22 13:47, Christian Köstlin wrote:

> Our discussion with using TLS for the
> collectors proposed to not need any lock on the add method for
> collector, because its thread local and with that thread safe?

It would be great that way but then the client changed the requirements on us:

On 5/26/22 12:54, Christian Köstlin wrote:
> I want to be able to dump tracings even while the program is still running.

:p

If the collected data were TLS, then the dumping thread should be able to ask each thread to provide data collected so far. That either requires synchronization, which I did, which necessitated shared Collector objects; or messaging, which would require each thread checking their Concurrency message box.

I don't know...

A third option came to me: Each thread periodically puts their data to a common location and dumper dumps whatever is aggregated up to that point. This would reduce contention.

Ali

May 31, 2022

On 2022-05-29 23:08, Ali Çehreli wrote:

>

On 5/29/22 13:47, Christian Köstlin wrote:

>

Our discussion with using TLS for the
collectors proposed to not need any lock on the add method for
collector, because its thread local and with that thread safe?

It would be great that way but then the client changed the requirements on us:

On 5/26/22 12:54, Christian Köstlin wrote:

>

I want to be able to dump tracings even while the program is still running.

:p

If the collected data were TLS, then the dumping thread should be able to ask each thread to provide data collected so far. That either requires synchronization, which I did, which necessitated shared Collector objects; or messaging, which would require each thread checking their Concurrency message box.

I don't know...

A third option came to me: Each thread periodically puts their data to a common location and dumper dumps whatever is aggregated up to that point. This would reduce contention.
Thats also a nice idea, e.g. the collectors could aggregate their data and only propagate it once every second or every 10 seconds, or every 1000 events or something! Will think about that some more!

Thanks a lot!
Christian

May 31, 2022

On 2022-05-29 23:00, Ali Çehreli wrote:

>

On 5/29/22 13:53, Christian Köstlin wrote:

>

According to
https://www.schveiguy.com/blog/2022/05/comparing-exceptions-and-errors-in-d/

>

its bad to catch Errors ...

Correct in the sense that the program should not continue after catching Error.

>

so dowork should catch only Exception?

It should catch Error as well. Otherwise you will have no idea why a thread disappeared. You may agree with me here:

  https://youtu.be/dRORNQIB2wA?t=1950

Thanks a lot for this explanation!
Probably a try catch (Throwable) is a good thing to have in any thread that does not only use nothrows ...

>

I catch'ed Throwable in the code just because it's a quick little experiment.

>

it might be better
to crash directly ...

Sounds good but only after leaving the reason behind somehow.

Ali

Kind regards,
Christian

1 2
Next ›   Last »