RTC Forums
November 23, 2024, 06:51:35 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Login
Register
RTC Forums
>
Subscription
>
Support
>
TRtcTimer cleanup problem
Pages: [
1
]
« previous
next »
Print
Author
Topic: TRtcTimer cleanup problem (Read 5210 times)
Dany
RTC License++
Posts: 69
TRtcTimer cleanup problem
«
on:
October 10, 2017, 02:38:36 PM »
After the last update my server does not stop as nicely as before. I have a situation where i want to .Stop(..) a timer in the "ProviderModule" destructor. Since the destructor is run on application termination (and not on server stop) it will be executed *after* the background management thread has ended resulting in an AV.
To reproduce using the "RTCWebServer" Demo:
1. Open the rtcFileProvider.pas unit.
2. Add a private "TM: TRtcTimer;" and add a private "procedure DummyEventHandler;".
3. In DataModuleCreate, add these lines before "end":
TM := TRtcTimer.Create(true);
TRtcTimer.Enable(TM, 30 * 1000, DummyEventHandler);
4. In DataModuleDestroy, add "TRtcTimer.Stop(TM);" after "File_Provider := nil;".
5. Fix uses clause and give DummyEventHandler an empty implementation.
Now if you start the server explicitly, access it, the stop it and after it has stopped close the application you'll get the same AV as me: in TRtcTimerThread.RemoveTrigger @"FCS.Acquire;". (Seems it can happen in other places too).
I'm not sure this is the best way of doing things. I could probably move the creation, start and destruction to where i handle server start and stop and the problem will most likely go away. I'm posting this so that i can be clear about if this was unintended behaviour of if i was "lucky" when i first wrote that code.
Regards,
/Dany
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: TRtcTimer cleanup problem
«
Reply #1 on:
October 10, 2017, 03:27:24 PM »
Thanks for reporting this. After a quick check, this looks like a bug in the TRtcTimer class implementation, which is trying to access Timer Threads even after they have already been destroyed (as a result of closing the Timer Pool). I'm working on fixing this now and will be releasing an update soon.
Best Regards,
Danijel Tkalcec
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: TRtcTimer cleanup problem
«
Reply #2 on:
October 10, 2017, 06:52:51 PM »
Please, download RTC SDK
v8.33
(just released) and let me know if the problems are now resolved, or if you bump into any other issues.
Best Regards,
Danijel Tkalcec
Logged
Dany
RTC License++
Posts: 69
Re: TRtcTimer cleanup problem
«
Reply #3 on:
October 11, 2017, 07:16:37 AM »
Looks good! I'll shout if anything pops up. Thanks!
/D
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: TRtcTimer cleanup problem
«
Reply #4 on:
October 11, 2017, 09:44:41 AM »
Ok. Thanks again for your feedback.
Best Regards,
Danijel Tkalcec
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...