Skip to content

ResealTimer::set_min_timer causes a crash #1069

Closed

Description

@majecty

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?

Activity

  1. sgkim126 commented on Jan 9, 2019

    @sgkim126
    Contributor

    @foriequal0
    I have three questions.

    1. Is the order of schedule and cancel in the same thread guaranteed?
    2. What happens if the scheduled token is scheduled again?
    3. What happens if the canceled token is canceled again?
  2. foriequal0 commented on Jan 9, 2019

    @foriequal0
    Contributor

    @sgkim126

    1. 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)

    2. Before the token is expired, it should return Err(TokenAlreadyScheduled), otherwise, it should succeed.

    3. It just returns false.

  3. sgkim126 commented on Jan 9, 2019

    @sgkim126
    Contributor

    @majecty I discussed with @foriequal0
    IMO, the atomic cancle_and_schedule_once works in the same if

    1. the order in the same transaction is guaranteed
    2. it's okay to schedule already scheduled token
    3. 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.

  4. majecty commented on Jan 9, 2019

    @majecty
    Author

    OK, I'll fix it by ignoring AlreadyScheduled error.

  5. added this to the Release Candidate milestone on Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingminer

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions