Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: runtime error: slice bounds out of range #47

Closed
calmh opened this issue Feb 1, 2014 · 13 comments
Closed

panic: runtime error: slice bounds out of range #47

calmh opened this issue Feb 1, 2014 · 13 comments
Labels
bug A problem with current functionality, as opposed to missing functionality (enhancement) frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion

Comments

@calmh
Copy link
Member

calmh commented Feb 1, 2014

[YUFJO] 2014/02/01 07:33:03 INFO:   2559 files,   1.82 GiB in local repo
[YUFJO] 2014/02/01 07:33:03 INFO:     66 files, 213.06 MiB to synchronize
panic: runtime error: slice bounds out of range

goroutine 34 [running]:
runtime.panic(0x7561e0, 0xc3136a)
        /home/jb/go-sunos/src/pkg/runtime/panic.c:264 +0xb6
github.com/calmh/syncthing/model.(*FileQueue).Get(0xc2100e0280, 0xc21068c540, 0x34, 0x0, 0x0, ...)
        /home/jb/src/github.com/calmh/syncthing/model/filequeue.go:121 +0x48e
github.com/calmh/syncthing/model.func·004()
        /home/jb/src/github.com/calmh/syncthing/model/model.go:511 +0x45f
created by github.com/calmh/syncthing/model.(*Model).AddConnection
        /home/jb/src/github.com/calmh/syncthing/model/model.go:522 +0x266

@calmh
Copy link
Member Author

calmh commented Feb 1, 2014

Shouldn't happen, seems to only happen in the Solaris build. I suspect a runtime bug.

@calmh calmh closed this as completed Feb 1, 2014
@jedie
Copy link
Contributor

jedie commented May 21, 2014

I get also this error on linux:

[BFBR3] 14:13:21 INFO: syncthing v0.8.7 (go1.2.2 linux-386) jb@jborg-mbp 2014-05-16 14:28:52 UTC
[BFBR3] 14:13:21 INFO: My ID: BFBR...
[BFBR3] 14:13:21 INFO: Starting web GUI on http://0.0.0.0:8080/
[BFBR3] 14:13:21 INFO: Populating repository index
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
runtime.panic(0x830b3c0, 0x8775faa)
    /usr/local/go/src/pkg/runtime/panic.c:266 +0xac
github.com/calmh/syncthing/xdr.(*Reader).ReadBytesMaxInto(0x18a96de0, 0x40, 0x0, 0x0, 0x0, ...)
    /Users/jb/src/github.com/calmh/syncthing/xdr/reader.go:58 +0x22b
github.com/calmh/syncthing/xdr.(*Reader).ReadBytesMax(0x18a96de0, 0x40, 0x1b315a00, 0x20, 0x20)
    /Users/jb/src/github.com/calmh/syncthing/xdr/reader.go:36 +0x3c
github.com/calmh/syncthing/protocol.(*BlockInfo).decodeXDR(0x1b314ba0, 0x18a96de0, 0x0, 0x0)
    /Users/jb/src/github.com/calmh/syncthing/protocol/message_xdr.go:152 +0x49
github.com/calmh/syncthing/protocol.(*FileInfo).decodeXDR(0x18d4f808, 0x18a96de0, 0x0, 0x0)
    /Users/jb/src/github.com/calmh/syncthing/protocol/message_xdr.go:113 +0x137
github.com/calmh/syncthing/protocol.(*IndexMessage).decodeXDR(0xb7621ac0, 0x18a96de0, 0xc, 0x18a3182c)
    /Users/jb/src/github.com/calmh/syncthing/protocol/message_xdr.go:56 +0xe4
github.com/calmh/syncthing/protocol.(*IndexMessage).DecodeXDR(0xb7621ac0, 0xb770cbb8, 0x18bc9780, 0x0, 0x0)
    /Users/jb/src/github.com/calmh/syncthing/protocol/message_xdr.go:39 +0x6c
github.com/calmh/syncthing/model.(*Model).loadIndex(0x18b23990, 0x18a00698, 0x4, 0x18a1ba80, 0x21, ...)
    /Users/jb/src/github.com/calmh/syncthing/model/model.go:687 +0x2e4
github.com/calmh/syncthing/model.(*Model).LoadIndexes(0x18b23990, 0x18a1ba80, 0x21)
    /Users/jb/src/github.com/calmh/syncthing/model/model.go:641 +0xa6
main.main()
    /Users/jb/src/github.com/calmh/syncthing/cmd/syncthing/main.go:288 +0x11c6

Some info:

3.8.0-35-generic #50-Ubuntu SMP Tue Dec 3 01:25:33 UTC 2013 i686 athlon i686 GNU/Linux

$ ./syncthing --version
syncthing v0.8.7 (go1.2.2 linux-386) jb@jborg-mbp 2014-05-16 14:28:52 UTC

@calmh
Copy link
Member Author

calmh commented May 21, 2014

Fascinating! Doing what/when does it happen?

@calmh calmh added bug and removed wontfix labels May 21, 2014
@calmh calmh reopened this May 21, 2014
@calmh
Copy link
Member Author

calmh commented May 21, 2014

(Not the same issue/backtrace as the original, but we might as well reuse the issue)

@calmh
Copy link
Member Author

calmh commented May 21, 2014

Looks like at startup, when reading the index cache. So is it 100% reproducible? If so, it would be great if I could get that index cache file. It will contain the file names, metadata and hashes for all files in the repository so if that's data you'd rather not have me see I fully respect that. If you have multiple repositories, you can find the guilty one using this utility: https://nym.se/t/stpidx

