# Second ajax request getting locked

**URL:** <https://www.ruby-forum.com/t/second-ajax-request-getting-locked/115458>\
**Category:** Rails\
**Created:** [September 25, 2007, 3:41pm UTC](https://www.ruby-forum.com/t/second-ajax-request-getting-locked/115458 "2007-09-25T15:41:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shishir\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f07891/32.png) [@shishir\_s](https://www.ruby-forum.com/u/shishir_s)\
**Post date:** [September 25, 2007, 3:41pm UTC](https://www.ruby-forum.com/t/second-ajax-request-getting-locked/115458/1 "2007-09-25T15:41:35Z")

</div>

Hi,

I have a page which sends two different ajax request to the controller  
one after the other. However, the second request doesn’t gets  
processed unless the controller finishes with the first request, i.e.  
to say the response of the first request is not delivered.

I have checked in firebug that both the requests are sent but , only  
when the response from first is received the second request is  
processed.

Is it supposed to be like this? I think there’s something wrong. What  
I suspect is that the thread gets locked unless the first request is  
completed and hence the second request is queued till that time.

I am calling two different methods on the same underlying model  
objects in these two requests.

If this is a correct behavior can anyone please tell how to let the  
two threads access the object at the same time.

I have not synchronized or made any thread safe model objects.

Thanks,  
Shishir

---

<div class="post-metadata">

**Author:** ![shishir\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f07891/32.png) [@shishir\_s](https://www.ruby-forum.com/u/shishir_s)\
**Post date:** [September 26, 2007, 5:57am UTC](https://www.ruby-forum.com/t/second-ajax-request-getting-locked/115458/2 "2007-09-26T05:57:55Z")

</div>

the controller is single threaded - it is supposed to be like that-  
the second request is queued until the first request is processed.  
however you can hit a different controller - because individual  
controllers can process requests or end up using fork() to allow  
further request processing

On Sep 25, 9:40 am, Shishir Srivastava [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![shishir\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f07891/32.png) [@shishir\_s](https://www.ruby-forum.com/u/shishir_s)\
**Post date:** [September 26, 2007, 8:12am UTC](https://www.ruby-forum.com/t/second-ajax-request-getting-locked/115458/3 "2007-09-26T08:12:55Z")

</div>

I have tried hitting different controller by moving my method in  
that , anticipating that there will be a new thread, but in vain,  
because it still waits for the first request to complete. The problem  
somehow seems to be the concurrent access to the model object by these  
two different requests.

Is it correct that the underlying model object can only be accessed by  
one controller at a time.?? Is there some configuration I need to  
set.?

~Shishir
