TLS Connection (remote connection closed)

I am using gvm 21.4.2 remotely through tls and python-gvm
I want to create more than one task in a loop; before starting a task I have 2 seconds sleep but after n tasks started I get the error ‘remote connection closed’ ,
I say n because every time I run the code the number of tasks which start successfully are different .
I checked all the posts related to this problem but I couldn’t have got a clue how I can solve this problem .
One more thing maybe I should mention is that my code is running under django
I get my input from post

here is the error :

raise GvmError("Remote closed the connection")
gvm.errors.GvmError: Remote closed the connection
[20/Sep/2021 07:53:32] "POST /sendjson/ HTTP/1.1" 500 102110

No one can tell me how I can tacke this issue ?