Skip to content

A lot of global lock test errors #32322

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

Closed
wxiaoguang opened this issue Oct 23, 2024 · 5 comments
Closed

A lot of global lock test errors #32322

wxiaoguang opened this issue Oct 23, 2024 · 5 comments
Labels

Comments

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Oct 23, 2024

--- FAIL: TestLockAndDo (15.23s)
    --- FAIL: TestLockAndDo/redis (15.00s)
        globallock_test.go:89: 
            	Error Trace:	/home/runner/work/gitea/gitea/modules/globallock/globallock_test.go:89
            	            				/opt/hostedtoolcache/go/1.23.2/x64/src/runtime/asm_amd64.s:1700
            	Error:      	Received unexpected error:
            	            	lock already taken, locked nodes: [0]
            	Test:       	TestLockAndDo/redis
        globallock_test.go:89: 
            	Error Trace:	/home/runner/work/gitea/gitea/modules/globallock/globallock_test.go:89
            	            				/opt/hostedtoolcache/go/1.23.2/x64/src/runtime/asm_amd64.s:1700
            	Error:      	Received unexpected error:
            	            	lock already taken, locked nodes: [0]
            	Test:       	TestLockAndDo/redis

...
...
...
         globallock_test.go:89: 
            	Error Trace:	/home/runner/work/gitea/gitea/modules/globallock/globallock_test.go:89
            	            				/opt/hostedtoolcache/go/1.23.2/x64/src/runtime/asm_amd64.s:1700
            	Error:      	Received unexpected error:
            	            	lock already taken, locked nodes: [0]
            	Test:       	TestLockAndDo/redis
        globallock_test.go:89: 
            	Error Trace:	/home/runner/work/gitea/gitea/modules/globallock/globallock_test.go:89
            	            				/opt/hostedtoolcache/go/1.23.2/x64/src/runtime/asm_amd64.s:1700
            	Error:      	Received unexpected error:
            	            	lock already taken, locked nodes: [0]
            	Test:       	TestLockAndDo/redis
        globallock_test.go:95: 
            	Error Trace:	/home/runner/work/gitea/gitea/modules/globallock/globallock_test.go:95
            	            				/home/runner/work/gitea/gitea/modules/globallock/globallock_test.go:43
            	Error:      	Not equal: 
            	            	expected: 1000
            	            	actual  : 776
            	Test:       	TestLockAndDo/redis
FAIL
coverage: 91.8% of statements
FAIL	code.gitea.io/gitea/modules/globallock	23.286s
@wolfogre
Copy link
Member

How were these errors reproduced? Is it possible that the previous test was aborted and the lock was not released, and the test was restarted before the lock expired?

@lunny
Copy link
Member

lunny commented Oct 23, 2024

I cannot reproduce it on my local machine. macOS go1.23.2 run with TEST_REDIS_URL=redis://127.0.0.1:6379/15 go test -tags=sqlite -run=TestLockAndDo.

@wxiaoguang
Copy link
Contributor Author

How were these errors reproduced? Is it possible that the previous test was aborted and the lock was not released, and the test was restarted before the lock expired?

No idea, I just caught it from github actions. https://github.com/go-gitea/gitea/actions/runs/11459790779/job/31885087438

@wxiaoguang
Copy link
Contributor Author

It fails a lot, probability > 5% or 10%

@wxiaoguang
Copy link
Contributor Author

The root problem is that the global lock (redis) implementation is not right. But I guess I won't spend more time on it. Even if the lock goes wrong, end users won't be hurt too much at the moment.

@wxiaoguang wxiaoguang closed this as not planned Won't fix, can't repro, duplicate, stale Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants