title: After multiple requests send to the server 500 (Internal Server Error)
body: <p>I am working on the Django application where I want to create multiple asynchronous requests with ajax to django server. It works fine if there is less than 5 asynchronous requests but if there is more requests django <code>return 500 (Internal Server Error)</code> for some of the requests. If I make synchronous ajax requests it works fine. </p>
  
  <p>Code where I send multiple ajax requests:</p>
  
  <pre><code>for (i=2; i &lt;= lastIndex; i++){
      pidForm['page_index'] = i;
      $.ajax({
          type: 'POST',
          url: '{% url "search_by_pid" %}',
          data: pidForm,
          success: function (data) {
              console.log(data);
              $(data.api_response.bugs).each(function(index, bugs){
                  var id = bugs.id;
                  createInnerHtml(id);
              });
          }
      })
  }
  </code></pre>
  
  <p>My django view, where I send the ajax request:</p>
  
  <pre><code>def get_bug_by_pid(request):
      product_id_form = ProductIdForm()
      if request.method == 'GET':
          return render(request, 'search_bug_by_pid.html',
                        {'page_title': 'ProductID', 'product_id_form': product_id_form})
  
      elif request.method == 'POST':
          product_id = request.POST['product_id']
          if 'page_index' in request.POST:
              api_call = ApiCall()
              page_index = request.POST['page_index']
              api_response = api_call.bug_api_call_by_pid(product_id, page_index)
              return JsonResponse({'api_response': api_response,'product_id': product_id})
  </code></pre>
  
  <pre><code>Internal Server Error: /pid/
  Traceback (most recent call last):
    File "C:\exception.py", line 34, in inner
      response = get_response(request)
    File "C:\base.py", line 126, in _get_response
      response = self.process_exception_by_middleware(e, request)
    File "C:\base.py", line 124, in _get_response
      response = wrapped_callback(request, *callback_args, **callback_kwargs)
    File "C:\decorators.py", line 21, in _wrapped_view
      return view_func(request, *args, **kwargs)
    File "C:\views.py", line 26, in get_bug_by_pid
      api_response = api_call.bug_api_call_by_pid(product_id, page_index)
    File "api_calls.py", line 33, in bug_api_call_by_pid
      return json.loads(r.content)
    File "C:\__init__.py", line 348, in loads
      return _default_decoder.decode(s)
    File "C:\decoder.py", line 337, in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "C:\decoder.py", line 355, in raw_decode
      raise JSONDecodeError("Expecting value", s, err.value) from None
  json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
  </code></pre>
  
  <p>Any idea how can I solve the problem or what I am doing wrong?</p>