-
Notifications
You must be signed in to change notification settings - Fork 51
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
enry core #137
Comments
Hi, panic: runtime error: slice bounds out of range
goroutine 17 [running, locked to thread]:
bytes.Count(0x7f3b3042b4b0, 0x54, 0x0, 0x1c42005cc20, 0x1, 0x20, 0x0)
/home/travis/.gimme/versions/go1.8.linux.amd64/src/bytes/bytes.go:62 +0x21d
gopkg.in/src-d/enry%2ev1.getHeaderAndFooter(0x7f3b3042b4b0, 0x54, 0x0, 0x1c42005cca8, 0x7f3dde378707, 0x7f3dec5c09b0)
/home/travis/gopath/src/gopkg.in/src-d/enry.v1/common.go:166 +0xae
gopkg.in/src-d/enry%2ev1.GetLanguagesByModeline(0x7f3b3042e210, 0x2, 0x7f3b3042b4b0, 0x54, 0x0, 0x7f3ddeff8c08, 0x0, 0x0, 0x1c42004e000, 0x7f3dde524aae, ...)
/home/travis/gopath/src/gopkg.in/src-d/enry.v1/common.go:142 +0x5c
gopkg.in/src-d/enry%2ev1.GetLanguages(0x7f3b3042e210, 0x2, 0x7f3b3042b4b0, 0x54, 0x0, 0x7f3dde524aae, 0xc, 0x1c42001cde0)
/home/travis/gopath/src/gopkg.in/src-d/enry.v1/common.go:126 +0x129
gopkg.in/src-d/enry%2ev1.GetLanguage(0x7f3b3042e210, 0x2, 0x7f3b3042b4b0, 0x54, 0x0, 0x1c42005ce48, 0x1c420018500)
/home/travis/gopath/src/gopkg.in/src-d/enry.v1/common.go:38 +0x55
main.GetLanguage(0x7f3b3042e210, 0x2, 0x7f3b3042b4b0, 0x54, 0x0, 0x1c420078098, 0x1c4200007e0)
/home/travis/build/src-d/enry/shared/enry.go:11 +0x55
main._cgoexpwrap_f7db11756761_GetLanguage(0x7f3b3042e210, 0x2, 0x7f3b3042b4b0, 0x54, 0x0, 0x0, 0x0)
command-line-arguments/_obj/_cgo_gotypes.go:58 +0x9a
panic: runtime error: slice bounds out of range
goroutine 50 [running, locked to thread]:
bytes.Count(0x7f3b280742c0, 0x5b, 0x0, 0x1c42005bc20, 0x1, 0x20, 0x0)
/home/travis/.gimme/versions/go1.8.linux.amd64/src/bytes/bytes.go:62 +0x21d
gopkg.in/src-d/enry%2ev1.getHeaderAndFooter(0x7f3b280742c0, 0x5b, 0x0, 0x1c42005bca8, 0x7f3dde378707, 0x7f3dec4b00c0)
/home/travis/gopath/src/gopkg.in/src-d/enry.v1/common.go:166 +0xae
gopkg.in/src-d/enry%2ev1.GetLanguagesByModeline(0x7f3b28074280, 0x2, 0x7f3b280742c0, 0x5b, 0x0, 0x7f3ddeff8c08, 0x0, 0x0, 0x1c4204c2400, 0x7f3dde524aae, ...)
/home/travis/gopath/src/gopkg.in/src-d/enry.v1/common.go:142 +0x5c
gopkg.in/src-d/enry%2ev1.GetLanguages(0x7f3b28074280, 0x2, 0x7f3b280742c0, 0x5b, 0x0, 0x7f3dde524aae, 0xc, 0x1c4200240e0)
/home/travis/gopath/src/gopkg.in/src-d/enry.v1/common.go:126 +0x129
gopkg.in/src-d/enry%2ev1.GetLanguage(0x7f3b28074280, 0x2, 0x7f3b280742c0, 0x5b, 0x0, 0x1c42005be48, 0x1c4200c8040)
/home/travis/gopath/src/gopkg.in/src-d/enry.v1/common.go:38 +0x55
main.GetLanguage(0x7f3b28074280, 0x2, 0x7f3b280742c0, 0x5b, 0x0, 0x1c42085c048, 0x1c4204c47e0)
/home/travis/build/src-d/enry/shared/enry.go:11 +0x55
main._cgoexpwrap_f7db11756761_GetLanguage(0x7f3b28074280, 0x2, 0x7f3b280742c0, 0x5b, 0x0, 0x0, 0x0)
command-line-arguments/_obj/_cgo_gotypes.go:58 +0x9a
panic: runtime error: slice bounds out of range
goroutine 52 [running, locked to thread]:
bytes.Count(0x7f3b40044790, 0x43, 0x20, 0x1c42083fc20, 0x1, 0x20, 0x0)
/home/travis/.gimme/versions/go1.8.linux.amd64/src/bytes/bytes.go:62 +0x21d
gopkg.in/src-d/enry%2ev1.getHeaderAndFooter(0x7f3b40044790, 0x43, 0x20, 0x66, 0x6, 0x7f3dec6a7c90)
/home/travis/gopath/src/gopkg.in/src-d/enry.v1/common.go:166 +0xae
gopkg.in/src-d/enry%2ev1.GetLanguagesByModeline(0x7f3b4005ab40, 0x0, 0x7f3b40044790, 0x43, 0x20, 0x7f3ddeff8c08, 0x0, 0x0, 0x0, 0x0, ...)
/home/travis/gopath/src/gopkg.in/src-d/enry.v1/common.go:142 +0x5c
gopkg.in/src-d/enry%2ev1.GetLanguages(0x7f3b4005ab40, 0x0, 0x7f3b40044790, 0x43, 0x20, 0x7f3dde524aae, 0xc, 0x1c42001e0e0)
/home/travis/gopath/src/gopkg.in/src-d/enry.v1/common.go:126 +0x129
gopkg.in/src-d/enry%2ev1.GetLanguage(0x7f3b4005ab40, 0x0, 0x7f3b40044790, 0x43, 0x20, 0x1c42083fe48, 0x1c4200c6040)
/home/travis/gopath/src/gopkg.in/src-d/enry.v1/common.go:38 +0x55
main.GetLanguage(0x7f3b4005ab40, 0x0, 0x7f3b40044790, 0x43, 0x20, 0x1c420148098, 0x1c4204aa7e0)
/home/travis/build/src-d/enry/shared/enry.go:11 +0x55
main._cgoexpwrap_f7db11756761_GetLanguage(0x7f3b4005ab40, 0x0, 0x7f3b40044790, 0x43, 0x20, 0x0, 0x0)
command-line-arguments/_obj/_cgo_gotypes.go:58 +0x9a |
Hi @liuzhiwei, @EgorBu, thanks for reporting. |
I'm not sure if I can (easily or not) extract this information from |
I don't think it's possible to log a crash from |
@abeaumont If we used enry as a Go library, we would wrap it with For sure this |
Similar with @EgorBu and @vmarkovtsev . My Application has many thread and run many hours with Enry and then core happened. So I'm really hard to find out which file causing the core. As @vmarkovtsev said, it will be good if there is a recover API. |
Second that - we might want to have an option on API side to enable "recover mode" for each individual call to enry, as that would imply having additional go-routine through I also find this article https://blog.golang.org/defer-panic-and-recover very nice in explanation how to use built-in |
I think that extending the API for this purpose is overkill but will consider it if we're unable to solve it in a simpler way. |
@abeaumont we are not able to give a proper input because we are not able to handle the panic. Again: |
Reviewing the code I'm pretty sure that it's not an Apart from trying to debug and fix this error, I will convert the P.D. Discussing whether Spark itself crashes or not and what people knows about that is irrelevant to this bug, so please keep ontopic. |
That's awesome news @abeaumont thanks! |
@abeaumont Running a simple code with engine by chance I stumbled upon this panic with just a set of three siva files, but the error is kind of random because I couldn't reproduce it again. If you consider it helpful, I can provide you with those three siva files and the short code that raised the random panic that time. |
@mcarmonaa that would be great indeed. The behavior you've seen matches with my suspicions, so it'd be great if I can validate them. |
@abeaumont these are the steps to run the code, you must have spark downloaded, check out here for a quickstart guide. Then run a spark-shell as follows: $SPARK_HOME/bin/spark-shell --packages "tech.sourced:engine:0.3.4" And run this code, you can type import tech.sourced.engine._
val engine = Engine(spark, "/path/to/siva/directory", "siva")
val df = engine.getRepositories.getHEAD.getCommits.getFirstReferenceCommit.getBlobs.dropDuplicates("blob_id").classifyLanguages.extractUASTs.cache()
df.show() Note that you must change You should be able to download a tar with the siva files from here |
Thanks @mcarmonaa. I was able to reproduce the problem with your content (even if it's random). I also made some interesting findings. Instrumenting
So my guess is that there's some kind of concurrency problem in the engine while feeding enry and that spark somehow corrupts the memory in that case. This duplication is not deterministic, but when it happens, it produces the crash. Synchronizing the access to enry seems to solve the problem, but I cannot assure this yet. So, this seems to point to a bug in the engine, but I'm not sure yet. @liuzhiwei could you please tell us whether you're using the engine or Spark? |
I've being able to reduce the dataset that reproduces the crash and it still happens without file duplication, so that may be an unrelated problem. Anyway, somehow it seems that concurrency when calling |
I created a tentative fix at #138. I cannot reproduce the bug anymore with it, but since we don't know the root of the problem it may not be fixed yet, so please let me know if the problem disappears or not. |
@abeaumont I don't use engine or spark. Just enry-java in java application. And Thanks for changing. I'll try the enry-java 1.6.3 and will let you know the problem disappears or not. |
Thanks @liuzhiwei, then it may not be related to engine at all. Let's see if that fix works, in the meantime I'll also add support to convert Go panics to exceptions so that it can mitigate the effects of these or related problems. |
@abeaumont I tried enry-java 1.6.3 with big amount of files in multiple threads. No core happened. So the issue was fixed. But it seems your solution is changing enry to be synchronized. Does it impact performance? |
@liuzhiwei Alfredo is not working on this project anymore. Since it seems that the fix worked I'll close it, please comment here if you find the problem again. |
I use Java bindings (maven version 1.6.2).
Here is the log:
The text was updated successfully, but these errors were encountered: