Skip to content

Paused/resume device API calls can hang for long periods #3001

Closed

Description

@canton7

I've had an issue reported (canton7/SyncTrayzor#252) where calls to /rest/system/resume and /rest/system/pause can sometimes hang (for more than 90 seconds, at which point I time out). It appears to happen unpredictably.

It appears that the device in question is never actually paused/resumed, although I'm not 100% sure of that.

I notice that PauseDevice and ResumeDevice both acquire a lock - maybe something's holding this for an extended period?

Syncthing version v0.12.22, Windows.

Activity

  1. AudriusButkevicius commented on Apr 22, 2016

    @AudriusButkevicius
    Member

    We need to make it crash somehow to figure out whats holding the lock. My money is on Windows firewall blocking socket writes indefinately.

  2. canton7 commented on Apr 22, 2016

    @canton7
    ContributorAuthor

    Tricky... we lost the "monitor" process (SyncTrayor) when that dies, so we won't be able to capture output even if we do get it to crash.

    I can probably code up something to kill Syncthing if it does die, but I'm not sure how to kill it in such a way that it will produce the output you need, working within the constraints of the winapi. Any suggestions?

  3. AudriusButkevicius commented on Apr 22, 2016

    @AudriusButkevicius
    Member

    It prints the stacktraces to stderr/out so I think you can capture them just fine. The bigger problem is making it crash. I know it's sigstop on unix, no idea what it is in windows. Worst case we can add a crash/debug endpoint which returns the stacktraces as json or forces a panic.

  4. canton7 commented on Apr 22, 2016

    @canton7
    ContributorAuthor

    Hmm, I can't seem to find anything helpful online.

  5. canton7 commented on Apr 22, 2016

    @canton7
    ContributorAuthor

    Perfect, thanks 👍

  6. AudriusButkevicius commented on Apr 22, 2016

    @AudriusButkevicius
    Member

    Also, STTRACE=sync (I think) will log lock usage, there is also another var (check help) for defining a threshold what gets logged. Hard to find links on the phone.

  7. scienmind commented on May 1, 2016

    @scienmind
    Contributor

    Ok, I had several of those crashes (canton7/SyncTrayzor#252) appearing randomly. Usually after prolonged usage (i.e. running ST overnight).
    Now, while the full blown crash is quite rare, the same error message appears in the logs far more frequently.

    So, here's SyncTrayzor log with the error, appearing after "wake from sleep":
    https://gist.github.com/anonymous/a2baa96d5f17b65c269f36316493b6ed

    And, as per canton7's request, I've set STPROFILER=localhost:8385, and here's the output of http://localhost:8385/debug/pprof/goroutine?debug=2:
    https://gist.github.com/anonymous/973b8cbf5cfb9f3cad63daa184403b1a

  8. AudriusButkevicius commented on May 1, 2016

    @AudriusButkevicius
    Member

    So the crash you posted now does not look related to the original crash, furthermore, I don't see any reasonable blocking from syncthing. The only lock I can see is on the GetIgnores() due to a scan currently running.

  9. scienmind commented on May 1, 2016

    @scienmind
    Contributor

    OK, I'll post again the "actual" crash then, once I'll catch it

  10. canton7 commented on May 1, 2016

    @canton7
    ContributorAuthor

    That SyncTrayzor log doesn't show a crash, no.

  11. scienmind commented on May 11, 2016

    @scienmind
    Contributor

    I have had SyncTrayzor & Syncthing silently crashing during "wake from sleep", here are the logs:
    SyncTrayzor: https://gist.github.com/anonymous/a52a5158bd4cca9145137fda6092dc2d
    Syncthing: https://gist.github.com/anonymous/7134dbcbadf381ff1e83961fb7056c31

    Unfortunately, /debug/pprof/goroutine?debug=2 can't be polled, since syncthing is dead...

  12. AudriusButkevicius commented on May 11, 2016

    @AudriusButkevicius
    Member

    This is on Synctrayzors plate, not syncthings.

  13. canton7 commented on May 11, 2016

    @canton7
    ContributorAuthor

    Yes, this is a separate issue. Please open a new issue on SyncTrayzor's issue tracker.

  14. added
    bug
    on May 22, 2016
  15. 10 remaining items

  16. calmh commented on Nov 23, 2016

    @calmh
    Member

    Barring deadlocks and stuff (which are bugs that we should fix), the calls blocking until the pause/resume action is taken is by design and not a bug. We may add things to or redesign the API, but this is not the ticket for it.

  17. added a commit that references this issue on Dec 21, 2016
    bab7c8e
  18. calmh commented on Dec 26, 2016

    @calmh
    Member

    How was this addressed by this change?

  19. AudriusButkevicius commented on Dec 26, 2016

    @AudriusButkevicius
    Member

    Device pauses are now handled in CommitConfig which I hope fixes this issue.

  20. calmh commented on Dec 28, 2016

    @calmh
    Member

    I think it doesn't as things still require holding pmut, which is what was blocking above. (I'm not convinced this is a problem necessarily, and we should slowly move away from those locks probably, but it's not my bug report.)

  21. AudriusButkevicius commented on Dec 28, 2016

    @AudriusButkevicius
    Member

    Well if OP can still repro we can reopen.

  22. scienmind commented on Dec 28, 2016

    @scienmind
    Contributor

    I haven't witnessed those crashes for quite a long while. And unfortunately I never got a clear way/steps of reproducing it, it always was kinda random.
    I had few crashes a couple of weeks ago, but timing was bad and I couldn't play with it much, so it may be unrelated to this issue.

    If it'll reappear, I will let you know.

  23. AudriusButkevicius commented on Dec 28, 2016

    @AudriusButkevicius
    Member

    This shouldn't be a crash atleast from syncthing side.

  24. added
    frozen-due-to-age
    on Nov 24, 2017
  25. locked and limited conversation to collaborators on Nov 24, 2017
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

    bugfrozen-due-to-age

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions