You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that reseal_timer.schedule_once in the ResealTimer::set_min_timer causes crash.
I suspect that the cause of the crash is #1041 's modification.
@sgkim126@foriequal0
How about adding an atomic version of cancle_and_schedule_once?
Yes Schedule::schedule function puts a ScheduleStateControl to the SchedulerInner (with lock), and Schedule::cancel function finds ScheduleStateControl from it, and it should be sequential. But even if it succeeds to fire cancel signal, it can race with on_timeout scheduling (callback could be called)
Before the token is expired, it should return Err(TokenAlreadyScheduled), otherwise, it should succeed.
@majecty I discussed with @foriequal0
IMO, the atomic cancle_and_schedule_once works in the same if
the order in the same transaction is guaranteed
it's okay to schedule already scheduled token
it's okay to cancel already canceled token
And currently, the only error returned by schedule_once is AlreadyScheduled.
So I think it's okay if you just ignore the error of schedule_once function.
Activity
sgkim126 commentedon Jan 9, 2019
@foriequal0
I have three questions.
foriequal0 commentedon Jan 9, 2019
@sgkim126
Yes
Schedule::schedulefunction puts aScheduleStateControlto theSchedulerInner(with lock), andSchedule::cancelfunction findsScheduleStateControlfrom it, and it should be sequential. But even if it succeeds to fire cancel signal, it can race with on_timeout scheduling (callback could be called)Before the token is expired, it should return
Err(TokenAlreadyScheduled), otherwise, it should succeed.It just returns
false.sgkim126 commentedon Jan 9, 2019
@majecty I discussed with @foriequal0
IMO, the atomic
cancle_and_schedule_onceworks in the same ifAnd currently, the only error returned by
schedule_onceisAlreadyScheduled.So I think it's okay if you just ignore the error of
schedule_oncefunction.majecty commentedon Jan 9, 2019
OK, I'll fix it by ignoring AlreadyScheduled error.