Skip to content

Many deadlocks since 0.8.16 #389

Closed
Closed

Description

@alex2108

On 0.8.16 i have many deadlocks when starting syncthing directy after startup of my pc. Could it be that it is detected even if there is no real deadlock because it needs very long to start?

System is Ubuntu 12.04 32bit with a pretty slow CPU. And i also just had it on my Raspberry Pi when i started syncthing while stressing the CPU intentional with something else.

Here is the log of one of the crashes on the Ubuntu 32bit machine (if needed i can upload more):

[BEIYA] 07:19:29 INFO: syncthing v0.8.16 (go1.3 linux-386 default) jb@jborg-mbp 2014-06-22 16:18:21 UTC
[BEIYA] 07:19:29 INFO: My ID: BEIYAY27R5FVSBNA4VF2Z5LG7YFP2NJ4SRYDDZKKCECW6DILW7NQ
[BEIYA] 07:19:29 INFO: Starting web GUI on http://127.0.0.1:8080/
[BEIYA] 07:19:30 INFO: Populating repository index
panic: deadlock detected

goroutine 24 [running]:
runtime.panic(0x8322700, 0x1880e338)
    /usr/local/go/src/pkg/runtime/panic.c:279 +0xe9
github.com/calmh/syncthing/model.func·011()
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:114 +0x15d
created by github.com/calmh/syncthing/model.deadlockDetect
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:117 +0x8c

goroutine 16 [semacquire, 1 minutes]:
sync.runtime_Semacquire(0x1897819c)
    /usr/local/go/src/pkg/runtime/sema.goc:199 +0x37
sync.(*RWMutex).RLock(0x18978190)
    /usr/local/go/src/pkg/sync/rwmutex.go:36 +0x5f
github.com/calmh/syncthing/model.(*Model).SeedLocal(0x18978160, 0x188ea6b8, 0x6, 0x18a26000, 0x13a8, 0x13a8)
    /Users/jb/src/github.com/calmh/syncthing/model/model.go:462 +0x15c
github.com/calmh/syncthing/model.(*Model).LoadIndexes(0x18978160, 0x18800be0, 0x1c)
    /Users/jb/src/github.com/calmh/syncthing/model/model.go:736 +0xf2
main.main()
    /Users/jb/src/github.com/calmh/syncthing/cmd/syncthing/main.go:346 +0x12c5

goroutine 19 [finalizer wait, 1 minutes]:
runtime.park(0x806d420, 0x8665774, 0x8664309)
    /usr/local/go/src/pkg/runtime/proc.c:1369 +0x94
runtime.parkunlock(0x8665774, 0x8664309)
    /usr/local/go/src/pkg/runtime/proc.c:1385 +0x3f
runfinq()
    /usr/local/go/src/pkg/runtime/mgc0.c:2644 +0xc5
runtime.goexit()
    /usr/local/go/src/pkg/runtime/proc.c:1445

goroutine 21 [chan receive]:
main.trackCPUUsage()
    /Users/jb/src/github.com/calmh/syncthing/cmd/syncthing/gui_unix.go:22 +0x101
created by main.init·2
    /Users/jb/src/github.com/calmh/syncthing/cmd/syncthing/gui_unix.go:15 +0x28

goroutine 23 [chan receive, 1 minutes]:
main.saveConfigLoop(0x188d74a0, 0x27)
    /Users/jb/src/github.com/calmh/syncthing/cmd/syncthing/main.go:539 +0x58
created by main.main
    /Users/jb/src/github.com/calmh/syncthing/cmd/syncthing/main.go:193 +0xaa5

goroutine 25 [sleep]:
time.Sleep(0x7e11d600, 0x3)
    /usr/local/go/src/pkg/runtime/time.goc:39 +0x3f
github.com/calmh/syncthing/model.func·011()
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:99 +0x5a
created by github.com/calmh/syncthing/model.deadlockDetect
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:117 +0x8c

goroutine 26 [chan receive]:
github.com/calmh/syncthing/model.func·011()
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:113 +0x113
created by github.com/calmh/syncthing/model.deadlockDetect
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:117 +0x8c

goroutine 27 [semacquire]:
sync.runtime_Semacquire(0x1897819c)
    /usr/local/go/src/pkg/runtime/sema.goc:199 +0x37
sync.(*RWMutex).RLock(0x18978190)
    /usr/local/go/src/pkg/sync/rwmutex.go:36 +0x5f
