Built blender but some errors while trying to run blender inside web application

I am working with the built blender importing the bpy

but after creating the blender functionality eerything seems to be working fine untill

if i try to refresh the django app view for about 5 times simultanously
i get some error saying am interferng with current obj ,

Internal Server Error: /
Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/envs/test-env/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/home/ubuntu/anaconda3/envs/test-env/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/ubuntu/femi/project/predict_api/views.py", line 16, in home
    result = b.blender()
  File "/home/ubuntu/femi/project/blender_files/bscript.py", line 162, in blender
    ob = self.new_bpy.context.scene.objects[-1]
IndexError: bpy_prop_collection[-1]: out of range.
    (  0.1742 sec |   0.1741 sec) Done, building geometries (verts:6890 faces:13776 materials: 1 smoothgroups:0) ...
new_bpy.data.objects.keys(): []

An out of range error on .scene.objects[-1], the last element, means the collection is empty. It sounds like the scene has no objects. You might look into why that happens.

Okay yes the problem is we try to delete object from memory after each request if done, am currently importing bpy in a django application inside a request response cycle, 1, if we dont delete the object from memory it get accumulated and then gives some other error ,

so we try after each response to delete object, but in the end it still seems like the request interfere with each other.

why what happened?

its just interference, we delete the object from current request after its finished,
but seems like the next start request which was supposed to start as soon as the previous finishes are colliding.

Generally speaking, this sounds like threads and events fighting each other.

Just thinking out loud…
Maybe put the to-be-deleted-objects in a queue and give a worker the job of checking the queue and deleting anything that shows up.

It doesn’t sound like threads, you are 100% right it is 100% threading, after running the server with no threads the problem seems to go away, so my final question to be 100% sure it seems like blender is not multithreaded .