-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Ensure that template compilation panics are sent to the logs #16788
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have marked this bug because it prevents effective debugging. |
GiteaBot
added
the
lgtm/need 2
This PR needs two approvals by maintainers to be considered for merging.
label
Aug 23, 2021
jolheiser
reviewed
Aug 23, 2021
Although panics within the rendering pipeline are caught and dealt with, panics that occur before that starts are unprotected and will kill Gitea without being sent to the logs. This PR adds a basic recovery handler to catch panics that occur after the logger is initialised and ensure that they're sent to the logger. Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath
force-pushed
the
wrap-template-panic
branch
from
August 23, 2021 19:04
d58ca93
to
e8176d6
Compare
jolheiser
approved these changes
Aug 23, 2021
GiteaBot
added
lgtm/need 1
This PR needs approval from one additional maintainer to be merged.
and removed
lgtm/need 2
This PR needs two approvals by maintainers to be considered for merging.
labels
Aug 23, 2021
Codecov Report
@@ Coverage Diff @@
## main #16788 +/- ##
==========================================
- Coverage 45.52% 45.51% -0.01%
==========================================
Files 762 762
Lines 85939 85942 +3
==========================================
- Hits 39124 39119 -5
- Misses 40508 40515 +7
- Partials 6307 6308 +1
Continue to review full report at Codecov.
|
zeripath
added a commit
to zeripath/gitea
that referenced
this pull request
Aug 23, 2021
…a#16788) Backport go-gitea#16788 Although panics within the rendering pipeline are caught and dealt with, panics that occur before that starts are unprotected and will kill Gitea without being sent to the logs. This PR adds a basic recovery handler to catch panics that occur after the logger is initialised and ensure that they're sent to the logger. Signed-off-by: Andrew Thornton <art27@cantab.net>
techknowlogick
approved these changes
Aug 23, 2021
GiteaBot
added
lgtm/done
This PR has enough approvals to get merged. There are no important open reservations anymore.
and removed
lgtm/need 1
This PR needs approval from one additional maintainer to be merged.
labels
Aug 23, 2021
techknowlogick
added a commit
that referenced
this pull request
Aug 23, 2021
…#16792) Backport #16788 Although panics within the rendering pipeline are caught and dealt with, panics that occur before that starts are unprotected and will kill Gitea without being sent to the logs. This PR adds a basic recovery handler to catch panics that occur after the logger is initialised and ensure that they're sent to the logger. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
6 tasks
zeripath
added a commit
to zeripath/gitea
that referenced
this pull request
Sep 2, 2021
## [1.15.1](https://github.com/go-gitea/gitea/releases/tag/v1.15.1) - 2021-09-02 * BUGFIXES * Allow BASIC authentication access to /:owner/:repo/releases/download/* (go-gitea#16916) (go-gitea#16923) * Prevent leave changes dialogs due to autofill fields (go-gitea#16912) (go-gitea#16920) * Ignore review comment when ref commit is missed (go-gitea#16905) (go-gitea#16919) * Fix wrong attachment removal (go-gitea#16915) (go-gitea#16917) * Gitlab Migrator: dont ignore reactions of last request (go-gitea#16903) (go-gitea#16913) * Correctly return the number of Repositories for Organizations (go-gitea#16807) (go-gitea#16911) * Test if LFS object is accessible (go-gitea#16865) (go-gitea#16904) * Fix git.Blob.DataAsync(): close pipe since we return a NopCloser (go-gitea#16899) (go-gitea#16900) * Fix dump and restore respository (go-gitea#16698) (go-gitea#16898) * Repare and Improve GetDiffRangeWithWhitespaceBehavior (go-gitea#16894) (go-gitea#16895) * Fix wiki raw commit diff/patch view (go-gitea#16891) (go-gitea#16892) * Ensure wiki repos are all closed (go-gitea#16886) (go-gitea#16888) * List limited and private orgs if authenticated on API (go-gitea#16866) (go-gitea#16879) * Simplify split diff view generation and remove JS dependency (go-gitea#16775) (go-gitea#16863) * Ensure that the default visibility is set on the user create page (go-gitea#16845) (go-gitea#16862) * In Render tolerate not being passed a context (go-gitea#16842) (go-gitea#16858) * Upgrade xorm to v1.2.2 (go-gitea#16663) & Add test to ensure that dumping of login sources remains correct (go-gitea#16847) (go-gitea#16848) * Report the correct number of pushes on the feeds (go-gitea#16811) (go-gitea#16822) * Add primary_key to issue_index (go-gitea#16813) (go-gitea#16820) * Prevent NPE on empty commit (go-gitea#16812) (go-gitea#16819) * Fix branch pagination error (go-gitea#16805) (go-gitea#16816) * Add missing return to handleSettingRemoteAddrError (go-gitea#16794) (go-gitea#16795) * Remove spurious / from issues.opened_by (go-gitea#16793) * Ensure that template compilation panics are sent to the logs (go-gitea#16788) (go-gitea#16792) * Update caddyserver/certmagic (go-gitea#16789) (go-gitea#16790) Signed-off-by: Andrew Thornton <art27@cantab.net>
Merged
zeripath
added a commit
that referenced
this pull request
Sep 2, 2021
## [1.15.1](https://github.com/go-gitea/gitea/releases/tag/v1.15.1) - 2021-09-02 * BUGFIXES * Allow BASIC authentication access to /:owner/:repo/releases/download/* (#16916) (#16923) * Prevent leave changes dialogs due to autofill fields (#16912) (#16920) * Ignore review comment when ref commit is missed (#16905) (#16919) * Fix wrong attachment removal (#16915) (#16917) * Gitlab Migrator: dont ignore reactions of last request (#16903) (#16913) * Correctly return the number of Repositories for Organizations (#16807) (#16911) * Test if LFS object is accessible (#16865) (#16904) * Fix git.Blob.DataAsync(): close pipe since we return a NopCloser (#16899) (#16900) * Fix dump and restore respository (#16698) (#16898) * Repare and Improve GetDiffRangeWithWhitespaceBehavior (#16894) (#16895) * Fix wiki raw commit diff/patch view (#16891) (#16892) * Ensure wiki repos are all closed (#16886) (#16888) * List limited and private orgs if authenticated on API (#16866) (#16879) * Simplify split diff view generation and remove JS dependency (#16775) (#16863) * Ensure that the default visibility is set on the user create page (#16845) (#16862) * In Render tolerate not being passed a context (#16842) (#16858) * Upgrade xorm to v1.2.2 (#16663) & Add test to ensure that dumping of login sources remains correct (#16847) (#16848) * Report the correct number of pushes on the feeds (#16811) (#16822) * Add primary_key to issue_index (#16813) (#16820) * Prevent NPE on empty commit (#16812) (#16819) * Fix branch pagination error (#16805) (#16816) * Add missing return to handleSettingRemoteAddrError (#16794) (#16795) * Remove spurious / from issues.opened_by (#16793) * Ensure that template compilation panics are sent to the logs (#16788) (#16792) * Update caddyserver/certmagic (#16789) (#16790) Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath
added a commit
to zeripath/gitea
that referenced
this pull request
Sep 2, 2021
## [1.15.1](https://github.com/go-gitea/gitea/releases/tag/v1.15.1) - 2021-09-02 * BUGFIXES * Allow BASIC authentication access to /:owner/:repo/releases/download/* (go-gitea#16916) (go-gitea#16923) * Prevent leave changes dialogs due to autofill fields (go-gitea#16912) (go-gitea#16920) * Ignore review comment when ref commit is missed (go-gitea#16905) (go-gitea#16919) * Fix wrong attachment removal (go-gitea#16915) (go-gitea#16917) * Gitlab Migrator: dont ignore reactions of last request (go-gitea#16903) (go-gitea#16913) * Correctly return the number of Repositories for Organizations (go-gitea#16807) (go-gitea#16911) * Test if LFS object is accessible (go-gitea#16865) (go-gitea#16904) * Fix git.Blob.DataAsync(): close pipe since we return a NopCloser (go-gitea#16899) (go-gitea#16900) * Fix dump and restore respository (go-gitea#16698) (go-gitea#16898) * Repare and Improve GetDiffRangeWithWhitespaceBehavior (go-gitea#16894) (go-gitea#16895) * Fix wiki raw commit diff/patch view (go-gitea#16891) (go-gitea#16892) * Ensure wiki repos are all closed (go-gitea#16886) (go-gitea#16888) * List limited and private orgs if authenticated on API (go-gitea#16866) (go-gitea#16879) * Simplify split diff view generation and remove JS dependency (go-gitea#16775) (go-gitea#16863) * Ensure that the default visibility is set on the user create page (go-gitea#16845) (go-gitea#16862) * In Render tolerate not being passed a context (go-gitea#16842) (go-gitea#16858) * Upgrade xorm to v1.2.2 (go-gitea#16663) & Add test to ensure that dumping of login sources remains correct (go-gitea#16847) (go-gitea#16848) * Report the correct number of pushes on the feeds (go-gitea#16811) (go-gitea#16822) * Add primary_key to issue_index (go-gitea#16813) (go-gitea#16820) * Prevent NPE on empty commit (go-gitea#16812) (go-gitea#16819) * Fix branch pagination error (go-gitea#16805) (go-gitea#16816) * Add missing return to handleSettingRemoteAddrError (go-gitea#16794) (go-gitea#16795) * Remove spurious / from issues.opened_by (go-gitea#16793) * Ensure that template compilation panics are sent to the logs (go-gitea#16788) (go-gitea#16792) * Update caddyserver/certmagic (go-gitea#16789) (go-gitea#16790) Signed-off-by: Andrew Thornton <art27@cantab.net>
techknowlogick
pushed a commit
that referenced
this pull request
Sep 2, 2021
## [1.15.1](https://github.com/go-gitea/gitea/releases/tag/v1.15.1) - 2021-09-02 * BUGFIXES * Allow BASIC authentication access to /:owner/:repo/releases/download/* (#16916) (#16923) * Prevent leave changes dialogs due to autofill fields (#16912) (#16920) * Ignore review comment when ref commit is missed (#16905) (#16919) * Fix wrong attachment removal (#16915) (#16917) * Gitlab Migrator: dont ignore reactions of last request (#16903) (#16913) * Correctly return the number of Repositories for Organizations (#16807) (#16911) * Test if LFS object is accessible (#16865) (#16904) * Fix git.Blob.DataAsync(): close pipe since we return a NopCloser (#16899) (#16900) * Fix dump and restore respository (#16698) (#16898) * Repare and Improve GetDiffRangeWithWhitespaceBehavior (#16894) (#16895) * Fix wiki raw commit diff/patch view (#16891) (#16892) * Ensure wiki repos are all closed (#16886) (#16888) * List limited and private orgs if authenticated on API (#16866) (#16879) * Simplify split diff view generation and remove JS dependency (#16775) (#16863) * Ensure that the default visibility is set on the user create page (#16845) (#16862) * In Render tolerate not being passed a context (#16842) (#16858) * Upgrade xorm to v1.2.2 (#16663) & Add test to ensure that dumping of login sources remains correct (#16847) (#16848) * Report the correct number of pushes on the feeds (#16811) (#16822) * Add primary_key to issue_index (#16813) (#16820) * Prevent NPE on empty commit (#16812) (#16819) * Fix branch pagination error (#16805) (#16816) * Add missing return to handleSettingRemoteAddrError (#16794) (#16795) * Remove spurious / from issues.opened_by (#16793) * Ensure that template compilation panics are sent to the logs (#16788) (#16792) * Update caddyserver/certmagic (#16789) (#16790) Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath
pushed a commit
that referenced
this pull request
Sep 3, 2021
Thanks to #16788 I can see why our docker container kept restarting when adding the custom mail template example. [The example template](https://docs.gitea.io/en-us/mail-templates/#example) has an error ``` 2021/09/03 10:55:25 cmd/web.go:91:func1() [F] PANIC: template: mail/issue/default:35: function "AppURL" not defined /usr/local/go/src/html/template/template.go:374 (0x1563bb8) /go/src/code.gitea.io/gitea/vendor/github.com/unrolled/render/render.go:322 (0x1563782) /go/src/code.gitea.io/gitea/vendor/github.com/unrolled/render/render.go:202 (0x1562f8b) /go/src/code.gitea.io/gitea/vendor/github.com/unrolled/render/render.go:146 (0x15629d2) /go/src/code.gitea.io/gitea/modules/templates/base.go:88 (0x16b0769) /go/src/code.gitea.io/gitea/routers/web/base.go:125 (0x225f284) /go/src/code.gitea.io/gitea/routers/web/web.go:95 (0x2261284) /go/src/code.gitea.io/gitea/routers/init.go:147 (0x22817ba) /go/src/code.gitea.io/gitea/cmd/web.go:158 (0x239741a) /go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:524 (0x1740884) /go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/command.go:173 (0x17415f8) /go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:277 (0x173e8c7) /go/src/code.gitea.io/gitea/main.go:115 (0x23d3e69) /usr/local/go/src/runtime/proc.go:225 (0x443995) /usr/local/go/src/runtime/asm_amd64.s:1371 (0x47b360) ```
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
backport/done
All backports for this PR have been created
lgtm/done
This PR has enough approvals to get merged. There are no important open reservations anymore.
type/bug
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Although panics within the rendering pipeline are caught and dealt with,
panics that occur before that starts are unprotected and will kill Gitea
without being sent to the logs.
This PR adds a basic recovery handler to catch panics that occur after
the logger is initialised and ensure that they're sent to the logger.
Related #16784
Signed-off-by: Andrew Thornton art27@cantab.net