github.com/calmh/syncthing/model.(*Model).broadcastIndexLoop(0x18978160)
    /Users/jb/src/github.com/calmh/syncthing/model/model.go:585 +0xb6
created by github.com/calmh/syncthing/model.NewModel
    /Users/jb/src/github.com/calmh/syncthing/model/model.go:103 +0x3d2

goroutine 28 [IO wait, 1 minutes]:
net.runtime_pollWait(0xb7717240, 0x72, 0x0)
    /usr/local/go/src/pkg/runtime/netpoll.goc:146 +0x62
net.(*pollDesc).Wait(0x188ed478, 0x72, 0x0, 0x0)
    /usr/local/go/src/pkg/net/fd_poll_runtime.go:84 +0x48
net.(*pollDesc).WaitRead(0x188ed478, 0x0, 0x0)
    /usr/local/go/src/pkg/net/fd_poll_runtime.go:89 +0x46
net.(*netFD).accept(0x188ed440, 0x84a2f38, 0x0, 0xb7715230, 0xb)
    /usr/local/go/src/pkg/net/fd_unix.go:409 +0x2f3
net.(*TCPListener).AcceptTCP(0x1880e600, 0x4, 0x0, 0x0)
    /usr/local/go/src/pkg/net/tcpsock_posix.go:234 +0x57
net.(*TCPListener).Accept(0x1880e600, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/pkg/net/tcpsock_posix.go:244 +0x4e
net/http.(*Server).Serve(0x1897c000, 0xb7716288, 0x1880e600, 0x0, 0x0)
    /usr/local/go/src/pkg/net/http/server.go:1698 +0x94
net/http.Serve(0xb7716288, 0x1880e600, 0xb77173b8, 0x1883c5e0, 0x0, 0x0)
    /usr/local/go/src/pkg/net/http/server.go:1576 +0x76
created by main.startGUI
    /Users/jb/src/github.com/calmh/syncthing/cmd/syncthing/gui.go:128 +0x1425

goroutine 32 [IO wait, 1 minutes]:
net.runtime_pollWait(0xb77171d0, 0x72, 0x0)
    /usr/local/go/src/pkg/runtime/netpoll.goc:146 +0x62
net.(*pollDesc).Wait(0x188d4038, 0x72, 0x0, 0x0)
    /usr/local/go/src/pkg/net/fd_poll_runtime.go:84 +0x48
net.(*pollDesc).WaitRead(0x188d4038, 0x0, 0x0)
    /usr/local/go/src/pkg/net/fd_poll_runtime.go:89 +0x46
net.(*netFD).Read(0x188d4000, 0x18817000, 0x1000, 0x1000, 0x0, 0xb7715230, 0xb)
    /usr/local/go/src/pkg/net/fd_unix.go:232 +0x28d
net.(*conn).Read(0x188d0018, 0x18817000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    /usr/local/go/src/pkg/net/net.go:122 +0xc6
net/http.(*liveSwitchReader).Read(0x1883a384, 0x18817000, 0x1000, 0x1000, 0xa, 0x0, 0x0)
    /usr/local/go/src/pkg/net/http/server.go:206 +0x91
io.(*LimitedReader).Read(0x188ea090, 0x18817000, 0x1000, 0x1000, 0x83da348, 0x0, 0x0)
    /usr/local/go/src/pkg/io/io.go:399 +0xd8
bufio.(*Reader).fill(0x189a0030)
    /usr/local/go/src/pkg/bufio/bufio.go:97 +0x14c
bufio.(*Reader).ReadSlice(0x189a0030, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/pkg/bufio/bufio.go:298 +0x1b7
bufio.(*Reader).ReadLine(0x189a0030, 0x0, 0x0, 0x0, 0x188d4000, 0x0, 0x0)
    /usr/local/go/src/pkg/bufio/bufio.go:326 +0x60
net/textproto.(*Reader).readLineSlice(0x18aadd00, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/pkg/net/textproto/reader.go:55 +0x7c
net/textproto.(*Reader).ReadLine(0x18aadd00, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/pkg/net/textproto/reader.go:36 +0x4e
net/http.ReadRequest(0x189a0030, 0x18970690, 0x0, 0x0)
    /usr/local/go/src/pkg/net/http/request.go:556 +0xb5
net/http.(*conn).readRequest(0x1883a370, 0x0, 0x0, 0x0)
    /usr/local/go/src/pkg/net/http/server.go:577 +0x218
net/http.(*conn).serve(0x1883a370)
    /usr/local/go/src/pkg/net/http/server.go:1132 +0x516
created by net/http.(*Server).Serve
    /usr/local/go/src/pkg/net/http/server.go:1721 +0x2be

goroutine 33 [semacquire, 1 minutes]:
sync.runtime_Semacquire(0x18978198)
    /usr/local/go/src/pkg/runtime/sema.goc:199 +0x37
sync.(*RWMutex).Lock(0x18978190)
    /usr/local/go/src/pkg/sync/rwmutex.go:83 +0x9d
github.com/calmh/syncthing/model.(*Model).Version(0x18978160, 0x189a1065, 0x7, 0xb74e4204, 0x4)
    /Users/jb/src/github.com/calmh/syncthing/model/model.go:886 +0x4c
main.restGetModel(0x18978160, 0xb7717690, 0x18ac8440, 0x18970700)
    /Users/jb/src/github.com/calmh/syncthing/cmd/syncthing/gui.go:183 +0x8d7
reflect.Value.call(0x83577c0, 0x84a2e5c, 0x0, 0x130, 0x83d7228, 0x4, 0x189a15f0, 0x3, 0x3, 0x0, ...)
    /usr/local/go/src/pkg/reflect/value.go:563 +0xdaf
reflect.Value.Call(0x83577c0, 0x84a2e5c, 0x0, 0x130, 0x189a15f0, 0x3, 0x3, 0x0, 0x0, 0x0)
    /usr/local/go/src/pkg/reflect/value.go:411 +0x91
github.com/codegangsta/inject.(*injector).Invoke(0x188ea540, 0x83577c0, 0x84a2e5c, 0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/jb/src/github.com/calmh/syncthing/Godeps/_workspace/src/github.com/codegangsta/inject/inject.go:102 +0x2d5
github.com/codegangsta/martini.(*context).Invoke(0x189a1350, 0x83577c0, 0x84a2e5c, 0x0, 0x0, 0x0, 0x0, 0x0)
    <autogenerated>:29 +0x7c
github.com/codegangsta/martini.(*routeContext).run(0x18ac8500)
    /Users/jb/src/github.com/calmh/syncthing/Godeps/_workspace/src/github.com/codegangsta/martini/router.go:314 +0x7a
github.com/codegangsta/martini.(*route).Handle(0x188d6ea0, 0xb77176b0, 0x189a1350, 0xb7717690, 0x18ac8440)
    /Users/jb/src/github.com/calmh/syncthing/Godeps/_workspace/src/github.com/codegangsta/martini/router.go:217 +0xa1
github.com/codegangsta/martini.(*router).Handle(0x188d6ae0, 0xb7717690, 0x18ac8440, 0x18970700, 0xb77176b0, 0x189a1350)
    /Users/jb/src/github.com/calmh/syncthing/Godeps/_workspace/src/github.com/codegangsta/martini/router.go:112 +0x124
github.com/codegangsta/martini.Router.Handle·fm(0xb7717690, 0x18ac8440, 0x18970700, 0xb77176b0, 0x189a1350)
    /Users/jb/src/github.com/calmh/syncthing/cmd/syncthing/gui.go:122 +0x62
reflect.Value.call(0x83674e0, 0x18974960, 0x0, 0x130, 0x83d7228, 0x4, 0x189a1530, 0x3, 0x3, 0x0, ...)
    /usr/local/go/src/pkg/reflect/value.go:563 +0xdaf
reflect.Value.Call(0x83674e0, 0x18974960, 0x0, 0x130, 0x189a1530, 0x3, 0x3, 0x0, 0x0, 0x0)
    /usr/local/go/src/pkg/reflect/value.go:411 +0x91
github.com/codegangsta/inject.(*injector).Invoke(0x188ea540, 0x83674e0, 0x18974960, 0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/jb/src/github.com/calmh/syncthing/Godeps/_workspace/src/github.com/codegangsta/inject/inject.go:102 +0x2d5
github.com/codegangsta/martini.(*context).run(0x189a1350)
    /Users/jb/src/github.com/calmh/syncthing/Godeps/_workspace/src/github.com/codegangsta/martini/martini.go:163 +0x76
github.com/codegangsta/martini.(*context).Next(0x189a1350)
    /Users/jb/src/github.com/calmh/syncthing/Godeps/_workspace/src/github.com/codegangsta/martini/martini.go:154 +0x35
github.com/codegangsta/martini.func·004(0xb77176b0, 0x189a1350, 0x1881b7a0)
    /Users/jb/src/github.com/calmh/syncthing/Godeps/_workspace/src/github.com/codegangsta/martini/recovery.go:140 +0x63
reflect.Value.call(0x83474a0, 0x84a2d48, 0x0, 0x130, 0x83d7228, 0x4, 0x18ac8480, 0x2, 0x2, 0x0, ...)
    /usr/local/go/src/pkg/reflect/value.go:563 +0xdaf
reflect.Value.Call(0x83474a0, 0x84a2d48, 0x0, 0x130, 0x18ac8480, 0x2, 0x2, 0x0, 0x0, 0x0)
    /usr/local/go/src/pkg/reflect/value.go:411 +0x91
github.com/codegangsta/inject.(*injector).Invoke(0x188ea540, 0x83474a0, 0x84a2d48, 0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/jb/src/github.com/calmh/syncthing/Godeps/_workspace/src/github.com/codegangsta/inject/inject.go:102 +0x2d5
github.com/codegangsta/martini.(*context).run(0x189a1350)
    /Users/jb/src/github.com/calmh/syncthing/Godeps/_workspace/src/github.com/codegangsta/martini/martini.go:163 +0x76
github.com/codegangsta/martini.(*Martini).ServeHTTP(0x1883c5e0, 0xb7717608, 0x18970770, 0x18970700)
    /Users/jb/src/github.com/calmh/syncthing/Godeps/_workspace/src/github.com/codegangsta/martini/martini.go:69 +0x52
net/http.serverHandler.ServeHTTP(0x1897c000, 0xb7717608, 0x18970770, 0x18970700)
    /usr/local/go/src/pkg/net/http/server.go:1673 +0x155
net/http.(*conn).serve(0x1883b450)
    /usr/local/go/src/pkg/net/http/server.go:1174 +0x8c6
created by net/http.(*Server).Serve
    /usr/local/go/src/pkg/net/http/server.go:1721 +0x2be

goroutine 34 [semacquire]:
sync.runtime_Semacquire(0x18978194)
    /usr/local/go/src/pkg/runtime/sema.goc:199 +0x37
sync.(*Mutex).Lock(0x18978190)
    /usr/local/go/src/pkg/sync/mutex.go:66 +0xd1
sync.(*RWMutex).Lock(0x18978190)
    /usr/local/go/src/pkg/sync/rwmutex.go:78 +0x38
github.com/calmh/syncthing/model.func·009()
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:103 +0x42
created by github.com/calmh/syncthing/model.func·011
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:106 +0xc0

goroutine 37 [runnable]:
time.Sleep(0xf8475800, 0xd)
    /usr/local/go/src/pkg/runtime/time.goc:39 +0x3f
github.com/calmh/syncthing/model.func·010()
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:109 +0x3c
created by github.com/calmh/syncthing/model.func·011
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:111 +0xee

goroutine 29 [semacquire]:
sync.runtime_Semacquire(0x189781dc)
    /usr/local/go/src/pkg/runtime/sema.goc:199 +0x37
sync.(*RWMutex).Lock(0x189781d4)
    /usr/local/go/src/pkg/sync/rwmutex.go:83 +0x9d
github.com/calmh/syncthing/model.func·009()
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:103 +0x42
created by github.com/calmh/syncthing/model.func·011
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:106 +0xc0

goroutine 30 [runnable]:
time.Sleep(0xf8475800, 0xd)
    /usr/local/go/src/pkg/runtime/time.goc:39 +0x3f
github.com/calmh/syncthing/model.func·010()
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:109 +0x3c
created by github.com/calmh/syncthing/model.func·011
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:111 +0xee

goroutine 48 [sleep]:
time.Sleep(0xf8475800, 0xd)
    /usr/local/go/src/pkg/runtime/time.goc:39 +0x3f
github.com/calmh/syncthing/model.func·010()
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:109 +0x3c
created by github.com/calmh/syncthing/model.func·011
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:111 +0xee

goroutine 39 [sleep]:
time.Sleep(0xf8475800, 0xd)
    /usr/local/go/src/pkg/runtime/time.goc:39 +0x3f
github.com/calmh/syncthing/model.func·010()
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:109 +0x3c
created by github.com/calmh/syncthing/model.func·011
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:111 +0xee

goroutine 50 [sleep]:
time.Sleep(0xf8475800, 0xd)
    /usr/local/go/src/pkg/runtime/time.goc:39 +0x3f
github.com/calmh/syncthing/model.func·010()
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:109 +0x3c
created by github.com/calmh/syncthing/model.func·011
    /Users/jb/src/github.com/calmh/syncthing/model/util.go:111 +0xee

Activity

  1. seidler2547 commented on Jun 24, 2014

    @seidler2547

    Same for me. Had to go back to 0.8.15 because on my Allwinner A20 ARM box syncthing will not start up anymore. Any time based deadlock-detection is bound to produce false positives.

  2. tintamarre commented on Jun 24, 2014

    @tintamarre

    Same here on Linux 32bits. I reverted to 0.8.15. I can provide log if
    needed.

    On Tue, Jun 24, 2014 at 11:07 AM, seidler2547 [email protected]
    wrote:

    Same for me. Had to go back to 0.8.15 because on my Allwinner A20 ARM box
    syncthing will not start up anymore. Any time based deadlock-detection is
    bound to produce false positives.

    Reply to this email directly or view it on GitHub
    https://github.com/calmh/syncthing/issues/389#issuecomment-46948217.

  3. added a commit that references this issue on Jun 26, 2014
    a2da310
  4. calmh commented on Jun 26, 2014

    @calmh
    Member

    Yeah, sorry about that, the timeout was bad. Increased to 20 minutes, which should be enough, and I'm interested in the backtrace if it isn't. If I'm still wrong, it can be disabled with something like STDEADLOCKTIMEOUT=100000 syncthing.

  5. alex2108 commented on Jun 27, 2014

    @alex2108
    ContributorAuthor

    i still had a deadlock today with a pretty fast pc, for over 20min nothing happened with no high CPU usage and then the deadlock detection killed it. This is the first time i remember seeing this (except on v0.8.16)

    since the log is 1603 lines i uploaded it to dropbox: https://dl.dropboxusercontent.com/u/4210971/crash.txt

    should i try to reproduce this with some STTRACE set? if yes, what should i acitvate?

    another thing that has not directly to do anything with the crash: the line "panic: deadlock detected" should probably also get a timestamp to see how long nothing happened before the crash.

    edit: another thing i noticed, like described in the other issue (https://github.com/calmh/syncthing/issues/393) repo status is unknown during the whole time and the tray indicator i'm developing (not released yet) does not show anything (sadly i have no debug log active for it, but i think the rest interface does not send a response).
    On normal startup during "Populating repository index" it shows that the repos are idle (gui and my tray).

    edit2: seems to be more or less reproduceable by rebooting again and again...
    when testing with curl the rest interface for connections and model nothing is received and curl just hangs waiting, discovery sends a html document with title "PANIC: runtime error: invalid memory address or nil pointer dereference" (https://dl.dropboxusercontent.com/u/4210971/discovery.html), others seem to send correct data

  6. calmh commented on Jun 29, 2014

    @calmh
    Member

    Fixed in .17

  7. added a commit that references this issue on Jun 29, 2014
    d7cc48e
  8. alex2108 commented on Jun 30, 2014

    @alex2108
    ContributorAuthor

    i probably should have mentioned on the previous post, and not only in the log i uploaded, that i already updated to .17 and it still crashed, sry that this was not really clear there. During the weekend i saw this pretty ofte, so there seems to be a bug that causes many of those deadlocks in the recent versions. Since the CPU is at 0% after some time i assume that increasing the timeout will not be useful, it also starts up after ~2min when there is deadlock.

  9. changed the title [-]Many deadlocks on 0.8.16[/-] [+]Many deadlocks since 0.8.16[/+] on Jun 30, 2014
  10. tintamarre commented on Jun 30, 2014

    @tintamarre

    It's also still happening here.

  11. added a commit that references this issue on Jun 30, 2014
    2a4fcb5
  12. calmh commented on Jul 1, 2014

    @calmh
    Member

    No, the deadlock was there before, it's just that it went unseen. Now it causes the crash, which gives me debug data so I can fix it. Thanks.

  13. added a commit that references this issue on Jul 2, 2014
    0aa067a
  14. alex2108 commented on Jul 2, 2014

    @alex2108
    ContributorAuthor

    tried several reboots and it did not happen once with this fixed version. Since i had this pretty often before i assume it is fixed, thx :)
    if it happens again i will report.

  15. added 2 commits that reference this issue on Jul 4, 2014
    3c4002e
    9d23f6c
  16. tintamarre commented on Jul 6, 2014

    @tintamarre

    Same here. No more deadlocks. Thx !

  17. added
    frozen-due-to-age
    on Jun 17, 2017
  18. locked and limited conversation to collaborators on Jun 17, 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

    frozen-due-to-age

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions