Comments (5)
Hi @dalijap that is a good point. One additional check can be before the method invoke to check if the Subscriber is not nil:
if not Assigned( ASubscription.Subscriber) then
Exit;
if not ASubscription.Active then
Exit;
Other than that we could also think about a callback in case of exception. Because as you can see from the method below the exception will be handled:
try
if not ASubscription.Active then
Exit;
ASubscription.SubscriberMethod.Method.Invoke(ASubscription.Subscriber, Args);
except
on E: Exception do begin
raise EInvokeSubscriberError.CreateFmt(
'Error invoking subscriber method. Subscriber class: %s. Event type: %s. Original exception %s: %s.',
[
ASubscription.Subscriber.ClassName,
ASubscription.SubscriberMethod.EventType,
E.ClassName,
E.Message
]);
end;
end;
Then also around the crash, it would be limited to the single thread/task.
We can also think to change the Subscription into an interface.
What do you think? do you have additional suggestions for the issue?
Thanks :)
from delphi-event-bus.
here a PR #65
from delphi-event-bus.
Using the last change #65 that was proposed by @spinettaro in a production application that does not have a heavy use of Teventbus, and with TEurekalog enabled to send me messages when application freezes for more than 10sec, I get occasionally a log event like the following:
from delphi-event-bus.
HI @dkounal do you mean there is a freeze now? Do you see a difference with a previous version of DEB (before #65)? Is the freeze time the second column from the right?
from delphi-event-bus.
To be honest, it is difficult to compare with before #65, as I had many changes in the code and a bug fix in a component that was used by after Teventmessage comes.
Teurekalog has a function where you can request to log when an application UI freezes and have also the callstack. I have put a 10seconds timeframe to log for freezing
Their call stack list is not so accurate to say when the app is freezed. But before classes from Eurekalog appear in the above image's stack list, it is a Teventbus in action that exists in the call stack.
In the past I had messages like the above, I think more frequently with the previous version of Teventbus.
I am not so experienced and I posted if it helps somehow. I will keep following to grab a more helpful message.
from delphi-event-bus.
Related Issues (20)
- consider making arguments const that are of managed types such as interface, string, TValue and so on HOT 1
- You are mistakenly attributing some code to me that is not HOT 1
- Error invoking subscriber method. Subscriber class: <something> . Original exception: EInvalidCast: Invalid class typecast HOT 33
- Error Undeclared TEventBusFactory HOT 4
- Hang on splash screen HOT 8
- Minor improvement of subscriber registration HOT 3
- REQUEST: Set Context on registration HOT 19
- Faster MREW for DEB ? HOT 8
- Remove dependency on DUnitX.Utils HOT 1
- Request/Reply pattern HOT 2
- [Question] "Active" property in TSubscription - how to use it? HOT 3
- TList inside posted event objects empties on Delphi 11 Alexandria HOT 2
- The project's headed to the wrong direction, unfortunately... HOT 6
- SubscribeAttribute in public, protected and private methods.
- DEB on Android HOT 2
- Crashes galore on theme change HOT 4
- Background / Async tasks deadlock HOT 1
- Question: Explanation/Examples for TThreadMode Subscriptions HOT 1
- About thread mode HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from delphi-event-bus.