Curl error 28: Operation timed out after 5000 milliseconds with 0 bytes received

When I’m starting the game in unity, sometimes Unity 2018.4.16f1 crashes and I don’t know why.
In the last editor log I see this:

Curl error 28: Operation timed out after 5000 milliseconds with 0 bytes received

0x000000014145EFF8 (Unity) StackWalker::GetCurrentCallstack
0x00000001414654A6 (Unity) StackWalker::ShowCallstack
0x0000000141347B6B (Unity) GetStacktrace
0x000000014014B4C8 (Unity) DebugStringToFile
0x0000000141DF149B (Unity) TransportCurl::TransformCurlErrorToWebError
0x0000000141DEED16 (Unity) CurlExecutor::CurlExecute
0x00000001408D6D18 (Unity) JobQueue::Exec
0x00000001408D8C5D (Unity) JobQueue::Steal
0x00000001408D6FA2 (Unity) JobQueue::ExecuteJobFromQueue
0x00000001408D73A2 (Unity) JobQueue::ProcessJobs
0x00000001408D93E3 (Unity) JobQueue::WorkLoop
0x0000000140AAB9E0 (Unity) Thread::RunThreadWrapper
0x00007FFA5F307BD4 (KERNEL32) BaseThreadInitThunk
0x00007FFA5F5CCED1 (ntdll) RtlUserThreadStart
(Filename: C:\buildslave\unity\build\Modules/UnityWebRequest/Implementations/TransportCurl.cpp Line: 757)

* Assertion at ..\mono\metadata	hreads.c:1780, condition `internal' not met

I see the problem is in UnityWebRequest, but I’m using it in many parts of code and I don’t know, what I’m should to show in code example…
And I’m sure, what the problem is not in the code.

I have similar problem…

Refresh Completed time: 0.115096s
	Asset Scan time: 0.026281s
	Asset Hashing: 0.000000s [0 B, 0.000000 mb/s]
	Asset Import (Scripting) time: 0.000000s (count: 0)
	Post Processs Assets (Scripting) time: 0.000000s
	Asset Rehashing: 0.000000s [0 B, 0.000000 mb/s]
	Asset Import (Non Scripting) time: 0.000000s (count: 0)
	Post Process Assets (Non Scripting) time: 0.000000s
	Dependent Assets to Import Queue time: 0.000000s

Curl error 28: Operation timed out after 300000 milliseconds with 0 out of 0 bytes received

(Filename: /Users/builduser/buildslave/unity/build/Modules/UnityWebRequest/Implementations/TransportCurl.cpp Line: 757)

I get this occasionally on startup for my app.
It seems to be related to caching or a security policy, most likely on the server I am trying to connect to.

I decided to work around it by putting a “internet/server check” on startup.
This call has 10 retries with a small timeout, e.g. 5 second interval.

This ensures that startup time is small (5 seconds to the first failure), and the second attempt goes through straight away.

It’s not the perfect solution, but at least gives me a more reliable and practical app startup time.