<endformationage>
Is there a way to stop Timers such that it will allow a program to end without requiring termination?
<endformationage>
I tried to send the dispose() message to timers from a notifier's cancel callback, but it still ran.
<SeanTAllen>
can you gist the code that you use to dispose endformationage ?
<SeanTAllen>
are you sending a cancel message to the Timers object endformationage ?
<SeanTAllen>
note that dispose does not cancel any a Timer
<SeanTAllen>
it only disposes of the timing wheel
<endformationage>
I returned false in a TimerNotify apply call, and the notifier's cancel does get called. From there I've tried dispose() on the `timers` wheels as closed upon, as well as via a behavior back on the Main actor where the wheels live.
<jemc>
`Timers.dispose()` should be enough - you shouldn't need to also cancel the individual timers
<SeanTAllen>
I'm confused by that description
<SeanTAllen>
Can you gist the code?
<endformationage>
Right, putting together a simplified example.
<endformationage>
..
<jemc>
I'm guessing that either 1) dispose isn't actually getting called, or 2) you have another "noisy" actor keeping your program from hitting quiesence
<SeanTAllen>
that would be my theory as well
<SeanTAllen>
but i also suspect that perhaps i am not understanding the problem correctly
<SeanTAllen>
when in doubt, i assume my understand is incorrect
<endformationage>
Lol, the example I just came up with behaved as expected..
TheLemonMan has joined #ponylang
<jemc>
endformationage: so to test my two theories:
<jemc>
1) add a `Debug` statement right after you call `Timers.dispose`
<SeanTAllen>
endformationage: how large is your non-simplified code?
<jemc>
2) ask yourself if there are any other "noisy" actors running - anything that "generates" messages from scratch like `Timers`, or gets input from outside the program like `TCPConnection`
<endformationage>
jemc: yeah, using net/HTTP
<SeanTAllen>
endformationage: incoming or outgoing?
<endformationage>
Incoming. Though, I had put the same code run by the timer in it's own function, called strait away the program completes fine.
<SeanTAllen>
are you shutting down the HTTP server endformationage ?
<endformationage>
Excuse me, I meant client requests
<SeanTAllen>
ok, those outgoing requests create tcp connections that need to be shutdown
<endformationage>
.. and the session is disposed when finished is called on the handler
<endformationage>
BTW, The program completes fine after requests without the use of timers.
<SeanTAllen>
sounds like there is something else going on other than what you've mentioned so far then
<SeanTAllen>
without seeing code, its basically just guessing from this end.
<endformationage>
Yeah, must be something to do with the HTTPClient and sessions, as I just ran my example without disposing timers and program still completed.
<endformationage>
Odd though that I can run the same requests (without being wrapped and delayed by a timer) and program will complete.
<endformationage>
jemc: SeanTAllen: are there any articles where I can learn more about quiesence in Pony? Or does it pretty much boil down to dispose of 'generating' actors?
<jemc>
I don't know if much has been written about it, but it boils down to Pony making a determination that no actors in your program will ever be able to receive more messages in the future, which is determined by two factors:
<jemc>
1) if there are any messages already in flight, then those messages could cause new messages to that actor, or any other actor that the actor can "reach" (has a reference to)
<jemc>
2) if an actor has a subscription to Pony's underlying asynchronous I/O engine (shortened as "asio", but not to be confused with the popular unix audio engine by the same name), then that actor can receive new messages at any time from I/O
<jemc>
the latter kind of actor is referred to as being "noisy", since as long as it is subscribed to the asio engine, the program cannot be quiescent
<endformationage>
jemc: Thanks, that is very helpful. In fact this short description should go into the tutorial I feel.
<jemc>
the key thing that needs to happen is the C FFI call to `@pony_asio_event_unsubscribe`, which is what `dispose` on a noisy actor ultimately does
<jemc>
endformationage: yes, you're probably right that it should be in the tutorial somewhere
<endformationage>
1 makes me wonder if there's any way to see what messages are pending for actors to process? 2 makes me think of the SSLContext carried by the HTTPClient, which looks like it has a dispose fun
<endformationage>
HTTPClient does not however.
<endformationage>
SeanTAllen: jemc: Thanks for the help, will toy with it more after lunch!
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
jemc has quit [Ping timeout: 240 seconds]
darach has quit [*.net *.split]
srenatus[m] has quit [*.net *.split]
jeremyheiler has quit [*.net *.split]
j14159 has quit [*.net *.split]
jeremyheiler has joined #ponylang
srenatus[m] has joined #ponylang
j14159 has joined #ponylang
darach has joined #ponylang
M-hrjet has quit [Ping timeout: 246 seconds]
buchanon[m] has quit [Ping timeout: 258 seconds]
srenatus[m] has quit [Ping timeout: 272 seconds]
katafrakt[m] has quit [Ping timeout: 264 seconds]
mindB has quit [Ping timeout: 240 seconds]
dtz has quit [Ping timeout: 240 seconds]
irx[m] has quit [Ping timeout: 246 seconds]
irx[m] has joined #ponylang
srenatus[m] has joined #ponylang
mindB has joined #ponylang
M-hrjet has joined #ponylang
dtz has joined #ponylang
katafrakt[m] has joined #ponylang
buchanon[m] has joined #ponylang
<SeanTAllen>
endformationage: re: 1- no there isn't
<SeanTAllen>
_ClientConnection that is stored in HTTPClient, each one of those has a TCPConnection associated with it that needs to be shutdown.
<SeanTAllen>
I'd suggest dropping some debugs in key points in the standard library classes to make sure things you expect are getting shutdown are (like, close() is being called on your TCPConnections)
Matthias247 has quit [Read error: Connection reset by peer]