harbor/src
Flávio Ramalho ef6414be3e
Fix deadlock on harbor-core initialization
During the harbor core initialization if the database takes longer to
be ready there is a risk of deadlock when checking for the TCP connection
with the database.

The `TestTCPConn` function uses unbuffered channels to check when the
connection succeeds/timeouts. The timeout check is executed in parallel
with the connection check (this runs in a gorountine). The deadlock happens
when the goroutine execution takes longer than the function timeout
(hence setting `cancel <- 1`) and the DialTimeout call succeeds (hence
setting `success <- 1`). At this point both threads are waiting for the
channels values to be read.

This is reproducible mostly on slow systems where initializing the
database takes longer and finishes during the 5th time of the
`DialTimeout` call where it eventually exceeds the TestTCPConn timeout.

This fix sets the `success` and `cancel` channels as buffered
(non-blocking).

Signed-off-by: Flávio Ramalho <framalho@suse.com>
2020-10-28 17:09:34 +01:00
..
chartserver Enhance: Prolong the timeout of chartclient 2020-07-27 12:06:24 +08:00
cmd Provide a standalone migrator to migrate DB schema. 2020-08-06 18:57:55 +08:00
common Fix deadlock on harbor-core initialization 2020-10-28 17:09:34 +01:00
controller Add middleware to proxy HEAD request for proxy cache project 2020-10-16 13:02:32 +08:00
core Merge pull request #13312 from reasonerjt/oidc-admin-group 2020-10-22 18:30:10 +08:00
jobservice fix(webhook): fix the verify cert logic of webhook endpoint 2020-09-10 21:01:25 +08:00
lib fix(project): change to use user id to query projects of member 2020-09-07 06:35:26 +00:00
migration Add id column to data_migration table 2020-08-20 17:43:15 +08:00
pkg Use pkg/token to generate JWT token 2020-10-15 16:16:44 +08:00
portal Merge pull request #13347 from AllForNothing/vul-list 2020-10-28 10:24:18 +08:00
registryctl handle path not found when to delete manifest 2020-07-23 03:37:11 +08:00
replication fix: fix quay adapter catalog api return error 2020-10-20 14:24:25 +08:00
server Merge pull request #13312 from reasonerjt/oidc-admin-group 2020-10-22 18:30:10 +08:00
testing Support store the cron type in the schedule (#13097) 2020-09-24 16:48:56 +08:00
vendor bump up go-digest version (#12992) 2020-09-24 16:47:29 +08:00
favicon.ico
go.mod bump up go-digest version (#12992) 2020-09-24 16:47:29 +08:00
go.sum bump up go-digest version (#12992) 2020-09-24 16:47:29 +08:00