-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
text/template/parse: Parse will leak go routines if parsing fails #10574
Comments
Patch is ready, I'm stuck here: "Thanks, your CLA has been submitted." |
Did you do a corporate CLA then I assume? Individual CLAs are instantly recognized by Gerrit. If you did corporate, email me (@golang.org) the company name and I'll look into it. |
I did a corporate first, saw the big form, and decided to go with the individual one. |
What makes you think your account is blocked? Email me the answer. Let's not discuss in the bug tracker. Try just mailing the CL with codereview again. |
Ok, nailed it. https://go-review.googlesource.com/#/c/9370/ Thanks for (week-end) support guys. |
CL https://golang.org/cl/9370 mentions this issue. |
@bradfitz I'm trying to update my changes, with a simpler version, but I can't push:
Any idea to fix this? I can't find any thing in the guide related to this :( Thanks, |
Let's move Gerrit support to a mailing list. |
Sorry :) |
Ok, I figured out, it was indeed in the doc, under the |
CL https://golang.org/cl/9501 mentions this issue. |
CL https://golang.org/cl/9658 mentions this issue. |
CL https://golang.org/cl/9841 mentions this issue. |
This was added during testing but is unnecessary. Thanks to gravis on GitHub for catching it. See #10574. Change-Id: I4a8f76d237e67f5a0ea189a0f3cadddbf426778a Reviewed-on: https://go-review.googlesource.com/9841 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(From https://groups.google.com/forum/#!topic/golang-nuts/6nTWBLbAyKo)
When Parse() is called, a new lexer is created, and it will run in the background:
(https://github.com/golang/go/blob/master/src/text/template/parse/parse.go#L228)
This will start a go routine :
(https://github.com/golang/go/blob/master/src/text/template/parse/lex.go#L191)
Now if the parser fails to parse, it will panic, and the error is recovered :
(https://github.com/golang/go/blob/master/src/text/template/parse/parse.go#L191)
which will call t.stopParse():
The lexer should be GC, except it's still running in the background, because no parser is there to pull on the channel.
I think the lex should have a abort() method to end the routine cleanly, otherwise each time the parser is called and failing, we leave a running lexer behind.
I will create a pull request to fix this, as I have already some code for that.
ps: Minux has confirmed the bug http://play.golang.org/p/qTQXuT3ktV
The text was updated successfully, but these errors were encountered: