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

Fix panic in unique persistable channel queue #16072

Merged
merged 3 commits into from
Jun 5, 2021

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented Jun 5, 2021

There is an incorrect casting in the wrapped queue.

Fix #16071

Signed-off-by: Andrew Thornton [email protected]

There is an incorrect casting in the wrapped queue.

Fix go-gitea#16071

Signed-off-by: Andrew Thornton <[email protected]>
@zeripath zeripath added this to the 1.15.0 milestone Jun 5, 2021
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Jun 5, 2021
@@ -188,7 +188,7 @@ func (q *PersistableChannelUniqueQueue) Run(atShutdown, atTerminate func(func())
go q.internal.Run(func(_ func()) {}, func(_ func()) {})
go func() {
_ = q.internal.Flush(0)
log.Debug("LevelUniqueQueue: %s flushed so shutting down", q.internal.(*LevelQueue).Name())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to know if line 197 also may panic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope it can't

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it also q.internal.(*LevelUniqueQueue) when luq, ok := q.internal.(*LevelUniqueQueue); !ok

Copy link
Contributor Author

@zeripath zeripath Jun 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's only assigned to LevelUniqueQueue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so maybe if q.internal.(*LevelUniqueQueue).ByteFIFOUniqueQueue.byteFIFO.Len(luq.shutdownCtx) != 0 will not make confusion.

@codecov-commenter
Copy link

codecov-commenter commented Jun 5, 2021

Codecov Report

Merging #16072 (6e651f9) into main (b77c62d) will increase coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16072   +/-   ##
=======================================
  Coverage   44.08%   44.08%           
=======================================
  Files         683      683           
  Lines       82442    82442           
=======================================
+ Hits        36341    36344    +3     
+ Misses      40187    40182    -5     
- Partials     5914     5916    +2     
Impacted Files Coverage Δ
modules/queue/unique_queue_disk_channel.go 48.63% <0.00%> (ø)
services/pull/temp_repo.go 26.59% <0.00%> (-3.20%) ⬇️
services/pull/check.go 26.02% <0.00%> (-2.74%) ⬇️
services/pull/patch.go 54.23% <0.00%> (-1.70%) ⬇️
services/pull/pull.go 43.37% <0.00%> (-0.46%) ⬇️
routers/repo/view.go 41.31% <0.00%> (+0.57%) ⬆️
models/repo_list.go 77.82% <0.00%> (+0.77%) ⬆️
modules/queue/workerpool.go 55.34% <0.00%> (+1.52%) ⬆️
modules/log/event.go 61.79% <0.00%> (+1.88%) ⬆️
models/unit.go 49.31% <0.00%> (+2.73%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b77c62d...6e651f9. Read the comment docs.

@GiteaBot 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 Jun 5, 2021
@6543
Copy link
Member

6543 commented Jun 5, 2021

look's like a copy paste issue ;)

@zeripath zeripath merged commit fe18a85 into go-gitea:main Jun 5, 2021
@zeripath zeripath deleted the fix-16071 branch June 5, 2021 14:23
@zeripath zeripath added the skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. label Jun 5, 2021
@zeripath zeripath changed the title Fix panic Fix panic in unique persistable channel queue Jun 27, 2021
AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this pull request Aug 10, 2021
There is an incorrect casting in the wrapped queue.

Fix go-gitea#16071

Signed-off-by: Andrew Thornton <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

infer panic in queue/unique_queue_disk_channel.go
5 participants