Run it as stpidx ~/.config/syncthing/....idx.gz for each .idx.gz file and it should either print the contents of the index or crash with the same symptoms as above.

@jedie
Copy link
Contributor

jedie commented May 21, 2014

Oh, sorry... to late... I have done this: rm .config/syncthing/*.idx.gz ;)

It was 100% reproducible. After deleting the index it works... But maybe it will fail over the same files, because the repro files/config i haven't touch. So it should index the same...

@calmh
Copy link
Member Author

calmh commented May 21, 2014

Argh. :) If it does happen again, please save the files for posterity.

@calmh calmh closed this as completed May 21, 2014
@DinizCabreira
Copy link

I believe I have come across this, or a similar bug:

[BFHOS] 17:01:05 INFO: syncthing v0.10.29 (go1.4.2 linux-386 default) unknown-user@syncthing-builder 2015-03-22 14:09:14 UTC
[BFHOS] 17:01:05 INFO: My ID: BFHOS3U-LWKIQ5P-2S44XWQ-PBSJSL3-O7YUAW2-NMM2NEV-JGFPOO3-F64ABQQ
[BFHOS] 17:01:06 INFO: Starting web GUI on http://127.0.0.1:8080/
[BFHOS] 17:01:08 INFO: Starting UPnP discovery...
[BFHOS] 17:01:11 INFO: Invalid IGD response: invalid device UUID bc4b25d-4a71-371d-bd98-038eb5924b23 (continuing anyway)
[BFHOS] 17:01:11 INFO: Invalid IGD response: invalid device UUID bc4b25d-4a71-371d-bd98-038eb5924b23 (continuing anyway)
[BFHOS] 17:01:11 INFO: Invalid IGD response: invalid device UUID bc4b25d-4a71-371d-bd98-038eb5924b23 (continuing anyway)
[BFHOS] 17:01:14 INFO: UPnP discovery complete (found 3 devices).
[BFHOS] 17:01:14 INFO: Created UPnP port mapping for external port 63512 on UPnP device 'equipo_wifimedia_R' (192.168.1.1).
[BFHOS] 17:01:14 INFO: Starting local discovery announcements
[BFHOS] 17:01:14 INFO: Starting global discovery announcements
[BFHOS] 17:01:14 OK: Ready to synchronize Musica (read-write)
[BFHOS] 17:01:14 OK: Ready to synchronize SacauntosDenis (read-write)
[BFHOS] 17:01:14 OK: Ready to synchronize SyncDenis (read-write)
[BFHOS] 17:01:14 INFO: Device BFHOS3U-LWKIQ5P-2S44XWQ-PBSJSL3-O7YUAW2-NMM2NEV-JGFPOO3-F64ABQQ is "SacauntosDenis" at [dynamic]
[BFHOS] 17:01:14 INFO: Device UARDV55-OJWEADP-OKZMKPI-ZITDZQV-D4Z6KKA-ZCHGR7F-U5R5OOL-I4Q32AT is "spektr" at [dynamic]
[BFHOS] 17:01:14 INFO: Starting usage reporting
[BFHOS] 17:01:14 INFO: Completed initial scan (rw) of folder Musica
[BFHOS] 17:01:14 INFO: Completed initial scan (rw) of folder SacauntosDenis
[BFHOS] 17:01:29 INFO: Established secure connection to UARDV55-OJWEADP-OKZMKPI-ZITDZQV-D4Z6KKA-ZCHGR7F-U5R5OOL-I4Q32AT at 192.168.1.2:22000-192.168.1.207:36246
[BFHOS] 17:01:29 INFO: Connection to UARDV55-OJWEADP-OKZMKPI-ZITDZQV-D4Z6KKA-ZCHGR7F-U5R5OOL-I4Q32AT closed: EOF
[BFHOS] 17:01:45 INFO: Established secure connection to UARDV55-OJWEADP-OKZMKPI-ZITDZQV-D4Z6KKA-ZCHGR7F-U5R5OOL-I4Q32AT at [fe80::92e6:baff:fec4:c6a%eth0]:41166-[fe80::5a94:6bff:feaa:c038%eth0]:22000
panic: runtime error: slice bounds out of range

goroutine 222 [running]:
github.com/calmh/xdr.(*Reader).ReadBytesMaxInto(0x1a721380, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)

@AudriusButkevicius
Copy link
Member

Your's is most likely two incompatible versions connecting. Check that all devices are either on 0.10 or 0.11.

@DinizCabreira
Copy link

Indeed, that was the case. Thank you! :)

Shouldn't Syncthing detect incompatible versions and ignore them, perhaps after spawning a warning, but keep working with other peers that have compatible ones, rather than crashing?

@AudriusButkevicius
Copy link
Member

It warns you when you upgrade.
If the protocol is incompatible, we might not even be able to read the version.

@calmh
Copy link
Member Author

calmh commented Apr 28, 2015

Holy issue necromancy, batman! :)

@calmh
Copy link
Member Author

calmh commented Apr 28, 2015

The actual crash is fixed though, in v0.11.

plouj pushed a commit to plouj/syncthing that referenced this issue Jan 29, 2016
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Jun 17, 2017
@syncthing syncthing locked and limited conversation to collaborators Jun 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug A problem with current functionality, as opposed to missing functionality (enhancement) frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion
Projects
None yet
Development

No branches or pull requests

5 participants