vmware-go-kcl-v2/clientlibrary
Aurélien Rainone c8a5aa1891 Fix possible deadlock with getRecords in eventLoop (#42)
A waitgroup should always be incremented before the creation of the
goroutine which decrements it (through Done) or there is the
potential for deadlock.
That was not the case since the wg.Add was performed after the
`go getRecords() ` line.

Also, since there's only one path leading to the wg.Done in getRecords,
I moved wg.Done out of the getRecords function and placed it
alongside the goroutine creation, thus totally removing the need to
pass the waitgroup pointer to the sc instance, this lead to the
removal of the `waitGroup` field from the `ShardConsumer` struct.

This has been tested in production and didn't create any problem.

Signed-off-by: Aurélien Rainone <aurelien.rainone@gmail.com>
2021-12-20 21:21:14 -06:00
..
checkpoint Get rid of unused skipTableCheck (#39) 2021-12-20 21:21:14 -06:00
common KCL: Update copyright and permission 2021-12-20 21:16:27 -06:00
config Add credential configuration for resources (#14) 2021-12-20 21:21:14 -06:00
interfaces KCL: Update copyright and permission 2021-12-20 21:16:27 -06:00
metrics Add credential configuration for resources (#14) 2021-12-20 21:21:14 -06:00
partition Add support for providing custom checkpointer (#17) 2021-12-20 21:21:14 -06:00
utils KCL: Fix random number generator 2021-12-20 21:16:38 -06:00
worker Fix possible deadlock with getRecords in eventLoop (#42) 2021-12-20 21:21:14 -06:00