Closed kingforaday closed 5 years ago
Take a look at the latest commit cb6a11a. To not interrupt the addLinks channel management there is a separate one for any retries required.
Unfortunately this does not fix the deadlock either.
I tested your branch returning an error randomly on calls to zoneDownload(zi)
and after the first few zones the program stopped in a deadlock.
The problem is that once the retryChan
is full we are back where we started where the worker threads are blocked adding new items to the channel and cant take items out of either retryChan
or inputChan
.
The best solution I can think of is to take the code from commit a7ea2867fb9cc34ed83c8c84a1688e92d602bf94 and change the line:
inputChan <- zi // requeue
to:
go func() {
inputChan <- zi // requeue
}()
This adds the ZoneInfo
back to inputChan
in its own goroutine and does not block the worker. Its not ideal, but it will never deadlock.
This has been added in #4
CZDS had previously shown some instability in their infrastructure, which seems to have stabilized, but should a connection timeout occur during zone download or other disconnect, this will re-add the zone location back to the processing queue for further retries.