File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,18 @@ func TestAPICreateIssue(t *testing.T) {
144144
145145func TestAPICreateIssueParallel (t * testing.T ) {
146146 defer tests .PrepareTestEnv (t )()
147+
148+ // FIXME: There seems to be a bug in go-sqlite, when doing concurrent writes to the same database,
149+ // some requests may get stuck in "go-sqlite3.(*SQLiteRows).Next", "go-sqlite3.(*SQLiteStmt).exec" and "go-sqlite3.unlock_notify_wait",
150+ // because the "unlock_notify_wait" never returns and the internal lock never gets releases.
151+ //
152+ // The trigger is: a previous test created issues and made the real issue indexer queue start processing, then this test does concurrent writing.
153+ // Adding this "Sleep" makes go-sqlite3 "finish" some internal operations before concurrent writes and then won't get stuck.
154+ // To reproduce: make a new test run these 2 tests enough times:
155+ // > func TestBug() { for i := 0; i < 100; i++ { testAPICreateIssue(t); testAPICreateIssueParallel(t) } }
156+ // Usually the test gets stuck in fewer than 10 iterations without this "sleep".
157+ time .Sleep (time .Second )
158+
147159 const body , title = "apiTestBody" , "apiTestTitle"
148160
149161 repoBefore := unittest .AssertExistsAndLoadBean (t , & repo_model.Repository {ID : 1 })
You can’t perform that action at this time.
0 commit comments